diff --git a/init.lua b/init.lua index b98ffc6198a..331f2b12d58 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' @@ -171,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 @@ -207,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 @@ -300,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) @@ -698,6 +618,10 @@ require('lazy').setup({ }, }, }, + + eslint = {}, + + graphql = {}, } -- Ensure the servers and tools above are installed @@ -773,6 +697,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', stop_after_first = true }, + javascript = { 'prettier', stop_after_first = true }, + typescript = { 'prettier', stop_after_first = true }, }, }, }, @@ -781,35 +708,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 = { @@ -851,6 +750,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 = { @@ -860,7 +784,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. @@ -881,20 +805,19 @@ 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. - 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, }, @@ -938,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' }, - -- 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 @@ -973,18 +886,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.indent_line', - -- require 'kickstart.plugins.lint', + require 'kickstart.plugins.debug', + require 'kickstart.plugins.indent_line', + 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/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/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/neotest.lua b/lua/custom/plugins/neotest.lua new file mode 100644 index 00000000000..e6aa681e30a --- /dev/null +++ b/lua/custom/plugins/neotest.lua @@ -0,0 +1,47 @@ +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, + 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/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/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..e87d0431d78 --- /dev/null +++ b/lua/custom/plugins/session.lua @@ -0,0 +1,11 @@ +return { + 'rmagatti/auto-session', + lazy = false, + + ---enables autocomplete for opts + ---@module "auto-session" + ---@type AutoSession.Config + opts = { + allowed_dirs = { '~/nodejs/work/*', '~/nodejs/private/*', '~/nodejs/playground/', '~/metadata/work/*', '~/golang/*' }, + }, +} diff --git a/lua/custom/plugins/spellcheck.lua b/lua/custom/plugins/spellcheck.lua new file mode 100644 index 00000000000..7fefd4070ab --- /dev/null +++ b/lua/custom/plugins/spellcheck.lua @@ -0,0 +1,37 @@ +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 = { + 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/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', + }, + }, +} 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 new file mode 100644 index 00000000000..e5f73cb074f --- /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 = '~/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 8e332bf2ff9..c5b730e086e 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -23,6 +23,12 @@ return { -- Add your own debuggers here 'leoluz/nvim-dap-go', + + -- 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! @@ -33,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() @@ -76,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' @@ -95,9 +126,41 @@ return { ensure_installed = { -- Update this to ensure that you have the debuggers for the langs you want 'delve', + 'js', }, } + -- 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' }) + 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' }) + + -- 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() + -- Dap UI setup -- For more information, see |:help nvim-dap-ui| dapui.setup { @@ -118,6 +181,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 @@ -133,16 +234,81 @@ 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 - - -- 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, + 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 = 'localhost', + port = '${port}', + executable = { + command = vim.fn.stdpath 'data' .. '/mason/bin/js-debug-adapter', + args = { '${port}' }, + }, + options = { + disconnect_on_terminate = true, }, } + + -- 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 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, } diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index dec42f097c6..d315e347b5a 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -7,40 +7,10 @@ return { 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, - -- 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 })