From 4e0f21a398bfeb7db215e9fa423b983c4f3506c1 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 13 Mar 2026 15:09:55 +0100 Subject: [PATCH] feat(nvim): add visual mode comment toggle and SQL commentstring --- github-copilot/versions.json | 2 +- nvim/lua/olinpin/plugins/comment.lua | 12 ++++++++++-- nvim/lua/olinpin/plugins/treesitter.lua | 24 ++++++------------------ 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/github-copilot/versions.json b/github-copilot/versions.json index 04c6bc4..1958b87 100644 --- a/github-copilot/versions.json +++ b/github-copilot/versions.json @@ -1 +1 @@ -{"copilot.lua":"1.393.0"} +{"copilot.lua":"1.417.0"} diff --git a/nvim/lua/olinpin/plugins/comment.lua b/nvim/lua/olinpin/plugins/comment.lua index 32fc014..0de5b74 100644 --- a/nvim/lua/olinpin/plugins/comment.lua +++ b/nvim/lua/olinpin/plugins/comment.lua @@ -2,16 +2,24 @@ return { "numToStr/Comment.nvim", keys = { { "/", desc = "Toggle comment" }, + { "/", mode = "v", desc = "Toggle comment" }, }, - config = function () + config = function() require('Comment').setup({ opleader = { - -- Line-comment toggle keymap line = '/' }, toggler = { line = "/" } }) + + -- Set commentstring for SQL + vim.api.nvim_create_autocmd("FileType", { + pattern = { "sql", "mysql", "plsql" }, + callback = function() + vim.bo.commentstring = "-- %s" + end, + }) end } diff --git a/nvim/lua/olinpin/plugins/treesitter.lua b/nvim/lua/olinpin/plugins/treesitter.lua index f197c62..22bcd66 100644 --- a/nvim/lua/olinpin/plugins/treesitter.lua +++ b/nvim/lua/olinpin/plugins/treesitter.lua @@ -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, }