diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-01-13 18:11:13 +0100 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-01-13 18:11:13 +0100 |
commit | d062c91af6261781f9c2e9c1e6366da18b2426b4 (patch) | |
tree | 9a3563ba2c041d564464933a68013a8df47b749b /fnl/settings | |
parent | afb31df1462a08d9f597088afdfdb8fb6849e6ca (diff) |
Add autocmd for showing cursor line only in active window
Diffstat (limited to 'fnl/settings')
-rw-r--r-- | fnl/settings/autocmds.fnl | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/fnl/settings/autocmds.fnl b/fnl/settings/autocmds.fnl index cd3a27e..27d6c2d 100644 --- a/fnl/settings/autocmds.fnl +++ b/fnl/settings/autocmds.fnl @@ -31,7 +31,22 @@ (vim.keymap.set :t :<C-h> "<Cmd>wincmd h<CR>" {}) (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>" {}))}]]) + (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)))))}]]) (each [_ autocmd (ipairs autocmds)] (match autocmd |