summaryrefslogtreecommitdiff
path: root/fnl/settings/autocmds.fnl
blob: 2dd0c71b3a7d01613e2a8916a2154ef88635a58d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
;; Autocommands for nvim.

(import-macros {: autocmds} :macros)

(autocmds [:FileType
           {:pattern [:qf :help :man :lspinfo]
            :command "nnoremap <silent> <buffer> q :close<CR>"}]
          [:TextYankPost
           {:callback (λ []
                        (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]
           {:pattern "*"
            :callback (fn []
                        (when (= (vim.fn.mode) :n)
                          (vim.cmd :checktime)))}]
          [[:InsertLeave :WinEnter]
           {:callback (λ []
                        (let [cursorline (require :settings.cursorline)]
                          cursorline.show))}]
          [[:InsertEnter :WinLeave]
           {:callback (λ []
                        (let [cursorline (require :settings.cursorline)]
                          cursorline.hide))}])