diff --git a/doc/sleuth.txt b/doc/sleuth.txt index ef5c7b3..acbef07 100644 --- a/doc/sleuth.txt +++ b/doc/sleuth.txt @@ -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: diff --git a/plugin/sleuth.vim b/plugin/sleuth.vim index bfba50e..890d3cb 100644 --- a/plugin/sleuth.vim +++ b/plugin/sleuth.vim @@ -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()