summaryrefslogtreecommitdiff
path: root/fnl/settings/autocmds.fnl
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2023-09-23 22:05:37 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2023-09-23 22:05:37 +0200
commitd474c779523c512e3bc91bc5ce7bc87cafc6372b (patch)
tree3c50cc5bf8fb55167150c76171f54590babf7118 /fnl/settings/autocmds.fnl
parent6dcd88cde5825573a3732e8b18f7d663ca47495b (diff)
Move user and auto cmds to plugins
Diffstat (limited to 'fnl/settings/autocmds.fnl')
-rw-r--r--fnl/settings/autocmds.fnl38
1 files changed, 4 insertions, 34 deletions
diff --git a/fnl/settings/autocmds.fnl b/fnl/settings/autocmds.fnl
index a646130..5a2a145 100644
--- a/fnl/settings/autocmds.fnl
+++ b/fnl/settings/autocmds.fnl
@@ -2,48 +2,18 @@
(local cursorline (require :util.cursorline))
-(local autocmds
- [[:FileType
- {:pattern [:qf :help :man :lspinfo :spectre_panel]
- :command "nnoremap <silent> <buffer> q :close<CR>"}]
- [:TextYankPost
+(local auto-cmds
+ [[:TextYankPost
{:callback (lambda []
(vim.highlight.on_yank {:higroup :Visual :timeout 200}))}]
- [:FileType
- {:pattern :lir
- :callback (fn []
- (tset vim.opt_local :number false)
- (tset vim.opt_local :relativenumber false))}]
[:BufWinEnter {:command "setlocal formatoptions-=cro"}]
- [:FileType
- {:pattern :org
- :callback (fn []
- (tset vim.opt_local :conceallevel 2)
- (tset vim.opt_local :concealcursor :nc))}]
[:FileType {:pattern :qf :command "set nobuflisted"}]
[:FileType {:pattern [:gitcommit :markdown] :command "setlocal wrap"}]
- [:FileType
- {:pattern [:NeogitStatus
- :NeogitCommitMessage
- :NeogitNotification
- :NeogitCommitView
- :spectre_panel]
- :command "setlocal spell!"}]
- [:TermOpen
- {:pattern ["term://*toggleterm#*"] :command "setlocal spell!"}]
[:VimResized {:command "tabdo wincmd ="}]
[[:FocusGained :BufEnter :CursorHold :CursorHoldI]
{:command :checktime}]
- [:TermOpen
- {:pattern "term://*toggleterm#*"
- :callback (fn []
- (vim.keymap.set :t :<C-h> "<Cmd>wincmd h<CR>" {})
- (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 cursorline.show}]
[[:InsertEnter :WinLeave] {:callback cursorline.hide}]])
-(each [_ autocmd (ipairs autocmds)]
- (match autocmd
- [event opts] (vim.api.nvim_create_autocmd event opts)))
+(let [cmds (require :util.cmds)]
+ (cmds.create-auto-cmds auto-cmds))