diff options
author | Brahmajit Das <listout@listout.xyz> | 2025-06-04 03:14:27 +0530 |
---|---|---|
committer | Brahmajit Das <listout@listout.xyz> | 2025-06-04 03:14:27 +0530 |
commit | 540951d77e84e9f5990cfa54838cc7be757e7a05 (patch) | |
tree | d320f1681e1b459756ba096d213bc628e1705bce | |
parent | 933f935e3efddd27c663739461acb257cc83a046 (diff) |
moving autocmds and ading LspAttach from lsp config to autocmds
Signed-off-by: Brahmajit Das <listout@listout.xyz>
-rw-r--r-- | lua/autocmds.lua | 67 | ||||
-rw-r--r-- | lua/config/autocmds.lua | 0 |
2 files changed, 0 insertions, 67 deletions
diff --git a/lua/autocmds.lua b/lua/autocmds.lua deleted file mode 100644 index de6b82a..0000000 --- a/lua/autocmds.lua +++ /dev/null @@ -1,67 +0,0 @@ -local function augroup(name) - return vim.api.nvim_create_augroup(name, { clear = true }) -end - --- Highlight on yank -vim.api.nvim_create_autocmd("TextYankPost", { - group = augroup("highlight_yank"), - callback = function() - vim.highlight.on_yank() - end, -}) - --- close some filetypes with <q> -vim.api.nvim_create_autocmd("FileType", { - group = augroup("close_with_q"), - pattern = { - "diff", - "git", - "fugitive", - "PlenaryTestPopup", - "help", - "lspinfo", - "man", - "notify", - "qf", - "query", - "spectre_panel", - "startuptime", - "tsplayground", - "neotest-output", - "checkhealth", - "neotest-summary", - "neotest-output-panel", - }, - callback = function(event) - vim.bo[event.buf].buflisted = false - vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true }) - end, -}) - --- go to last loc when opening a buffer -vim.api.nvim_create_autocmd("BufReadPost", { - group = augroup("last_loc"), - callback = function(event) - local exclude = { "gitcommit" } - local buf = event.buf - if vim.tbl_contains(exclude, vim.bo[buf].filetype) or vim.b[buf].lazyvim_last_loc then - return - end - vim.b[buf].lazyvim_last_loc = true - local mark = vim.api.nvim_buf_get_mark(buf, '"') - local lcount = vim.api.nvim_buf_line_count(buf) - if mark[1] > 0 and mark[1] <= lcount then - pcall(vim.api.nvim_win_set_cursor, 0, mark) - end - end, -}) - -vim.api.nvim_create_autocmd({ "ColorScheme", "BufReadPost" }, { - pattern = { "*patch.diff" }, - callback = function() - vim.api.nvim_set_hl(0, "PRDiffAdd", { fg = "#232634", bg = "#a6da95" }) - vim.api.nvim_set_hl(0, "PRDiffDel", { fg = "#d7e3d8", bg = "#e82424" }) - vim.cmd.syntax([[match PRDiffAdd /\v^[\+]((\-\-)|(\@\@ )|(\+\+)|(index )|(diff ))@!.*/]]) - vim.cmd.syntax([[match PRDiffDel /\v^[\-]((\-\-)|(\@\@ )|(\+\+)|(index )|(diff ))@!.*/]]) - end, -}) diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lua/config/autocmds.lua |