diff options
Diffstat (limited to 'fnl/settings')
-rw-r--r-- | fnl/settings/autocmds.fnl | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/fnl/settings/autocmds.fnl b/fnl/settings/autocmds.fnl index d32f814..a646130 100644 --- a/fnl/settings/autocmds.fnl +++ b/fnl/settings/autocmds.fnl @@ -1,4 +1,7 @@ ;; Autocommands for nvim. + +(local cursorline (require :util.cursorline)) + (local autocmds [[:FileType {:pattern [:qf :help :man :lspinfo :spectre_panel] @@ -38,21 +41,8 @@ (vim.keymap.set :t :<C-j> "<Cmd>wincmd j<CR>" {}) (vim.keymap.set :t :<C-k> "<Cmd>wincmd k<CR>" {}) (vim.keymap.set :t :<C-l> "<Cmd>wincmd l<CR>" {}))}] - [[:InsertLeave :WinEnter] - {:callback (fn [] - (let [(ok cl) (pcall vim.api.nvim_win_get_var 0 - :auto-cursorline)] - (if (and ok cl) - (do - (set vim.wo.cursorline true) - (vim.api.nvim_win_del_var 0 :auto-cursorline)))))}] - [[:InsertEnter :WinLeave] - {:callback (fn [] - (let [cl vim.wo.cursorline] - (if cl - (do - (vim.api.nvim_win_set_var 0 :auto-cursorline cl) - (set vim.wo.cursorline false)))))}]]) + [[:InsertLeave :WinEnter] {:callback cursorline.show}] + [[:InsertEnter :WinLeave] {:callback cursorline.hide}]]) (each [_ autocmd (ipairs autocmds)] (match autocmd |