Skip to content

sisrfeng/indent-OK

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sleuth.vim

This plugin automatically adjusts 'shiftwidth' and 'expandtab' heuristically based on the current file, or, in the case the current file is new, blank, or otherwise insufficient, by looking at other files of the same type in the current and parent directories. Modelines and EditorConfig are also consulted, adding 'tabstop', 'textwidth', 'endofline', 'fileformat', 'fileencoding', and 'bomb' to the list of supported options.

Compare to DetectIndent. I wrote this because I wanted something fully automatic. My goal is that by installing this plugin, you can remove all indenting related configuration from your vimrc.

Installation

Install using your favorite package manager, or use Vim's built-in package support:

mkdir -p ~/.vim/pack/tpope/start
cd ~/.vim/pack/tpope/start
git clone https://tpope.io/vim/sleuth.git
vim -u NONE -c "helptags sleuth/doc" -c q

Notes

  • If your file is consistently indented with hard tabs, 'shiftwidth' will be set to your 'tabstop'. Otherwise, a 'tabstop' of 8 is enforced, unless another value is explicitly declared in a modeline or EditorConfig.

Self-Promotion

Like sleuth.vim? Follow the repository on GitHub and vote for it on vim.org. And if you're feeling especially charitable, follow tpope on Twitter and GitHub.

License

Copyright © Tim Pope. Distributed under the same terms as Vim itself. See :help license.

About

sleuth.vim: Heuristically set buffer options

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Vim Script 91.2%
  • Python 8.8%