From e3e5adfeaacb05cad1579548d8c9048761fe0ba1 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 9 Apr 2017 16:33:35 -0400 Subject: [PATCH] Add indicator for flagship.vim --- doc/sleuth.txt | 5 ++++- plugin/sleuth.vim | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) 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()