summaryrefslogtreecommitdiff
path: root/fnl/settings
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2023-06-10 14:27:06 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2023-06-10 14:27:06 +0200
commit6021565a28e4925b77d4997a553dfad5fbb521fd (patch)
tree0469234318691534eba00f1f060b3fc57da9832f /fnl/settings
parent791808634684981d0f2db55822fc4ad1c21896b7 (diff)
Fix cursorline in neo-tree
Diffstat (limited to 'fnl/settings')
-rw-r--r--fnl/settings/autocmds.fnl20
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