From 6dcec70791ac2f6074eaded8a29938752cefd437 Mon Sep 17 00:00:00 2001 From: Krzysiek Wyka Date: Sun, 16 Jun 2024 17:36:50 +0200 Subject: [PATCH 01/10] Apply custom settings --- init.lua | 126 +++++------------------------- lua/custom/plugins/in-and-out.lua | 10 +++ lua/custom/plugins/jester.lua | 86 ++++++++++++++++++++ lua/kickstart/plugins/debug.lua | 67 ++++++++++++++-- lua/kickstart/plugins/lint.lua | 29 ++++++- 5 files changed, 205 insertions(+), 113 deletions(-) create mode 100644 lua/custom/plugins/in-and-out.lua create mode 100644 lua/custom/plugins/jester.lua diff --git a/init.lua b/init.lua index b98ffc6198a..35e18e5c95a 100644 --- a/init.lua +++ b/init.lua @@ -1,89 +1,3 @@ ---[[ - -===================================================================== -==================== READ THIS BEFORE CONTINUING ==================== -===================================================================== -======== .-----. ======== -======== .----------------------. | === | ======== -======== |.-""""""""""""""""""-.| |-----| ======== -======== || || | === | ======== -======== || KICKSTART.NVIM || |-----| ======== -======== || || | === | ======== -======== || || |-----| ======== -======== ||:Tutor || |:::::| ======== -======== |'-..................-'| |____o| ======== -======== `"")----------------(""` ___________ ======== -======== /::::::::::| |::::::::::\ \ no mouse \ ======== -======== /:::========| |==hjkl==:::\ \ required \ ======== -======== '""""""""""""' '""""""""""""' '""""""""""' ======== -======== ======== -===================================================================== -===================================================================== - -What is Kickstart? - - Kickstart.nvim is *not* a distribution. - - Kickstart.nvim is a starting point for your own configuration. - The goal is that you can read every line of code, top-to-bottom, understand - what your configuration is doing, and modify it to suit your needs. - - Once you've done that, you can start exploring, configuring and tinkering to - make Neovim your own! That might mean leaving Kickstart just the way it is for a while - or immediately breaking it into modular pieces. It's up to you! - - If you don't know anything about Lua, I recommend taking some time to read through - a guide. One possible example which will only take 10-15 minutes: - - https://learnxinyminutes.com/docs/lua/ - - After understanding a bit more about Lua, you can use `:help lua-guide` as a - reference for how Neovim integrates Lua. - - :help lua-guide - - (or HTML version): https://neovim.io/doc/user/lua-guide.html - -Kickstart Guide: - - TODO: The very first thing you should do is to run the command `:Tutor` in Neovim. - - If you don't know what this means, type the following: - - - - : - - Tutor - - - - (If you already know the Neovim basics, you can skip this step.) - - Once you've completed that, you can continue working through **AND READING** the rest - of the kickstart init.lua. - - Next, run AND READ `:help`. - This will open up a help window with some basic information - about reading, navigating and searching the builtin help documentation. - - This should be the first place you go to look when you're stuck or confused - with something. It's one of my favorite Neovim features. - - MOST IMPORTANTLY, we provide a keymap "sh" to [s]earch the [h]elp documentation, - which is very useful when you're not exactly sure of what you're looking for. - - I have left several `:help X` comments throughout the init.lua - These are hints about where to find more information about the relevant settings, - plugins or Neovim features used in Kickstart. - - NOTE: Look for lines like this - - Throughout the file. These are for you, the reader, to help you understand what is happening. - Feel free to delete them once you know what you're doing, but they should serve as a guide - for when you are first encountering a few different constructs in your Neovim config. - -If you experience any errors while trying to install kickstart, run `:checkhealth` for more info. - -I hope you enjoy your Neovim journey, -- TJ - -P.S. You can delete this when you're done too. It's your config now! :) ---]] - -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) @@ -91,7 +5,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.o` @@ -102,7 +16,7 @@ vim.g.have_nerd_font = false vim.o.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.o.relativenumber = true +vim.o.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.o.mouse = 'a' @@ -681,7 +595,7 @@ require('lazy').setup({ -- https://github.com/pmizio/typescript-tools.nvim -- -- But for many setups, the LSP (`ts_ls`) will work just fine - -- ts_ls = {}, + ts_ls = {}, -- lua_ls = { @@ -773,6 +687,8 @@ require('lazy').setup({ -- -- You can use 'stop_after_first' to run the first available formatter from the list -- javascript = { "prettierd", "prettier", stop_after_first = true }, + javascript = { { 'prettier' } }, + typescript = { { 'prettier' } }, }, }, }, @@ -881,20 +797,20 @@ require('lazy').setup({ -- change the command in the config to whatever the name of that colorscheme is. -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', + -- 'folke/tokyonight.nvim', + 'navarasu/onedark.nvim', priority = 1000, -- Make sure to load this before all the other start plugins. - config = function() - ---@diagnostic disable-next-line: missing-fields - require('tokyonight').setup { - styles = { - comments = { italic = false }, -- Disable italics in comments - }, - } - + init = function() -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' + -- vim.cmd.colorscheme 'tokyonight-night' + vim.cmd.colorscheme 'onedark' + end, + config = function() + require('onedark').setup { + style = 'darker', + } end, }, @@ -944,7 +860,7 @@ require('lazy').setup({ main = 'nvim-treesitter.configs', -- Sets main module to use for opts -- [[ Configure Treesitter ]] See `:help nvim-treesitter` opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, + ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'typescript', 'javascript' }, -- Autoinstall languages that are not installed auto_install = true, highlight = { @@ -973,18 +889,18 @@ require('lazy').setup({ -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- - -- require 'kickstart.plugins.debug', + require 'kickstart.plugins.debug', -- require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', + require 'kickstart.plugins.lint', -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'kickstart.plugins.neo-tree', + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! diff --git a/lua/custom/plugins/in-and-out.lua b/lua/custom/plugins/in-and-out.lua new file mode 100644 index 00000000000..ab275c8d3a3 --- /dev/null +++ b/lua/custom/plugins/in-and-out.lua @@ -0,0 +1,10 @@ +return { + { + 'ysmb-wtsg/in-and-out.nvim', + config = function() + vim.keymap.set('i', '', function() + require('in-and-out').in_and_out() + end) + end, + }, +} diff --git a/lua/custom/plugins/jester.lua b/lua/custom/plugins/jester.lua new file mode 100644 index 00000000000..1988acce29a --- /dev/null +++ b/lua/custom/plugins/jester.lua @@ -0,0 +1,86 @@ +return { + { + 'David-Kunz/jester', + config = function() + local jester = require 'jester' + require('which-key').register({ + j = { + name = '[J]ester', + s = { + function() + jester.run() + end, + '[S]ingle test', + }, + f = { + function() + jester.run_file() + end, + '[F]ile test', + }, + -- s = { + -- name = '[S]ingle test', + -- r = { + -- function() + -- jester.run() + -- end, + -- '[R]un', + -- }, + -- d = { + -- function() + -- jester.debug() + -- end, + -- '[D]ebug', + -- }, + -- ['1'] = 'which_key_ignore', + -- }, + -- f = { + -- name = '[F]ile test', + -- r = { + -- function() + -- jester.run_file() + -- end, + -- '[R]un', + -- }, + -- d = { + -- function() + -- jester.debug_file() + -- end, + -- '[D]ebug', + -- }, + -- ['1'] = 'which_key_ignore', + -- }, + ['1'] = 'which_key_ignore', + }, + }, { prefix = '' }) + + jester.setup { + cmd = "npm t -- -t '$result' $file", -- run command + identifiers = { 'test', 'it' }, -- used to identify tests + prepend = { 'describe' }, -- prepend describe blocks + expressions = { 'call_expression' }, -- tree-sitter object used to scan for tests/describe blocks + path_to_jest_run = 'jest', -- used to run tests + path_to_jest_debug = './node_modules/.bin/jest', -- used for debugging + terminal_cmd = ':vsplit | terminal', -- used to spawn a terminal for running tests, for debugging refer to nvim-dap's config + dap = { -- debug adapter configuration + type = 'node2', + request = 'launch', + cwd = vim.fn.getcwd(), + runtimeArgs = { '--inspect-brk', '$path_to_jest', '--no-coverage', '-t', '$result', '--', '$file' }, + args = { '--no-cache' }, + sourceMaps = false, + protocol = 'inspector', + skipFiles = { '/**/*.js' }, + console = 'integratedTerminal', + port = 9229, + disableOptimisticBPs = true, + }, + } + + vim.keymap.set('n', 'js', jester.run, { desc = 'Single test Run' }) + -- vim.keymap.set('n', 'jsd', jester.debug, { desc = 'Single test debug' }) + vim.keymap.set('n', 'jf', jester.run, { desc = 'File test Run' }) + -- vim.keymap.set('n', 'jfd', jester.debug, { desc = 'File test debug' }) + end, + }, +} diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 8e332bf2ff9..04214000dd6 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -23,6 +23,10 @@ return { -- Add your own debuggers here 'leoluz/nvim-dap-go', + 'mxsdev/nvim-dap-vscode-js', + + -- Virtual text + 'theHamsta/nvim-dap-virtual-text', }, keys = { -- Basic debugging keymaps, feel free to change to your liking! @@ -98,6 +102,19 @@ return { }, } + -- Basic debugging keymaps, feel free to change to your liking! + vim.keymap.set('n', '', dap.continue, { desc = 'Debug: Start/Continue' }) + vim.keymap.set('n', '', dap.step_into, { desc = 'Debug: Step Into' }) + vim.keymap.set('n', '', dap.step_over, { desc = 'Debug: Step Over' }) + vim.keymap.set('n', '', dap.step_out, { desc = 'Debug: Step Out' }) + vim.keymap.set('n', 'b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' }) + vim.keymap.set('n', 'B', function() + dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') + end, { desc = 'Debug: Set Breakpoint' }) + + -- Dap virtual text setup + require('nvim-dap-virtual-text').setup() + -- Dap UI setup -- For more information, see |:help nvim-dap-ui| dapui.setup { @@ -136,13 +153,49 @@ return { dap.listeners.before.event_terminated['dapui_config'] = dapui.close dap.listeners.before.event_exited['dapui_config'] = dapui.close - -- Install golang specific config - require('dap-go').setup { - delve = { - -- On Windows delve must be run attached or it crashes. - -- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring - detached = vim.fn.has 'win32' == 0, - }, + require('dap-vscode-js').setup { + -- node_path = "node", -- Path of node executable. Defaults to $NODE_PATH, and then "node" + debugger_path = vim.fn.stdpath 'data' .. '/lazy/vscode-js-debug', + -- debugger_cmd = { "extension" }, -- Command to use to launch the debug server. Takes precedence over `node_path` and `debugger_path`. + adapters = { 'pwa-node', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost', 'node' }, -- which adapters to register in nvim-dap + -- log_file_path = "(stdpath cache)/dap_vscode_js.log" -- Path for file logging + -- log_file_level = false -- Logging level for output to file. Set to false to disable file logging. + -- log_console_level = vim.log.levels.ERROR -- Logging level for output to console. Set to false to disable console output. } + + local js_based_languages = { 'typescript', 'javascript' } + + for _, language in ipairs(js_based_languages) do + require('dap').configurations[language] = { + { + type = 'pwa-node', + request = 'launch', + name = 'Launch file', + program = '${file}', + cwd = '${workspaceFolder}', + }, + { + type = 'pwa-node', + request = 'attach', + name = 'Attach', + processId = require('dap.utils').pick_process, + cwd = '${workspaceFolder}', + }, + { + type = 'pwa-node', + request = 'launch', + name = 'Debug Jest Tests', + env = { NODE_OPTIONS = '--experimental-vm-modules', ENV = 'test' }, + runtimeExecutable = 'node', + runtimeArgs = { + './node_modules/jest/bin/jest.js', + }, + rootPath = '${workspaceFolder}', + cwd = '${workspaceFolder}', + console = 'integratedTerminal', + internalConsoleOptions = 'neverOpen', + }, + } + end end, } diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index dec42f097c6..cf501e904c8 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -3,13 +3,40 @@ return { { -- Linting 'mfussenegger/nvim-lint', event = { 'BufReadPre', 'BufNewFile' }, + -- init = function() + -- require('lint').linters.eslint.args = { '--fix' } + -- end, + -- init = function() + -- require('lint').linters.eslint.args = { + -- '--fix', + -- '--format', + -- 'json', + -- '--stdin', + -- '--stdin-filename', + -- function() + -- return vim.api.nvim_buf_get_name(0) + -- end, + -- } + -- end, config = function() local lint = require 'lint' lint.linters_by_ft = { markdown = { 'markdownlint' }, + typescript = { 'eslint' }, + javascript = { 'eslint' }, } - -- To allow other plugins to add linters to require('lint').linters_by_ft, + -- lint.linters.eslint.args = { + -- '--fix', + -- '--format', + -- 'json', + -- '--stdin', + -- '--stdin-filename', + -- function() + -- return vim.api.nvim_buf_get_name(0) + -- end, + -- } + -- -- To allow other plugins to add linters to require('lint').linters_by_ft, -- instead set linters_by_ft like this: -- lint.linters_by_ft = lint.linters_by_ft or {} -- lint.linters_by_ft['markdown'] = { 'markdownlint' } From 6fcff3157781b9b8043303b8613f28265a600742 Mon Sep 17 00:00:00 2001 From: Krzysiek Wyka Date: Wed, 28 Aug 2024 20:23:53 +0200 Subject: [PATCH 02/10] Update --- init.lua | 7 ++++ lua/custom/plugins/autoclose.lua | 8 ++++ lua/custom/plugins/barbecue.lua | 12 ++++++ lua/custom/plugins/harpoon.lua | 58 +++++++++++++++++++++++++ lua/custom/plugins/in-and-out.lua | 10 ----- lua/custom/plugins/jester.lua | 70 +++++++------------------------ lua/custom/plugins/neoclip.lua | 13 ++++++ lua/custom/plugins/neogit.lua | 17 ++++++++ lua/custom/plugins/noice.lua | 15 +++++++ lua/custom/plugins/workspace.lua | 16 +++++++ lua/kickstart/plugins/debug.lua | 64 ++++++++++++---------------- 11 files changed, 189 insertions(+), 101 deletions(-) create mode 100644 lua/custom/plugins/autoclose.lua create mode 100644 lua/custom/plugins/barbecue.lua create mode 100644 lua/custom/plugins/harpoon.lua delete mode 100644 lua/custom/plugins/in-and-out.lua create mode 100644 lua/custom/plugins/neoclip.lua create mode 100644 lua/custom/plugins/neogit.lua create mode 100644 lua/custom/plugins/noice.lua create mode 100644 lua/custom/plugins/workspace.lua diff --git a/init.lua b/init.lua index 35e18e5c95a..cb088acd0ed 100644 --- a/init.lua +++ b/init.lua @@ -85,6 +85,9 @@ vim.o.confirm = true -- Clear highlights on search when pressing in normal mode -- See `:help hlsearch` +-- Spell checking +vim.opt.spell = true + vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic keymaps @@ -121,6 +124,8 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the upper win -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` +-- Save on upper W +vim.api.nvim_create_user_command('W', 'w', {}) -- Highlight when yanking (copying) text -- Try it with `yap` in normal mode @@ -214,6 +219,7 @@ require('lazy').setup({ { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', + version = '2.1.0', event = 'VimEnter', -- Sets the loading event to 'VimEnter' opts = { -- delay between pressing a key and opening which-key (milliseconds) @@ -687,6 +693,7 @@ require('lazy').setup({ -- -- You can use 'stop_after_first' to run the first available formatter from the list -- javascript = { "prettierd", "prettier", stop_after_first = true }, + json = { { 'prettier' } }, javascript = { { 'prettier' } }, typescript = { { 'prettier' } }, }, diff --git a/lua/custom/plugins/autoclose.lua b/lua/custom/plugins/autoclose.lua new file mode 100644 index 00000000000..e7ce3b4e465 --- /dev/null +++ b/lua/custom/plugins/autoclose.lua @@ -0,0 +1,8 @@ +return { + { + 'm4xshen/autoclose.nvim', + config = function() + require('autoclose').setup() + end, + }, +} diff --git a/lua/custom/plugins/barbecue.lua b/lua/custom/plugins/barbecue.lua new file mode 100644 index 00000000000..49a3f9b2d3d --- /dev/null +++ b/lua/custom/plugins/barbecue.lua @@ -0,0 +1,12 @@ +return { + { + 'utilyre/barbecue.nvim', + name = 'barbecue', + version = '*', + dependencies = { + 'SmiteshP/nvim-navic', + 'nvim-tree/nvim-web-devicons', + }, + opts = {}, + }, +} diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua new file mode 100644 index 00000000000..8ecb2cecf4f --- /dev/null +++ b/lua/custom/plugins/harpoon.lua @@ -0,0 +1,58 @@ +return { + { + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + local harpoon = require 'harpoon' + harpoon:setup {} + + vim.keymap.set('n', 'a', function() + harpoon:list():add() + end, { desc = 'Harpoon add' }) + + local function toggle_telescope(harpoon_files) + local finder = function() + local paths = {} + for _, item in ipairs(harpoon_files.items) do + table.insert(paths, item.value) + end + + return require('telescope.finders').new_table { + results = paths, + } + end + + require('telescope.pickers') + .new({}, { + prompt_title = 'Harpoon', + finder = finder(), + previewer = false, + sorter = require('telescope.config').values.generic_sorter {}, + layout_config = { + height = 0.4, + width = 0.5, + prompt_position = 'top', + preview_cutoff = 120, + }, + attach_mappings = function(prompt_bufnr, map) + map('i', '', function() + local state = require 'telescope.actions.state' + local selected_entry = state.get_selected_entry() + local current_picker = state.get_current_picker(prompt_bufnr) + + table.remove(harpoon_files.items, selected_entry.index) + current_picker:refresh(finder()) + end) + return true + end, + }) + :find() + end + + vim.keymap.set('n', 'sm', function() + toggle_telescope(harpoon:list()) + end, { desc = 'Harpon list' }) + end, + }, +} diff --git a/lua/custom/plugins/in-and-out.lua b/lua/custom/plugins/in-and-out.lua deleted file mode 100644 index ab275c8d3a3..00000000000 --- a/lua/custom/plugins/in-and-out.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - { - 'ysmb-wtsg/in-and-out.nvim', - config = function() - vim.keymap.set('i', '', function() - require('in-and-out').in_and_out() - end) - end, - }, -} diff --git a/lua/custom/plugins/jester.lua b/lua/custom/plugins/jester.lua index 1988acce29a..adc8ed3c3b1 100644 --- a/lua/custom/plugins/jester.lua +++ b/lua/custom/plugins/jester.lua @@ -7,66 +7,28 @@ return { j = { name = '[J]ester', s = { - function() - jester.run() - end, - '[S]ingle test', + name = '[S]ingle test', }, f = { - function() - jester.run_file() - end, - '[F]ile test', + name = '[F]ile test', }, - -- s = { - -- name = '[S]ingle test', - -- r = { - -- function() - -- jester.run() - -- end, - -- '[R]un', - -- }, - -- d = { - -- function() - -- jester.debug() - -- end, - -- '[D]ebug', - -- }, - -- ['1'] = 'which_key_ignore', - -- }, - -- f = { - -- name = '[F]ile test', - -- r = { - -- function() - -- jester.run_file() - -- end, - -- '[R]un', - -- }, - -- d = { - -- function() - -- jester.debug_file() - -- end, - -- '[D]ebug', - -- }, - -- ['1'] = 'which_key_ignore', - -- }, ['1'] = 'which_key_ignore', }, }, { prefix = '' }) jester.setup { - cmd = "npm t -- -t '$result' $file", -- run command - identifiers = { 'test', 'it' }, -- used to identify tests - prepend = { 'describe' }, -- prepend describe blocks - expressions = { 'call_expression' }, -- tree-sitter object used to scan for tests/describe blocks - path_to_jest_run = 'jest', -- used to run tests - path_to_jest_debug = './node_modules/.bin/jest', -- used for debugging - terminal_cmd = ':vsplit | terminal', -- used to spawn a terminal for running tests, for debugging refer to nvim-dap's config - dap = { -- debug adapter configuration - type = 'node2', + cmd = "npm t -- -t '$result' $file", + identifiers = { 'test', 'it' }, + prepend = { 'describe' }, + expressions = { 'call_expression' }, + path_to_jest_run = 'jest', + path_to_jest_debug = './node_modules/.bin/jest', + terminal_cmd = ':vsplit | terminal', + dap = { + type = 'pwa-node', request = 'launch', cwd = vim.fn.getcwd(), - runtimeArgs = { '--inspect-brk', '$path_to_jest', '--no-coverage', '-t', '$result', '--', '$file' }, + runtimeArgs = { '--inspect-brk', '~/n/bin/npm', 't', '--', '--no-coverage', '-t', '$result', '--', '$file' }, args = { '--no-cache' }, sourceMaps = false, protocol = 'inspector', @@ -77,10 +39,10 @@ return { }, } - vim.keymap.set('n', 'js', jester.run, { desc = 'Single test Run' }) - -- vim.keymap.set('n', 'jsd', jester.debug, { desc = 'Single test debug' }) - vim.keymap.set('n', 'jf', jester.run, { desc = 'File test Run' }) - -- vim.keymap.set('n', 'jfd', jester.debug, { desc = 'File test debug' }) + vim.keymap.set('n', 'jsr', jester.run, { desc = 'Single test Run' }) + vim.keymap.set('n', 'jsd', jester.debug, { desc = 'Single test debug' }) + vim.keymap.set('n', 'jfr', jester.run, { desc = 'File test Run' }) + vim.keymap.set('n', 'jfd', jester.debug, { desc = 'File test debug' }) end, }, } diff --git a/lua/custom/plugins/neoclip.lua b/lua/custom/plugins/neoclip.lua new file mode 100644 index 00000000000..dcdeccb9ee8 --- /dev/null +++ b/lua/custom/plugins/neoclip.lua @@ -0,0 +1,13 @@ +return { + { + 'AckslD/nvim-neoclip.lua', + dependencies = { + { 'nvim-telescope/telescope.nvim' }, + }, + config = function() + require('neoclip').setup() + + vim.keymap.set('n', 'sv', ':Telescope neoclip', { desc = 'Yank history' }) + end, + }, +} diff --git a/lua/custom/plugins/neogit.lua b/lua/custom/plugins/neogit.lua new file mode 100644 index 00000000000..ddb0d43de32 --- /dev/null +++ b/lua/custom/plugins/neogit.lua @@ -0,0 +1,17 @@ +return { + { + 'NeogitOrg/neogit', + tag = 'v0.0.1', + dependencies = { + 'nvim-lua/plenary.nvim', + 'sindrets/diffview.nvim', + 'nvim-telescope/telescope.nvim', + }, + opts = { + integrations = { + telescope = true, + diffview = true, + }, + }, + }, +} diff --git a/lua/custom/plugins/noice.lua b/lua/custom/plugins/noice.lua new file mode 100644 index 00000000000..aac0ff60cbd --- /dev/null +++ b/lua/custom/plugins/noice.lua @@ -0,0 +1,15 @@ +return { + { + 'folke/noice.nvim', + event = 'VeryLazy', + opts = { + messages = { + enabled = false, + }, + }, + dependencies = { + 'MunifTanjim/nui.nvim', + 'rcarriga/nvim-notify', + }, + }, +} diff --git a/lua/custom/plugins/workspace.lua b/lua/custom/plugins/workspace.lua new file mode 100644 index 00000000000..72515c36ab9 --- /dev/null +++ b/lua/custom/plugins/workspace.lua @@ -0,0 +1,16 @@ +return { + { + 'KrzysiekWyka/workspace.nvim', + dependencies = { 'nvim-telescope/telescope.nvim' }, + config = function() + require('workspace').setup { + workspaces = { + { name = 'Work', path = '~/development/nodejs/work', keymap = { 'w' } }, + }, + } + + local workspace = require 'workspace' + vim.keymap.set('n', 'ps', workspace.tmux_sessions) + end, + }, +} diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 04214000dd6..2e8d06c122b 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -99,9 +99,13 @@ return { ensure_installed = { -- Update this to ensure that you have the debuggers for the langs you want 'delve', + 'js', }, } + -- Read .vscode/launch.json + require('dap.ext.vscode').load_launchjs(nil, {}) + -- Basic debugging keymaps, feel free to change to your liking! vim.keymap.set('n', '', dap.continue, { desc = 'Debug: Start/Continue' }) vim.keymap.set('n', '', dap.step_into, { desc = 'Debug: Step Into' }) @@ -153,48 +157,34 @@ return { dap.listeners.before.event_terminated['dapui_config'] = dapui.close dap.listeners.before.event_exited['dapui_config'] = dapui.close - require('dap-vscode-js').setup { - -- node_path = "node", -- Path of node executable. Defaults to $NODE_PATH, and then "node" - debugger_path = vim.fn.stdpath 'data' .. '/lazy/vscode-js-debug', - -- debugger_cmd = { "extension" }, -- Command to use to launch the debug server. Takes precedence over `node_path` and `debugger_path`. - adapters = { 'pwa-node', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost', 'node' }, -- which adapters to register in nvim-dap - -- log_file_path = "(stdpath cache)/dap_vscode_js.log" -- Path for file logging - -- log_file_level = false -- Logging level for output to file. Set to false to disable file logging. - -- log_console_level = vim.log.levels.ERROR -- Logging level for output to console. Set to false to disable console output. + dap.adapters['pwa-node'] = { + type = 'server', + host = '::1', + port = '${port}', + executable = { + command = 'js-debug-adapter', + args = { '${port}' }, + }, } local js_based_languages = { 'typescript', 'javascript' } for _, language in ipairs(js_based_languages) do - require('dap').configurations[language] = { - { - type = 'pwa-node', - request = 'launch', - name = 'Launch file', - program = '${file}', - cwd = '${workspaceFolder}', - }, - { - type = 'pwa-node', - request = 'attach', - name = 'Attach', - processId = require('dap.utils').pick_process, - cwd = '${workspaceFolder}', - }, - { - type = 'pwa-node', - request = 'launch', - name = 'Debug Jest Tests', - env = { NODE_OPTIONS = '--experimental-vm-modules', ENV = 'test' }, - runtimeExecutable = 'node', - runtimeArgs = { - './node_modules/jest/bin/jest.js', - }, - rootPath = '${workspaceFolder}', - cwd = '${workspaceFolder}', - console = 'integratedTerminal', - internalConsoleOptions = 'neverOpen', - }, + dap.configurations[language] = { + -- { + -- type = 'pwa-node', + -- request = 'launch', + -- name = 'Launch file', + -- program = '${file}', + -- cwd = '${workspaceFolder}', + -- }, + -- { + -- type = 'pwa-node', + -- request = 'attach', + -- name = 'Attach', + -- processId = require('dap.utils').pick_process, + -- cwd = '${workspaceFolder}', + -- } } end end, From e0f13e8ddffcd3a02ee98e3ccb600d27de48efcf Mon Sep 17 00:00:00 2001 From: Krzysiek Wyka Date: Mon, 16 Dec 2024 19:25:32 +0100 Subject: [PATCH 03/10] Support nix formatter --- init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/init.lua b/init.lua index cb088acd0ed..a40ce11cbe2 100644 --- a/init.lua +++ b/init.lua @@ -696,6 +696,7 @@ require('lazy').setup({ json = { { 'prettier' } }, javascript = { { 'prettier' } }, typescript = { { 'prettier' } }, + nix = { { 'nixfmt' } }, }, }, }, From ea70daf7b42f44a2573509db1bcf78e3fad850a5 Mon Sep 17 00:00:00 2001 From: Krzysiek Wyka Date: Sun, 2 Feb 2025 15:25:14 +0100 Subject: [PATCH 04/10] Add extra plugins --- lua/custom/plugins/renamer.lua | 3 +++ lua/custom/plugins/session.lua | 13 +++++++++++++ lua/custom/plugins/typecheck.lua | 16 ++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 lua/custom/plugins/renamer.lua create mode 100644 lua/custom/plugins/session.lua create mode 100644 lua/custom/plugins/typecheck.lua diff --git a/lua/custom/plugins/renamer.lua b/lua/custom/plugins/renamer.lua new file mode 100644 index 00000000000..8f2acc3ee61 --- /dev/null +++ b/lua/custom/plugins/renamer.lua @@ -0,0 +1,3 @@ +return { + 'filipdutescu/renamer.nvim', +} diff --git a/lua/custom/plugins/session.lua b/lua/custom/plugins/session.lua new file mode 100644 index 00000000000..dc08add1981 --- /dev/null +++ b/lua/custom/plugins/session.lua @@ -0,0 +1,13 @@ +return { + 'rmagatti/auto-session', + lazy = false, + + ---enables autocomplete for opts + ---@module "auto-session" + ---@type AutoSession.Config + opts = { + -- suppressed_dirs = { '~/', '~/Projects', '~/Downloads', '/' }, + allowed_dirs = { '~/development/nodejs/work' }, + -- log_level = 'debug', + }, +} diff --git a/lua/custom/plugins/typecheck.lua b/lua/custom/plugins/typecheck.lua new file mode 100644 index 00000000000..16aebd3ee44 --- /dev/null +++ b/lua/custom/plugins/typecheck.lua @@ -0,0 +1,16 @@ +return { + 'jellydn/typecheck.nvim', + dependencies = { 'folke/trouble.nvim', dependencies = { 'nvim-tree/nvim-web-devicons' } }, + ft = { 'javascript', 'javascriptreact', 'json', 'jsonc', 'typescript' }, + opts = { + debug = true, + mode = 'trouble', -- "quickfix" | "trouble" + }, + keys = { + { + 'st', + 'Typecheck', + desc = 'Run Type Check', + }, + }, +} From 9f3b37bc10706598ea586a63806bae259681697f Mon Sep 17 00:00:00 2001 From: Krzysiek Wyka Date: Sat, 1 Mar 2025 19:48:40 +0100 Subject: [PATCH 05/10] Switch to better typescript language server --- init.lua | 11 ++++++----- lua/custom/plugins/neoclip.lua | 13 ------------- lua/custom/plugins/session.lua | 4 +--- lua/custom/plugins/typescript.lua | 5 +++++ lua/custom/plugins/workspace.lua | 2 +- 5 files changed, 13 insertions(+), 22 deletions(-) delete mode 100644 lua/custom/plugins/neoclip.lua create mode 100644 lua/custom/plugins/typescript.lua diff --git a/init.lua b/init.lua index a40ce11cbe2..8b1fa4af8a5 100644 --- a/init.lua +++ b/init.lua @@ -601,7 +601,7 @@ require('lazy').setup({ -- https://github.com/pmizio/typescript-tools.nvim -- -- But for many setups, the LSP (`ts_ls`) will work just fine - ts_ls = {}, + -- ts_ls = {}, -- lua_ls = { @@ -618,6 +618,8 @@ require('lazy').setup({ }, }, }, + + eslint = {}, } -- Ensure the servers and tools above are installed @@ -693,10 +695,9 @@ require('lazy').setup({ -- -- You can use 'stop_after_first' to run the first available formatter from the list -- javascript = { "prettierd", "prettier", stop_after_first = true }, - json = { { 'prettier' } }, - javascript = { { 'prettier' } }, - typescript = { { 'prettier' } }, - nix = { { 'nixfmt' } }, + json = { 'prettier', stop_after_first = true }, + javascript = { 'prettier', stop_after_first = true }, + typescript = { 'prettier', stop_after_first = true }, }, }, }, diff --git a/lua/custom/plugins/neoclip.lua b/lua/custom/plugins/neoclip.lua deleted file mode 100644 index dcdeccb9ee8..00000000000 --- a/lua/custom/plugins/neoclip.lua +++ /dev/null @@ -1,13 +0,0 @@ -return { - { - 'AckslD/nvim-neoclip.lua', - dependencies = { - { 'nvim-telescope/telescope.nvim' }, - }, - config = function() - require('neoclip').setup() - - vim.keymap.set('n', 'sv', ':Telescope neoclip', { desc = 'Yank history' }) - end, - }, -} diff --git a/lua/custom/plugins/session.lua b/lua/custom/plugins/session.lua index dc08add1981..e87d0431d78 100644 --- a/lua/custom/plugins/session.lua +++ b/lua/custom/plugins/session.lua @@ -6,8 +6,6 @@ return { ---@module "auto-session" ---@type AutoSession.Config opts = { - -- suppressed_dirs = { '~/', '~/Projects', '~/Downloads', '/' }, - allowed_dirs = { '~/development/nodejs/work' }, - -- log_level = 'debug', + allowed_dirs = { '~/nodejs/work/*', '~/nodejs/private/*', '~/nodejs/playground/', '~/metadata/work/*', '~/golang/*' }, }, } diff --git a/lua/custom/plugins/typescript.lua b/lua/custom/plugins/typescript.lua new file mode 100644 index 00000000000..ba7fb2046e7 --- /dev/null +++ b/lua/custom/plugins/typescript.lua @@ -0,0 +1,5 @@ +return { + 'pmizio/typescript-tools.nvim', + dependencies = { 'nvim-lua/plenary.nvim', 'neovim/nvim-lspconfig' }, + opts = {}, +} diff --git a/lua/custom/plugins/workspace.lua b/lua/custom/plugins/workspace.lua index 72515c36ab9..e5f73cb074f 100644 --- a/lua/custom/plugins/workspace.lua +++ b/lua/custom/plugins/workspace.lua @@ -5,7 +5,7 @@ return { config = function() require('workspace').setup { workspaces = { - { name = 'Work', path = '~/development/nodejs/work', keymap = { 'w' } }, + { name = 'Work', path = '~/nodejs/work', keymap = { 'w' } }, }, } From 0e1e3bc042f6eb1f9c70ca702c2b07a28967ceeb Mon Sep 17 00:00:00 2001 From: Krzysiek Wyka Date: Fri, 4 Jul 2025 21:30:07 +0200 Subject: [PATCH 06/10] Install extra plugins --- lua/custom/plugins/copilot.lua | 11 +++++++++ lua/custom/plugins/spellcheck.lua | 38 +++++++++++++++++++++++++++++++ lua/custom/plugins/trouble.lua | 37 ++++++++++++++++++++++++++++++ lua/kickstart/plugins/debug.lua | 38 +++++++++++++++++++++++++++++++ 4 files changed, 124 insertions(+) create mode 100644 lua/custom/plugins/copilot.lua create mode 100644 lua/custom/plugins/spellcheck.lua create mode 100644 lua/custom/plugins/trouble.lua diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua new file mode 100644 index 00000000000..b9c3afe0d19 --- /dev/null +++ b/lua/custom/plugins/copilot.lua @@ -0,0 +1,11 @@ +return { + { + 'CopilotC-Nvim/CopilotChat.nvim', + dependencies = { + { 'github/copilot.vim' }, + { 'nvim-lua/plenary.nvim', branch = 'master' }, + }, + build = 'make tiktoken', + opts = {}, + }, +} diff --git a/lua/custom/plugins/spellcheck.lua b/lua/custom/plugins/spellcheck.lua new file mode 100644 index 00000000000..49698493b24 --- /dev/null +++ b/lua/custom/plugins/spellcheck.lua @@ -0,0 +1,38 @@ +return { + 'nvimtools/none-ls.nvim', + event = 'VeryLazy', + dependencies = 'davidmh/cspell.nvim', + config = function() + local null_ls = require 'null-ls' + local cspell = require 'cspell' + local cspell_config = { + diagnostics_postprocess = function(diagnostic) + diagnostic.severity = vim.diagnostic.severity['HINT'] + end, + config = { + config_file_preferred_name = 'config.json', + cspell_config_dirs = { '~/.config/cspell/' }, + on_add_to_json = function(payload) + os.execute( + string.format( + "jq -S '.words |= sort' %s > %s.tmp && mv %s.tmp %s", + payload.cspell_config_path, + payload.cspell_config_path, + payload.cspell_config_path, + payload.cspell_config_path + ) + ) + end, + on_add_to_dictionary = function(payload) + os.execute(string.format('sort %s -o %s', payload.dictionary_path, payload.dictionary_path)) + end, + }, + } + null_ls.setup { + sources = { + cspell.diagnostics.with(cspell_config), + cspell.code_actions.with(cspell_config), + }, + } + end, +} diff --git a/lua/custom/plugins/trouble.lua b/lua/custom/plugins/trouble.lua new file mode 100644 index 00000000000..d0578c9f404 --- /dev/null +++ b/lua/custom/plugins/trouble.lua @@ -0,0 +1,37 @@ +return { + 'folke/trouble.nvim', + opts = {}, -- for default options, refer to the configuration section for custom setup. + cmd = 'Trouble', + keys = { + { + 'xx', + 'Trouble diagnostics toggle', + desc = 'Diagnostics (Trouble)', + }, + { + 'xX', + 'Trouble diagnostics toggle filter.buf=0', + desc = 'Buffer Diagnostics (Trouble)', + }, + { + 'cs', + 'Trouble symbols toggle focus=false', + desc = 'Symbols (Trouble)', + }, + { + 'cl', + 'Trouble lsp toggle focus=false win.position=right', + desc = 'LSP Definitions / references / ... (Trouble)', + }, + { + 'xL', + 'Trouble loclist toggle', + desc = 'Location List (Trouble)', + }, + { + 'xQ', + 'Trouble qflist toggle', + desc = 'Quickfix List (Trouble)', + }, + }, +} diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 2e8d06c122b..d83598c01be 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -139,6 +139,44 @@ return { disconnect = '⏏', }, }, + layouts = { + { + elements = { + { + id = 'scopes', + size = 0.25, + }, + { + id = 'breakpoints', + size = 0.25, + }, + { + id = 'stacks', + size = 0.25, + }, + { + id = 'watches', + size = 0.25, + }, + }, + position = 'left', + size = 40, + }, + { + elements = { + -- { + -- id = 'repl', + -- size = 1, + -- }, + { + id = 'console', + size = 1, + }, + }, + position = 'bottom', + size = 10, + }, + }, } -- Change breakpoint icons From 505100d644883b6b84ad0f82868a07cb38b9a7f8 Mon Sep 17 00:00:00 2001 From: Krzysiek Wyka Date: Mon, 21 Jul 2025 16:55:04 +0200 Subject: [PATCH 07/10] Use neotest instead of jester for testing --- lua/custom/plugins/jester.lua | 48 ------------------------------ lua/custom/plugins/neotest.lua | 49 +++++++++++++++++++++++++++++++ lua/custom/plugins/spellcheck.lua | 1 - 3 files changed, 49 insertions(+), 49 deletions(-) delete mode 100644 lua/custom/plugins/jester.lua create mode 100644 lua/custom/plugins/neotest.lua diff --git a/lua/custom/plugins/jester.lua b/lua/custom/plugins/jester.lua deleted file mode 100644 index adc8ed3c3b1..00000000000 --- a/lua/custom/plugins/jester.lua +++ /dev/null @@ -1,48 +0,0 @@ -return { - { - 'David-Kunz/jester', - config = function() - local jester = require 'jester' - require('which-key').register({ - j = { - name = '[J]ester', - s = { - name = '[S]ingle test', - }, - f = { - name = '[F]ile test', - }, - ['1'] = 'which_key_ignore', - }, - }, { prefix = '' }) - - jester.setup { - cmd = "npm t -- -t '$result' $file", - identifiers = { 'test', 'it' }, - prepend = { 'describe' }, - expressions = { 'call_expression' }, - path_to_jest_run = 'jest', - path_to_jest_debug = './node_modules/.bin/jest', - terminal_cmd = ':vsplit | terminal', - dap = { - type = 'pwa-node', - request = 'launch', - cwd = vim.fn.getcwd(), - runtimeArgs = { '--inspect-brk', '~/n/bin/npm', 't', '--', '--no-coverage', '-t', '$result', '--', '$file' }, - args = { '--no-cache' }, - sourceMaps = false, - protocol = 'inspector', - skipFiles = { '/**/*.js' }, - console = 'integratedTerminal', - port = 9229, - disableOptimisticBPs = true, - }, - } - - vim.keymap.set('n', 'jsr', jester.run, { desc = 'Single test Run' }) - vim.keymap.set('n', 'jsd', jester.debug, { desc = 'Single test debug' }) - vim.keymap.set('n', 'jfr', jester.run, { desc = 'File test Run' }) - vim.keymap.set('n', 'jfd', jester.debug, { desc = 'File test debug' }) - end, - }, -} diff --git a/lua/custom/plugins/neotest.lua b/lua/custom/plugins/neotest.lua new file mode 100644 index 00000000000..01003bbc86f --- /dev/null +++ b/lua/custom/plugins/neotest.lua @@ -0,0 +1,49 @@ +return { + 'nvim-neotest/neotest', + dependencies = { + 'nvim-neotest/nvim-nio', + 'nvim-lua/plenary.nvim', + 'antoinemadec/FixCursorHold.nvim', + 'nvim-treesitter/nvim-treesitter', + 'nvim-neotest/neotest-jest', + }, + config = function() + local neotest = require 'neotest' + + neotest.setup { + discovery = { + enabled = false, + }, + adapters = { + require 'neotest-jest' { + jestCommand = 'npm t --', + jest_test_discovery = false, + -- jestConfigFile = 'custom.jest.config.ts', + -- env = { CI = true }, + cwd = function(path) + return vim.fn.getcwd() + end, + }, + }, + } + + vim.keymap.set('n', 'jsr', neotest.run.run, { desc = 'Single test Run' }) + vim.keymap.set('n', 'jsd', function() + neotest.run.run { strategy = 'dap' } + end, { desc = 'Single test debug' }) + vim.keymap.set('n', 'jfr', function() + neotest.run.run(vim.fn.expand '%') + end, { desc = 'File test Run' }) + vim.keymap.set('n', 'jfd', function() + neotest.run.run { + vim.fn.expand '%', + strategy = 'dap', + } + end, { desc = 'File test debug' }) + vim.keymap.set('n', 'jo', function() + neotest.output.open { enter = true } + end, { desc = 'Open test result output' }) + vim.keymap.set('n', 'jp', neotest.output_panel.toggle, { desc = 'Toggle test result output tree' }) + vim.keymap.set('n', 'jr', neotest.summary.toggle, { desc = 'Toggle test summary' }) + end, +} diff --git a/lua/custom/plugins/spellcheck.lua b/lua/custom/plugins/spellcheck.lua index 49698493b24..7fefd4070ab 100644 --- a/lua/custom/plugins/spellcheck.lua +++ b/lua/custom/plugins/spellcheck.lua @@ -10,7 +10,6 @@ return { diagnostic.severity = vim.diagnostic.severity['HINT'] end, config = { - config_file_preferred_name = 'config.json', cspell_config_dirs = { '~/.config/cspell/' }, on_add_to_json = function(payload) os.execute( From 07af8559a4e4d296879a045974afc831bd6a8512 Mon Sep 17 00:00:00 2001 From: Krzysiek Wyka Date: Fri, 25 Jul 2025 10:47:29 +0200 Subject: [PATCH 08/10] Remove useless extenstions --- init.lua | 59 +++++++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/init.lua b/init.lua index 8b1fa4af8a5..9d31cb57fa6 100644 --- a/init.lua +++ b/init.lua @@ -706,35 +706,7 @@ require('lazy').setup({ 'saghen/blink.cmp', event = 'VimEnter', version = '1.*', - dependencies = { - -- Snippet Engine - { - 'L3MON4D3/LuaSnip', - version = '2.*', - build = (function() - -- Build Step is needed for regex support in snippets. - -- This step is not supported in many windows environments. - -- Remove the below condition to re-enable on windows. - if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then - return - end - return 'make install_jsregexp' - end)(), - dependencies = { - -- `friendly-snippets` contains a variety of premade snippets. - -- See the README about individual language/framework/plugin snippets: - -- https://github.com/rafamadriz/friendly-snippets - -- { - -- 'rafamadriz/friendly-snippets', - -- config = function() - -- require('luasnip.loaders.from_vscode').lazy_load() - -- end, - -- }, - }, - opts = {}, - }, - 'folke/lazydev.nvim', - }, + dependencies = { 'folke/lazydev.nvim' }, --- @module 'blink.cmp' --- @type blink.cmp.Config opts = { @@ -776,6 +748,31 @@ require('lazy').setup({ -- By default, you may press `` to show the documentation. -- Optionally, set `auto_show = true` to show the documentation after a delay. documentation = { auto_show = false, auto_show_delay_ms = 500 }, + + menu = { + draw = { + components = { + kind_icon = { + text = function(ctx) + local kind_icon, _, _ = require('mini.icons').get('lsp', ctx.kind) + return kind_icon + end, + -- (optional) use highlights from mini.icons + highlight = function(ctx) + local _, hl, _ = require('mini.icons').get('lsp', ctx.kind) + return hl + end, + }, + kind = { + -- (optional) use highlights from mini.icons + highlight = function(ctx) + local _, hl, _ = require('mini.icons').get('lsp', ctx.kind) + return hl + end, + }, + }, + }, + }, }, sources = { @@ -785,7 +782,7 @@ require('lazy').setup({ }, }, - snippets = { preset = 'luasnip' }, + -- snippets = { preset = 'luasnip' }, -- Blink.cmp includes an optional, recommended rust fuzzy matcher, -- which automatically downloads a prebuilt binary when enabled. @@ -899,7 +896,7 @@ require('lazy').setup({ -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', + require 'kickstart.plugins.indent_line', require 'kickstart.plugins.lint', -- require 'kickstart.plugins.autopairs', require 'kickstart.plugins.neo-tree', From 6cf3d0015e5984036e51ce542e1baa8eaf1ae8df Mon Sep 17 00:00:00 2001 From: Krzysiek Wyka Date: Fri, 25 Jul 2025 19:03:54 +0200 Subject: [PATCH 09/10] Small changes --- init.lua | 7 +++-- lua/custom/plugins/neotest.lua | 2 -- lua/kickstart/plugins/lint.lua | 57 ---------------------------------- 3 files changed, 4 insertions(+), 62 deletions(-) diff --git a/init.lua b/init.lua index 9d31cb57fa6..44008d7cb9b 100644 --- a/init.lua +++ b/init.lua @@ -86,7 +86,7 @@ vim.o.confirm = true -- Clear highlights on search when pressing in normal mode -- See `:help hlsearch` -- Spell checking -vim.opt.spell = true +-- vim.opt.spell = true vim.keymap.set('n', '', 'nohlsearch') @@ -219,7 +219,7 @@ require('lazy').setup({ { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', - version = '2.1.0', + -- version = '2.1.0', event = 'VimEnter', -- Sets the loading event to 'VimEnter' opts = { -- delay between pressing a key and opening which-key (milliseconds) @@ -620,6 +620,8 @@ require('lazy').setup({ }, eslint = {}, + + graphql = {}, } -- Ensure the servers and tools above are installed @@ -803,7 +805,6 @@ require('lazy').setup({ -- change the command in the config to whatever the name of that colorscheme is. -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - -- 'folke/tokyonight.nvim', 'navarasu/onedark.nvim', priority = 1000, -- Make sure to load this before all the other start plugins. init = function() diff --git a/lua/custom/plugins/neotest.lua b/lua/custom/plugins/neotest.lua index 01003bbc86f..e6aa681e30a 100644 --- a/lua/custom/plugins/neotest.lua +++ b/lua/custom/plugins/neotest.lua @@ -18,8 +18,6 @@ return { require 'neotest-jest' { jestCommand = 'npm t --', jest_test_discovery = false, - -- jestConfigFile = 'custom.jest.config.ts', - -- env = { CI = true }, cwd = function(path) return vim.fn.getcwd() end, diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index cf501e904c8..d315e347b5a 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -3,21 +3,6 @@ return { { -- Linting 'mfussenegger/nvim-lint', event = { 'BufReadPre', 'BufNewFile' }, - -- init = function() - -- require('lint').linters.eslint.args = { '--fix' } - -- end, - -- init = function() - -- require('lint').linters.eslint.args = { - -- '--fix', - -- '--format', - -- 'json', - -- '--stdin', - -- '--stdin-filename', - -- function() - -- return vim.api.nvim_buf_get_name(0) - -- end, - -- } - -- end, config = function() local lint = require 'lint' lint.linters_by_ft = { @@ -26,48 +11,6 @@ return { javascript = { 'eslint' }, } - -- lint.linters.eslint.args = { - -- '--fix', - -- '--format', - -- 'json', - -- '--stdin', - -- '--stdin-filename', - -- function() - -- return vim.api.nvim_buf_get_name(0) - -- end, - -- } - -- -- To allow other plugins to add linters to require('lint').linters_by_ft, - -- instead set linters_by_ft like this: - -- lint.linters_by_ft = lint.linters_by_ft or {} - -- lint.linters_by_ft['markdown'] = { 'markdownlint' } - -- - -- However, note that this will enable a set of default linters, - -- which will cause errors unless these tools are available: - -- { - -- clojure = { "clj-kondo" }, - -- dockerfile = { "hadolint" }, - -- inko = { "inko" }, - -- janet = { "janet" }, - -- json = { "jsonlint" }, - -- markdown = { "vale" }, - -- rst = { "vale" }, - -- ruby = { "ruby" }, - -- terraform = { "tflint" }, - -- text = { "vale" } - -- } - -- - -- You can disable the default linters by setting their filetypes to nil: - -- lint.linters_by_ft['clojure'] = nil - -- lint.linters_by_ft['dockerfile'] = nil - -- lint.linters_by_ft['inko'] = nil - -- lint.linters_by_ft['janet'] = nil - -- lint.linters_by_ft['json'] = nil - -- lint.linters_by_ft['markdown'] = nil - -- lint.linters_by_ft['rst'] = nil - -- lint.linters_by_ft['ruby'] = nil - -- lint.linters_by_ft['terraform'] = nil - -- lint.linters_by_ft['text'] = nil - -- Create autocommand which carries out the actual linting -- on the specified events. local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true }) From d5f881f96abd75f0fd814c2d18ad74420bbd676e Mon Sep 17 00:00:00 2001 From: Krzysiek Wyka Date: Fri, 6 Feb 2026 12:49:40 +0100 Subject: [PATCH 10/10] Make nvim great again --- init.lua | 34 +++------ lua/custom/plugins/copilot.lua | 11 --- lua/kickstart/plugins/debug.lua | 129 ++++++++++++++++++++++++++------ 3 files changed, 119 insertions(+), 55 deletions(-) delete mode 100644 lua/custom/plugins/copilot.lua diff --git a/init.lua b/init.lua index 44008d7cb9b..331f2b12d58 100644 --- a/init.lua +++ b/init.lua @@ -861,30 +861,20 @@ require('lazy').setup({ -- Check out: https://github.com/echasnovski/mini.nvim end, }, + { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - main = 'nvim-treesitter.configs', -- Sets main module to use for opts - -- [[ Configure Treesitter ]] See `:help nvim-treesitter` - opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'typescript', 'javascript' }, - -- Autoinstall languages that are not installed - auto_install = true, - highlight = { - enable = true, - -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. - -- If you are experiencing weird indenting issues, add the language to - -- the list of additional_vim_regex_highlighting and disabled languages for indent. - additional_vim_regex_highlighting = { 'ruby' }, - }, - indent = { enable = true, disable = { 'ruby' } }, - }, - -- There are additional nvim-treesitter modules that you can use to interact - -- with nvim-treesitter. You should go explore a few and see what interests you: - -- - -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` - -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context - -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects + config = function() + local filetypes = + { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'typescript', 'javascript', 'graphql' } + require('nvim-treesitter').install(filetypes) + vim.api.nvim_create_autocmd('FileType', { + pattern = filetypes, + callback = function() + vim.treesitter.start() + end, + }) + end, }, -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua deleted file mode 100644 index b9c3afe0d19..00000000000 --- a/lua/custom/plugins/copilot.lua +++ /dev/null @@ -1,11 +0,0 @@ -return { - { - 'CopilotC-Nvim/CopilotChat.nvim', - dependencies = { - { 'github/copilot.vim' }, - { 'nvim-lua/plenary.nvim', branch = 'master' }, - }, - build = 'make tiktoken', - opts = {}, - }, -} diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index d83598c01be..c5b730e086e 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -23,10 +23,12 @@ return { -- Add your own debuggers here 'leoluz/nvim-dap-go', - 'mxsdev/nvim-dap-vscode-js', -- Virtual text 'theHamsta/nvim-dap-virtual-text', + + -- JSON5 parser for .vscode/launch.json (supports comments and trailing commas) + 'Joakker/lua-json5', }, keys = { -- Basic debugging keymaps, feel free to change to your liking! @@ -37,6 +39,19 @@ return { end, desc = 'Debug: Start/Continue', }, + { + '', + function() + local dap = require('dap') + dap.terminate() + vim.defer_fn(function() + if dap.session() then + dap.close() + end + end, 500) + end, + desc = 'Debug: Stop/Terminate', + }, { '', function() @@ -80,6 +95,18 @@ return { end, desc = 'Debug: See last session result.', }, + { + 'dt', + function() + require('dap').terminate() + vim.defer_fn(function() + if require('dap').session() then + require('dap').close() + end + end, 500) + end, + desc = 'Debug: Terminate Session', + }, }, config = function() local dap = require 'dap' @@ -103,8 +130,13 @@ return { }, } - -- Read .vscode/launch.json - require('dap.ext.vscode').load_launchjs(nil, {}) + -- Enable JSON5 parser for .vscode/launch.json to support comments and trailing commas + -- nvim-dap will automatically load .vscode/launch.json configurations via dap.launch.json provider + -- This allows you to use VSCode-style launch.json files with JavaScript-style comments + local ok, json5 = pcall(require, 'json5') + if ok then + require('dap.ext.vscode').json_decode = json5.parse + end -- Basic debugging keymaps, feel free to change to your liking! vim.keymap.set('n', '', dap.continue, { desc = 'Debug: Start/Continue' }) @@ -116,6 +148,16 @@ return { dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, { desc = 'Debug: Set Breakpoint' }) + -- Terminate session (with force close after timeout) + vim.keymap.set('n', 'dt', function() + dap.terminate() + vim.defer_fn(function() + if dap.session() then + dap.close() + end + end, 500) + end, { desc = 'Debug: Terminate Session' }) + -- Dap virtual text setup require('nvim-dap-virtual-text').setup() @@ -192,37 +234,80 @@ return { -- end dap.listeners.after.event_initialized['dapui_config'] = dapui.open - dap.listeners.before.event_terminated['dapui_config'] = dapui.close - dap.listeners.before.event_exited['dapui_config'] = dapui.close + dap.listeners.after.event_terminated['dapui_config'] = dapui.close + dap.listeners.after.event_exited['dapui_config'] = dapui.close + -- Configure vscode-js-debug adapter (installed via Mason as js-debug-adapter) + -- NOTE: We configure this manually instead of using nvim-dap-vscode-js plugin + -- because that plugin is unmaintained. Direct configuration is the recommended + -- approach in 2026 and provides better control. + -- This adapter supports Node.js debugging dap.adapters['pwa-node'] = { type = 'server', - host = '::1', + host = 'localhost', port = '${port}', executable = { - command = 'js-debug-adapter', + command = vim.fn.stdpath 'data' .. '/mason/bin/js-debug-adapter', args = { '${port}' }, }, + options = { + disconnect_on_terminate = true, + }, } - local js_based_languages = { 'typescript', 'javascript' } + -- Configure debugging for JavaScript/TypeScript + local js_based_languages = { 'typescript', 'javascript', 'typescriptreact', 'javascriptreact' } for _, language in ipairs(js_based_languages) do dap.configurations[language] = { - -- { - -- type = 'pwa-node', - -- request = 'launch', - -- name = 'Launch file', - -- program = '${file}', - -- cwd = '${workspaceFolder}', - -- }, - -- { - -- type = 'pwa-node', - -- request = 'attach', - -- name = 'Attach', - -- processId = require('dap.utils').pick_process, - -- cwd = '${workspaceFolder}', - -- } + { + type = 'pwa-node', + request = 'launch', + name = 'Launch Current File (Node)', + program = '${file}', + cwd = '${workspaceFolder}', + sourceMaps = true, + protocol = 'inspector', + console = 'integratedTerminal', + }, + { + type = 'pwa-node', + request = 'launch', + name = 'Launch Program', + program = '${workspaceFolder}/dist/index.js', + cwd = '${workspaceFolder}', + sourceMaps = true, + protocol = 'inspector', + console = 'integratedTerminal', + preLaunchTask = 'npm: build', + }, + { + type = 'pwa-node', + request = 'attach', + name = 'Attach to Process', + processId = require('dap.utils').pick_process, + cwd = '${workspaceFolder}', + sourceMaps = true, + protocol = 'inspector', + }, + { + type = 'pwa-node', + request = 'launch', + name = 'Debug Jest Tests', + runtimeExecutable = 'node', + runtimeArgs = { + './node_modules/jest/bin/jest.js', + '--runInBand', + '--no-coverage', + '--no-cache', + '--watchAll=false', + }, + rootPath = '${workspaceFolder}', + cwd = '${workspaceFolder}', + console = 'integratedTerminal', + internalConsoleOptions = 'neverOpen', + sourceMaps = true, + }, } end end,