Files
consultant-windows/AppData/Local/nvim/lua/config/autocmd.lua
2025-12-05 09:54:42 +01:00

36 lines
1.1 KiB
Lua

-- vim: ts=2 sts=2 sw=2 et
-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
-- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode
-- See `:help vim.highlight.on_yank()`
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
-- NOTE: Disabeling the built in cmp in favor of blink
-- vim.api.nvim_create_autocmd('LspAttach', {
-- callback = function(ev)
-- local client = vim.lsp.get_client_by_id(ev.data.client_id)
-- if client ~= nil and client:supports_method 'textDocument/completion' then
-- vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true })
-- end
-- end,
-- })
-- Autoindent json by 2 spaces
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'json', 'xml' },
callback = function()
vim.bo.shiftwidth = 2
vim.bo.tabstop = 2
vim.bo.softtabstop = 2
vim.bo.expandtab = true
end,
})