summaryrefslogtreecommitdiff
path: root/fnl/settings/autocmds.fnl
blob: 5a2a145a51d617ae9b141dc89397c3d39cca9b4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
;; Autocommands for nvim.

(local cursorline (require :util.cursorline))

(local auto-cmds
       [[:TextYankPost
         {:callback (lambda []
                      (vim.highlight.on_yank {:higroup :Visual :timeout 200}))}]
        [:BufWinEnter {:command "setlocal formatoptions-=cro"}]
        [:FileType {:pattern :qf :command "set nobuflisted"}]
        [:FileType {:pattern [:gitcommit :markdown] :command "setlocal wrap"}]
        [:VimResized {:command "tabdo wincmd ="}]
        [[:FocusGained :BufEnter :CursorHold :CursorHoldI]
         {:command :checktime}]
        [[:InsertLeave :WinEnter] {:callback cursorline.show}]
        [[:InsertEnter :WinLeave] {:callback cursorline.hide}]])

(let [cmds (require :util.cmds)]
  (cmds.create-auto-cmds auto-cmds))