mirror of
https://github.com/kogakure/dotfiles.git
synced 2026-02-03 20:25:30 +00:00
feat(nvim): add comments and add new autocmds
This commit is contained in:
@@ -1,29 +1,14 @@
|
|||||||
-- Autocmds are automatically loaded on the VeryLazy event
|
-- Autocmds are automatically loaded on the VeryLazy event
|
||||||
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
||||||
-- Add any additional autocmds here
|
-- Add any additional autocmds here
|
||||||
|
|
||||||
|
-- Reload tmux config on save
|
||||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||||
pattern = { "*tmux.conf" },
|
pattern = { "*tmux.conf" },
|
||||||
command = "execute 'silent !tmux source <afile> --silent'",
|
command = "execute 'silent !tmux source <afile> --silent'",
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
-- Reload gitmux config on save
|
||||||
pattern = { ".yabairc" },
|
|
||||||
command = "!yabai --restart-service",
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
|
||||||
pattern = { ".skhdrc" },
|
|
||||||
command = "!skhd --restart-service",
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ "BufNewFile", "BufFilePre", "BufRead" }, {
|
|
||||||
pattern = { "*.mdx", "*.md" },
|
|
||||||
callback = function()
|
|
||||||
vim.cmd([[set filetype=markdown wrap linebreak nolist]])
|
|
||||||
vim.cmd([[SoftWrapMode]])
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ "BufRead" }, {
|
vim.api.nvim_create_autocmd({ "BufRead" }, {
|
||||||
pattern = { "gitmux.conf" },
|
pattern = { "gitmux.conf" },
|
||||||
callback = function()
|
callback = function()
|
||||||
@@ -31,6 +16,22 @@ vim.api.nvim_create_autocmd({ "BufRead" }, {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Restart yabai on config save
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||||
|
pattern = { ".yabairc" },
|
||||||
|
command = "!yabai --restart-service",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Add specific settings for Markdown files
|
||||||
|
vim.api.nvim_create_autocmd({ "BufNewFile", "BufFilePre", "BufRead" }, {
|
||||||
|
pattern = { "*.mdx", "*.md" },
|
||||||
|
callback = function()
|
||||||
|
vim.cmd([[set wrap linebreak nolist]])
|
||||||
|
vim.cmd([[SoftWrapMode]])
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Evenly resize windows after resizing
|
||||||
vim.api.nvim_create_autocmd({ "VimResized" }, {
|
vim.api.nvim_create_autocmd({ "VimResized" }, {
|
||||||
pattern = { "*" },
|
pattern = { "*" },
|
||||||
callback = function()
|
callback = function()
|
||||||
@@ -38,6 +39,13 @@ vim.api.nvim_create_autocmd({ "VimResized" }, {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Turn off paste mode when leaving insert mode
|
||||||
|
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||||
|
pattern = { "*" },
|
||||||
|
command = "set nopaste",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Turn off lualine in Git commit messages
|
||||||
vim.api.nvim_create_autocmd({ "User LspProgressStatusUpdated" }, {
|
vim.api.nvim_create_autocmd({ "User LspProgressStatusUpdated" }, {
|
||||||
callback = function()
|
callback = function()
|
||||||
local bufname = vim.api.nvim_buf_get_name(0)
|
local bufname = vim.api.nvim_buf_get_name(0)
|
||||||
@@ -47,9 +55,11 @@ vim.api.nvim_create_autocmd({ "User LspProgressStatusUpdated" }, {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, {
|
-- Change conceallevel for JSON files
|
||||||
pattern = { "*.rss" },
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = { "json", "jsonc" },
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.cmd([[set filetype=xml]])
|
vim.wo.spell = false
|
||||||
|
vim.wo.conceallevel = 0
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user