-
-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Disable for specific filetypes #29
Comments
Does it try to auto-detect settings even when you've explicitly configured them for the filetype? |
The idea is that |
Okay, more analysis: Vim versions 7.4.488 and 7.4.622 exhibit identical behaviors with the following minimal set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
"Plugin 'tpope/vim-sleuth'
call vundle#end()
filetype plugin indent on
au FileType go set ts=2 sw=2 This form ( |
Yeah, there's no mystery why vim-sleuth overrides your custom settings. It registers an autocmd in plugin/sleuth.vim, after your vimrc executes, so the autocmd will fire late and override other autocmds. The question is whether there's anything vim-sleuth can do to give precedence to other plugins. If there's nothing automatic, maybe a convention of setting au Filetype go set ts=2 sw=2 | let b:options_applied = 1 |
I could have sworn that I had this working, but you're right, the sleuth autocommand is defined later and will always win over the vimrc. One thing you could do is stick your overrides in
You could also explicitly These are all crude hacks, but I think they are better than |
I ran into this again and added this to my vimrc as a workaround: VAMActivate sleuth
" Workaround for https://github.com/tpope/vim-sleuth/issues/29.
" Define autocmd as early as possible so other autocmds can override.
runtime! plugin/sleuth.vim The VimEnter option is much less flexible because it forces you to repeat your explicit configuration values inline. It's not an option if you want to give other filetype plugins control over indent settings instead of hard-coding your own. I'd really appreciate a fix that could get vim-sleuth to have the right precedence out of the box, though. =) |
vim-sleuth struggles with mail. takes forever for vim to open within mutt (goes away when i remove plugin), so +1 for exclude ft support |
A similar issue occurs with rst.vim, which uses 3-space indents (see marshallward/vim-restructuredtext#8 for rationale); but if you have item lists à la
then vim-sleuth will set a 2-space indent. I'm not sure whether the autocommand ordering would make the following work, but perhaps(?) sleuth_automatic could be made a buffer-local variable, so that one could set b:sleuth_automatic to 0 in ~/.vim/ftplugin/foo.vim? |
This would also be a great workaround for #43 |
Merged #44 which should provide for this. I also limited it to 20 neighbor files before giving up, which I have a hunch is what was causing the mail slowdown. |
I've added options to opt-out of heuristic detection on a per-filetype basis: let g:sleuth_mail_heuristics = 0 There's also This is a bit less flexible than a buffer-local option, but easier to use and not subject to autocommand ordering issues, so I am deprecating |
My preferences for go (golang) files don't always mesh well with this plugin, which I otherwise really like. See #28 for a concrete example. It could be nice to be able to do something like this:
The text was updated successfully, but these errors were encountered: