vim-sleuth/README.markdown

49 lines
1.9 KiB
Markdown
Raw Permalink Normal View History

2012-12-30 23:22:46 +01:00
# sleuth.vim
2013-01-03 01:44:02 +01:00
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. In lieu of adjusting
`'softtabstop'`, `'smarttab'` is enabled.
2012-12-30 23:22:46 +01:00
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.
[DetectIndent]: http://www.vim.org/scripts/script.php?script_id=1171
## Installation
If you don't have a preferred installation method, I recommend
installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
then simply copy and paste:
cd ~/.vim/bundle
git clone git://github.com/tpope/vim-sleuth.git
## Notes
* Searching for other files of the same type continues up the directory
hierarchy until a match is found. This means, for example, the indent for
the first file in a brand new Ruby project might very well be derived from
your `.irbrc`. I consider this a feature.
2014-02-21 05:16:48 +01:00
* If your file is consistently indented with hard tabs, `'shiftwidth'` will be
2017-04-10 03:13:26 +02:00
set to your `'tabstop'`. Otherwise, a `'tabstop'` of 4 is enforced.
2012-12-30 23:22:46 +01:00
* The algorithm is rolled from scratch, fairly simplistic, and only lightly
battle tested. It's probably not (yet) as good as [DetectIndent][].
Let me know what it fails on for you.
## Self-Promotion
2012-12-30 23:22:46 +01:00
Like sleuth.vim? Follow the repository on
2012-12-31 01:15:54 +01:00
[GitHub](https://github.com/tpope/vim-sleuth) and vote for it on
[vim.org](http://www.vim.org/scripts/script.php?script_id=4375). And if
2012-12-31 03:25:08 +01:00
you're feeling especially charitable, follow [tpope](http://tpo.pe/) on
2012-12-30 23:22:46 +01:00
[Twitter](http://twitter.com/tpope) and
[GitHub](https://github.com/tpope).
## License
2012-12-30 23:22:46 +01:00
2012-12-31 06:07:40 +01:00
Copyright © Tim Pope. Distributed under the same terms as Vim itself.
2012-12-30 23:22:46 +01:00
See `:help license`.