feat(nvim): add visual mode comment toggle and SQL commentstring
This commit is contained in:
@@ -1 +1 @@
|
||||
{"copilot.lua":"1.393.0"}
|
||||
{"copilot.lua":"1.417.0"}
|
||||
|
||||
@@ -2,16 +2,24 @@ return {
|
||||
"numToStr/Comment.nvim",
|
||||
keys = {
|
||||
{ "<leader>/", desc = "Toggle comment" },
|
||||
{ "<leader>/", mode = "v", desc = "Toggle comment" },
|
||||
},
|
||||
config = function ()
|
||||
config = function()
|
||||
require('Comment').setup({
|
||||
opleader = {
|
||||
-- Line-comment toggle keymap
|
||||
line = '<leader>/'
|
||||
},
|
||||
toggler = {
|
||||
line = "<leader>/"
|
||||
}
|
||||
})
|
||||
|
||||
-- Set commentstring for SQL
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "sql", "mysql", "plsql" },
|
||||
callback = function()
|
||||
vim.bo.commentstring = "-- %s"
|
||||
end,
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
@@ -1,26 +1,14 @@
|
||||
return {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
event = "VeryLazy",
|
||||
lazy = false,
|
||||
build = ':TSUpdate',
|
||||
config = function()
|
||||
-- Neovim's built-in treesitter handles highlighting automatically
|
||||
-- nvim-treesitter is now mainly a parser installer
|
||||
|
||||
-- Auto-install parsers when opening files
|
||||
-- New nvim-treesitter just installs parsers, Neovim handles highlighting
|
||||
-- Start treesitter highlighting for all buffers with a parser
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
callback = function(args)
|
||||
local ft = args.match
|
||||
local lang = vim.treesitter.language.get_lang(ft) or ft
|
||||
|
||||
-- Try to start treesitter highlighting
|
||||
local ok = pcall(vim.treesitter.start, args.buf, lang)
|
||||
if not ok then
|
||||
-- Parser not installed, try to install it
|
||||
pcall(function()
|
||||
vim.cmd('TSInstall ' .. lang)
|
||||
end)
|
||||
end
|
||||
end
|
||||
pcall(vim.treesitter.start, args.buf)
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user