Something went wrong. Try again.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071-- 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---- Add any additional autocmds here-- with `vim.api.nvim_create_autocmd`---- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults)-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell")
vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("lsp_attach_disable_ruff_hover", { clear = true }), callback = function(args) local client = vim.lsp.get_client_by_id(args.data.client_id) if client == nil then return end if client.name == "ruff" then -- Disable hover in favor of Pyright client.server_capabilities.hoverProvider = false end end, desc = "LSP: Disable hover capability from Ruff",})
vim.api.nvim_create_autocmd({ "BufWritePost" }, { pattern = { "*.py" }, callback = function() vim.lsp.buf.code_action({ context = { only = { "source.organizeImports" }, -- only = { "source.fixAll" }, diagnostics = {}, }, apply = true, }) end,})
-- format markdown tablevim.api.nvim_create_autocmd("FileType", { pattern = { "markdown" }, callback = function() vim.keymap.set( "v", "<leader>t", "!pandoc --write=markdown-simple_tables-grid_tables-multiline_tables+pipe_tables --columns 1000<CR>", { silent = true, desc = "Align selected md table using pandoc" } ) end,})
-- format on save : https://www.mitchellhanberg.com/modern-format-on-save-in-neovim/-- vim.api.nvim_create_autocmd("LspAttach", {-- group = vim.api.nvim_create_augroup("lsp", { clear = true }),-- callback = function(args)-- vim.api.nvim_create_autocmd("BufWritePre", {-- buffer = args.buf,-- callback = function()-- vim.lsp.buf.format {async = false, id = args.data.client_id }-- end,-- })-- end-- })
vim.api.nvim_create_autocmd("BufWritePre", { pattern = "*", callback = function(args) require("conform").format({ bufnr = args.buf }) end,})