diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-06-10 14:27:06 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-06-10 14:27:06 +0200 |
commit | 6021565a28e4925b77d4997a553dfad5fbb521fd (patch) | |
tree | 0469234318691534eba00f1f060b3fc57da9832f /fnl/util | |
parent | 791808634684981d0f2db55822fc4ad1c21896b7 (diff) |
Fix cursorline in neo-tree
Diffstat (limited to 'fnl/util')
-rw-r--r-- | fnl/util/cursorline.fnl | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/fnl/util/cursorline.fnl b/fnl/util/cursorline.fnl new file mode 100644 index 0000000..e094a4a --- /dev/null +++ b/fnl/util/cursorline.fnl @@ -0,0 +1,27 @@ +;; Functions for showing and hiding the cursorline. + +(local ignore-filetypes [:neo-tree]) + +(fn filetype [] + vim.bo.filetype) + +(fn ignore [] + (vim.tbl_contains ignore-filetypes (filetype))) + +(fn show [] + (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))))) + +(fn hide [] + (if (not= (ignore) true) + (do + (let [cl vim.wo.cursorline] + (if cl + (do + (vim.api.nvim_win_set_var 0 :auto-cursorline cl) + (set vim.wo.cursorline false))))))) + +{: show : hide} |