Skip to content

Commit

Permalink
Extract s:clear_cache()
Browse files Browse the repository at this point in the history
  • Loading branch information
airblade committed Sep 14, 2023
1 parent c08f03e commit 1353fa4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugin/rooter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ command! -bar RooterToggle call <SID>toggle()
augroup rooter
autocmd!
autocmd VimEnter,BufReadPost,BufEnter * nested if !g:rooter_manual_only | call <SID>rooter(+expand('<abuf>')) | endif
autocmd BufWritePost * nested if !g:rooter_manual_only | call setbufvar(+expand('<abuf>'), 'rootDir', '') | call <SID>rooter(+expand('<abuf>')) | endif
autocmd BufWritePost * nested if !g:rooter_manual_only | call <SID>clear_cache(+expand('<abuf>')) | call <SID>rooter(+expand('<abuf>')) | endif
augroup END


Expand All @@ -89,6 +89,11 @@ function! s:rooter(...)
endfunction


function! s:clear_cache(bufnr)
call setbufvar(a:bufnr, 'rootDir', '')
endfunction


" Returns true if we should change to the buffer's root directory, false otherwise.
function! s:activate()
if index(g:rooter_buftypes, &buftype) == -1 | return 0 | endif
Expand Down

0 comments on commit 1353fa4

Please sign in to comment.