summaryrefslogtreecommitdiff
path: root/fnl/config
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-04-05 22:50:55 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-04-05 22:50:55 +0200
commitd0dff620968d0666220be415ec33e80dde2d43c9 (patch)
tree583410bc52f2bce88b5351369c619f5cac289f9b /fnl/config
parent1e9036800d30a416f1271e5422a318942abed958 (diff)
feat(autocmd): add fnl config
Diffstat (limited to 'fnl/config')
-rw-r--r--fnl/config/autocmd.fnl65
1 files changed, 65 insertions, 0 deletions
diff --git a/fnl/config/autocmd.fnl b/fnl/config/autocmd.fnl
new file mode 100644
index 0000000..b6a3fe4
--- /dev/null
+++ b/fnl/config/autocmd.fnl
@@ -0,0 +1,65 @@
+;; A customizable greeter.
+(module config.autocmd
+ {autoload {util util
+ nvim aniseed.nvim
+ a aniseed.core}})
+
+(def- group (nvim.create_autogroup :K {:clear true}))
+
+(defn- autocmd [name opts]
+ (nvim.create_autocmd name (a.merge! {:group group} opts))
+
+(autocmd :FileType
+ {:pattern [ :qf :help :man :lspinfo ]
+ :command "nnoremap <silent> <buffer> q :close<CR>"
+ :group :_general_settings})
+
+(autocmd :TextYankPost
+ {:pattern [ :* ]
+ :command "silent!lua require('vim.highlight').on_yank({higroup = 'Search', timeout = 200}"
+ :group :_general_settings})
+
+(autocmd :BufWinEnter
+ {:pattern [ :* ]
+ :command ":set formatoptions-=cro"
+ :group :_general_settings})
+
+(autocmd :FileType
+ {:pattern [ :qf ]
+ :command "set nobuflisted"
+ :group :_general_settings})
+
+(autocmd :FileType
+ {:pattern [ :gitcommit ]
+ :command "setlocal wrap"
+ :group :_git})
+
+(autocmd :FileType
+ {:pattern [ :gitcommit ]
+ :command "setlocal spell"
+ :group :_git})
+
+(autocmd :FileType
+ {:pattern [ :markdown ]
+ :command "setlocal wrap"
+ :group :_markdown})
+
+(autocmd :FileType
+ {:pattern [ :markdown ]
+ :command "setlocal spell"
+ :group :_markdown})
+
+(autocmd :VimResized
+ {:pattern [ :* ]
+ :command "tabdo wincmd ="
+ :group :_auto_resize})
+
+(autocmd :User
+ {:pattern [ :AlphaReady ]
+ :command "set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2"
+ :group :_alpha})
+
+(autocmd :BufWritePost
+ {:pattern [ :plugins.fnl ]
+ :command "source <afile> | PackerSync"
+ :group :packer_user_config})