summaryrefslogtreecommitdiff
path: root/fnl/config/autocmd.fnl
blob: d66fb3ad5e22967926a507df17c87b3dc0247dea (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
29
30
31
32
;; Autocommands for nvim.
(module config.autocmd {autoload {nvim aniseed.nvim a aniseed.core : util}})

(defn- autocmd [event opts] (nvim.create_autocmd event opts))

(autocmd :BufEnter
         {:command "if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif"})

(autocmd :FileType
         {:pattern [:qf :help :man :lspinfo]
          :command "nnoremap <silent> <buffer> q :close<CR>"})

(autocmd :TextYankPost
         {:callback (lambda []
                      (vim.highlight.on_yank {:timeout 200}))})

(autocmd :BufWinEnter {:command "setlocal formatoptions-=cro"})

(autocmd :FileType {:pattern :qf :command "set nobuflisted"})

(autocmd :FileType
         {:pattern :lir
          :callback (fn []
                      (tset vim.opt_local :number false)
                      (tset vim.opt_local :relativenumber false))})

(autocmd :FileType {:pattern [:gitcommit :markdown] :command "setlocal wrap"})

(autocmd :FileType {:pattern [:gitcommit :markdown :org :plaintex]
                    :command "setlocal spell"})

(autocmd :VimResized {:command "tabdo wincmd ="})