diff --git a/lua/symbols-outline.lua b/lua/symbols-outline.lua index 93af910..3aec829 100644 --- a/lua/symbols-outline.lua +++ b/lua/symbols-outline.lua @@ -12,6 +12,9 @@ local function setup_global_autocmd() if config.options.highlight_hovered_item then vim.cmd "au CursorHold * :lua require('symbols-outline')._highlight_current_item()" end + +vim.cmd "au InsertLeave,WinEnter,BufEnter,BufWinEnter,TabEnter,BufWritePost * :lua require('symbols-outline')._refresh()" +vim.cmd "au WinEnter * lua require'symbols-outline.preview'.close()" end ------------------------- diff --git a/plugin/symbols-outline.vim b/plugin/symbols-outline.vim index f8456c9..be0f1b9 100644 --- a/plugin/symbols-outline.vim +++ b/plugin/symbols-outline.vim @@ -1,17 +1,3 @@ -if exists('g:loaded_symbols_outline') - finish -endif -let g:loaded_symbols_outline = 1 - -if exists('g:symbols_outline') - call luaeval('require"symbols-outline".setup(_A[1])', [g:symbols_outline]) -else - call luaeval('require"symbols-outline".setup()') -endif - command! SymbolsOutline :lua require'symbols-outline'.toggle_outline() command! SymbolsOutlineOpen :lua require'symbols-outline'.open_outline() command! SymbolsOutlineClose :lua require'symbols-outline'.close_outline() - -au InsertLeave,WinEnter,BufEnter,BufWinEnter,TabEnter,BufWritePost * :lua require('symbols-outline')._refresh() -au WinEnter * lua require'symbols-outline.preview'.close()