aboutsummaryrefslogtreecommitdiffstats
path: root/nvim/lua/autocommands.lua
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2023-05-14 09:10:26 +0100
committerMatthew Lemon <y@yulqen.org>2023-05-14 09:10:26 +0100
commit0721b537a8aa3be8b70c183b25951494df9dcd0e (patch)
treeeff07bbc31aeefbb9d2e441bb5ca8b5a5a527ffb /nvim/lua/autocommands.lua
parent10a89dfbc6bc57ce12c8cf90f1b38a34b728b369 (diff)
Installs nvim config base-idea
Diffstat (limited to 'nvim/lua/autocommands.lua')
-rw-r--r--nvim/lua/autocommands.lua53
1 files changed, 53 insertions, 0 deletions
diff --git a/nvim/lua/autocommands.lua b/nvim/lua/autocommands.lua
new file mode 100644
index 0000000..ab612b0
--- /dev/null
+++ b/nvim/lua/autocommands.lua
@@ -0,0 +1,53 @@
+vim.api.nvim_create_autocmd({ "FileType" }, {
+ pattern = { "qf", "help", "man", "lspinfo", "spectre_panel" },
+ callback = function()
+ vim.cmd [[
+ nnoremap <silent> <buffer> q :close<CR>
+ set nobuflisted
+ ]]
+ end,
+})
+
+vim.api.nvim_create_autocmd({ "FileType" }, {
+ pattern = { "gitcommit", "markdown" },
+ callback = function()
+ vim.opt_local.wrap = true
+ vim.opt_local.spell = true
+ end,
+})
+-- Automatically close tab/vim when nvim-tree is the last window in the tab
+vim.cmd "autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif"
+
+vim.api.nvim_create_autocmd({ "VimResized" }, {
+ callback = function()
+ vim.cmd "tabdo wincmd ="
+ end,
+})
+
+vim.api.nvim_create_autocmd({ "TextYankPost" }, {
+ callback = function()
+ vim.highlight.on_yank { higroup = "Visual", timeout = 200 }
+ end,
+})
+
+vim.api.nvim_create_autocmd({ "BufWritePost" }, {
+ pattern = { "*.java" },
+ callback = function()
+ vim.lsp.codelens.refresh()
+ end,
+})
+
+vim.api.nvim_create_autocmd({ "VimEnter" }, {
+ callback = function()
+ vim.cmd "hi link illuminatedWord LspReferenceText"
+ end,
+})
+
+vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
+ callback = function()
+ local line_count = vim.api.nvim_buf_line_count(0)
+ if line_count >= 5000 then
+ vim.cmd "IlluminatePauseBuf"
+ end
+ end,
+})