Watch
1
0
Fork
You've already forked vim-sleuth
0
mirror of https://github.com/tpope/vim-sleuth.git synced 2026-11-17 02:20:36 +00:00
sleuth.vim: Heuristically set buffer options
  • Vim Script 90.8%
  • Python 9.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2024-09-19 00:01:33 -04:00
.github Add sponsor button 2019-11-12 19:01:33 -05:00
doc Don't set 'smarttab' 2023-01-10 14:13:50 -05:00
plugin Fix regression in {} list expansion 2024-09-19 00:01:33 -04:00
test Add script to drive editorconfig-core-test 2021-12-18 21:38:09 -05:00
.gitattributes Add script to drive editorconfig-core-test 2021-12-18 21:38:09 -05:00
.gitignore sleuth.vim 1.0 2012-12-30 18:16:58 -05:00
CONTRIBUTING.markdown Extract CONTRIBUTING.markdown 2014-02-20 23:18:14 -05:00
README.markdown Drop README reference to alternative plugin 2023-01-10 14:13:49 -05:00

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.

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.