Skip to content

Instantly share code, notes, and snippets.

View Chattille's full-sized avatar
😙

Chattille

😙
View GitHub Profile
@Chattille
Chattille / autoclose_neovim.lua
Last active April 28, 2026 13:14
Quit Neovim or current tab if there is only one non-autoclosable window.
---Buftypes ignored on quit
local autoclosables = { 'nofile', 'terminal' }
---Print out less verbose error messages.
---
---@param cmd string NeoVim command.
local function call(cmd)
---@diagnostic disable-next-line: param-type-mismatch
xpcall(vim.cmd, function(msg)
local err = string.gsub(msg, '^.+Vim%(%w+%):', '')
@Chattille
Chattille / auto_refresh_codelens.lua
Last active June 20, 2024 12:29
Refresh Codelens on LSP attachment in Neovim
-- trigger upon LSP attachment
vim.api.nvim_create_autocmd('User', {
pattern = 'LspAttached',
once = true,
callback = vim.lsp.codelens.refresh,
})
-- ... servers and enhanced_opts ...
for _, lsp in ipairs(servers) do