Add indicator for flagship.vim

This commit is contained in:
Tim Pope 2017-04-09 16:33:35 -04:00
parent 2826bc17ef
commit e3e5adfeaa
2 changed files with 16 additions and 1 deletions

View File

@ -17,11 +17,14 @@ current and parent directories. In lieu of adjusting 'softtabstop',
*:Sleuth*
:Sleuth Manually detect indentation.
*SleuthIndicator()*
SleuthIndicator() Indicator for inclusion in 'statusline'. Or use
flagship.vim to have it included automatically.
SETTINGS *sleuth-settings*
Automatic detection of buffer options can be controlled with:
>
let g:sleuth_automatic = 0
<
vim:tw=78:et:ft=help:norl:

View File

@ -161,9 +161,21 @@ if !exists('g:did_indent_on')
filetype indent on
endif
function! SleuthIndicator() abort
if &expandtab
return 'sw='.&shiftwidth
elseif &tabstop == &shiftwidth
return 'ts='.&tabstop
else
return 'sw='.&shiftwidth.',ts='.&tabstop
endif
endfunction
augroup sleuth
autocmd!
autocmd FileType * if get(g:, 'sleuth_automatic', 1) | call s:detect() | endif
autocmd FileType * call s:detect()
autocmd User Flags call Hoist('buffer', 5, 'SleuthIndicator')
augroup END
command! -bar -bang Sleuth call s:detect()