From 9207dfa01f716542e53c83a08c355d6a8208c3b6 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Fri, 19 Sep 2025 21:06:31 +0545 Subject: [PATCH] feat: add treesj plugin for structural editing and biome for typescriptreact formatting --- lazy-lock.json | 1 + lua/plugins/format.lua | 1 + lua/plugins/languages.lua | 253 ++++++++++++++++++++------------------ 3 files changed, 134 insertions(+), 121 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index ea2c318..dda27ee 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -42,6 +42,7 @@ "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "f64efd33a51ea89bdb847fb3aaf716e96b83ba1a" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, + "treesj": { "branch": "main", "commit": "4770492244ccecdc9b01e0e81fa8f2f6b4a23841" }, "uv.nvim": { "branch": "main", "commit": "be4a7d47a976249282bb2f71fc773ac2f5325973" }, "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, "vim-wakatime": { "branch": "master", "commit": "d7973b157a632d1edeff01818f18d67e584eeaff" }, diff --git a/lua/plugins/format.lua b/lua/plugins/format.lua index acdcf3c..6f68e79 100644 --- a/lua/plugins/format.lua +++ b/lua/plugins/format.lua @@ -30,6 +30,7 @@ return { ['python'] = { 'ruff_fix', 'ruff_format', 'ruff_organize_imports' }, ['javascript'] = { 'biome' }, ['typescript'] = { 'biome' }, + ['typescriptreact'] = { 'biome' }, ['markdown'] = { 'prettier', 'markdownlint-cli2', 'markdown-toc' }, ['markdown.mdx'] = { 'prettier', 'markdownlint-cli2', 'markdown-toc' }, ['mdx'] = { 'prettier' }, diff --git a/lua/plugins/languages.lua b/lua/plugins/languages.lua index e03ddce..062f93d 100644 --- a/lua/plugins/languages.lua +++ b/lua/plugins/languages.lua @@ -1,129 +1,140 @@ return { - -- treesitter - { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - event = { "BufReadPost", "BufNewFile" }, - config = function() - require("nvim-treesitter").setup({ - ensure_installed = { - "c", - "markdown", - "python", - "java", - "cpp", - "bash", - "lua", - "make", - "latex", - "json", - "jsonc", - "sql", - "yaml", - "toml", - "javascript", - "ts_ls", - "gitignore", - "go", - "rust", - "html", - "css", - "scss", - "markdown_inline", - }, - auto_install = true, - highlight = { - enable = true, - additional_vim_regex_highlighting = true, - }, - indent = { - enable = true, - }, - }) - end, - }, + -- treesitter + { + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + event = { 'BufReadPost', 'BufNewFile' }, + config = function() + require('nvim-treesitter').setup({ + ensure_installed = { + 'c', + 'markdown', + 'python', + 'java', + 'cpp', + 'bash', + 'lua', + 'make', + 'latex', + 'json', + 'jsonc', + 'sql', + 'yaml', + 'toml', + 'javascript', + 'ts_ls', + 'gitignore', + 'go', + 'rust', + 'html', + 'css', + 'scss', + 'markdown_inline', + }, + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = true, + }, + indent = { + enable = true, + }, + }) + end, + }, - -- rendering for html, latex, md - { - "OXY2DEV/markview.nvim", - lazy = false, - -- to load before treesitter - priority = 45, - config = function() - require("markview").setup({ - markdown = { - code_blocks = { sign = false }, - }, - }) - end, - }, + -- rendering for html, latex, md + { + 'OXY2DEV/markview.nvim', + lazy = false, + -- to load before treesitter + priority = 45, + config = function() + require('markview').setup({ + markdown = { + code_blocks = { sign = false }, + }, + }) + end, + }, - -- markdown preview - { - "iamcco/markdown-preview.nvim", - build = "cd app && yarn install", - init = function() - vim.g.mkdp_filetypes = { "markdown" } - end, - ft = "markdown", - cmd = { "MarkdownPreviewToggle", "MarkdownPreview" }, - }, + -- markdown preview + { + 'iamcco/markdown-preview.nvim', + build = 'cd app && yarn install', + init = function() + vim.g.mkdp_filetypes = { 'markdown' } + end, + ft = 'markdown', + cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview' }, + }, - { - "danymat/neogen", - dependencies = { "nvim-treesitter/nvim-treesitter" }, - opts = { - snippet_engine = "luasnip", - languages = { - python = { - template = { - annotation_convention = "google_docstrings", - }, - }, - }, - }, - }, + { + 'danymat/neogen', + dependencies = { 'nvim-treesitter/nvim-treesitter' }, + opts = { + snippet_engine = 'luasnip', + languages = { + python = { + template = { + annotation_convention = 'google_docstrings', + }, + }, + }, + }, + }, - -- auto pairs - { - "windwp/nvim-autopairs", - event = "InsertEnter", - config = function() - require("nvim-autopairs").setup() + -- auto pairs + { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + config = function() + require('nvim-autopairs').setup() - -- add new rules - local pairs = require("nvim-autopairs") - local rule = require("nvim-autopairs.rule") - local cond = require("nvim-autopairs.conds") - pairs.add_rules({ - rule("$", "$", { "tex", "latex", "plaintex" }) - -- do not move right when repeat character - :with_move(cond.none()), - }) - end, - }, + -- add new rules + local pairs = require('nvim-autopairs') + local rule = require('nvim-autopairs.rule') + local cond = require('nvim-autopairs.conds') + pairs.add_rules({ + rule('$', '$', { 'tex', 'latex', 'plaintex' }) + -- do not move right when repeat character + :with_move(cond.none()), + }) + end, + }, - { - "windwp/nvim-ts-autotag", - ft = { - "html", - "xml", - "javascript", - "typescript", - "javascriptreact", - "typescriptreact", - "jsx", - "tsx", - "vue", - "svelte", - "markdown", - }, - event = "InsertEnter", - lazy = true, - opts = { - enable_close = true, - enable_rename = true, - enable_close_on_slash = true, - }, - }, + { + 'windwp/nvim-ts-autotag', + ft = { + 'html', + 'xml', + 'javascript', + 'typescript', + 'javascriptreact', + 'typescriptreact', + 'jsx', + 'tsx', + 'vue', + 'svelte', + 'markdown', + }, + event = 'InsertEnter', + lazy = true, + config = function() + require('nvim-ts-autotag').setup({ + enable_close = true, + enable_rename = true, + enable_close_on_slash = true, + }) + end, + }, + + { + 'Wansmer/treesj', + keys = { 'm', 'j', 's' }, + dependencies = { 'nvim-treesitter/nvim-treesitter' }, -- if you install parsers with `nvim-treesitter` + config = function() + require('treesj').setup() + end, + }, }