Finally modularize neovim configuration
This commit is contained in:
parent
d4ca4668c4
commit
e2697f61fd
16 changed files with 872 additions and 1004 deletions
35
lua/config/autocmds.lua
Normal file
35
lua/config/autocmds.lua
Normal file
|
@ -0,0 +1,35 @@
|
|||
-- Autocmds configuration
|
||||
|
||||
-- Disable semantic tokens
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
end,
|
||||
})
|
||||
|
||||
-- Go back to last edited line when reopening file
|
||||
vim.api.nvim_create_autocmd("BufRead", {
|
||||
callback = function(opts)
|
||||
vim.api.nvim_create_autocmd("BufWinEnter", {
|
||||
once = true,
|
||||
buffer = opts.buf,
|
||||
callback = function()
|
||||
local ft = vim.bo[opts.buf].filetype
|
||||
local last_known_line = vim.api.nvim_buf_get_mark(opts.buf, '"')[1]
|
||||
if
|
||||
not (ft:match("gitcommit") and ft:match("gitrebase"))
|
||||
and last_known_line > 1
|
||||
and last_known_line <= vim.api.nvim_buf_line_count(opts.buf)
|
||||
then
|
||||
vim.api.nvim_feedkeys([[g`"]], "nx", false)
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Disable semantic highlights
|
||||
for _, group in ipairs(vim.fn.getcompletion("@lsp", "highlight")) do
|
||||
vim.api.nvim_set_hl(0, group, {})
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue