From fcb259578bc3be73a0ac7ef19a5211d9bc2d59d8 Mon Sep 17 00:00:00 2001 From: Tomas Pustelnik <10606260+Pustelto@users.noreply.github.com> Date: Mon, 29 Jul 2024 11:04:42 +0200 Subject: [PATCH] [vim]: update configuration --- config/new-config-nvim/lazy-lock.json | 73 ++--- config/new-config-nvim/lua/lazy-bootstrap.lua | 11 +- config/new-config-nvim/lua/lazy-plugins.lua | 7 +- config/new-config-nvim/lua/options.lua | 7 +- .../new-config-nvim/lua/plugins/_neo-tree.lua | 249 ------------------ .../lua/plugins/colorscheme.lua | 3 +- .../new-config-nvim/lua/plugins/comments.lua | 23 +- .../new-config-nvim/lua/plugins/debugging.lua | 176 +++++++++++++ .../lua/plugins/formatting.lua | 5 +- .../new-config-nvim/lua/plugins/gitsigns.lua | 20 +- config/new-config-nvim/lua/plugins/lsp.lua | 21 +- .../new-config-nvim/lua/plugins/telescope.lua | 34 ++- .../lua/plugins/treesitter.lua | 116 ++++++++ .../new-config-nvim/lua/plugins/which-key.lua | 159 +++++------ 14 files changed, 507 insertions(+), 397 deletions(-) delete mode 100644 config/new-config-nvim/lua/plugins/_neo-tree.lua create mode 100644 config/new-config-nvim/lua/plugins/debugging.lua diff --git a/config/new-config-nvim/lazy-lock.json b/config/new-config-nvim/lazy-lock.json index d79b5f3..4c3a9f0 100644 --- a/config/new-config-nvim/lazy-lock.json +++ b/config/new-config-nvim/lazy-lock.json @@ -1,41 +1,50 @@ { - "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "LuaSnip": { "branch": "master", "commit": "878ace11983444d865a72e1759dbcc331d1ace4c" }, + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "ce0a05ab4e2839e1c48d072c5236cce846a387bc" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conform.nvim": { "branch": "master", "commit": "f3b930db4964d60e255c8f9e37b7f2218dfc08cb" }, - "copilot-lualine": { "branch": "main", "commit": "9e226cf8f4653e13ec282f5878d66aa435899c8c" }, - "copilot.vim": { "branch": "release", "commit": "53d3091be388ff1edacdb84421ccfa19a446a84d" }, - "fidget.nvim": { "branch": "main", "commit": "ef99df04a1c53a453602421bc0f756997edc8289" }, - "gitsigns.nvim": { "branch": "main", "commit": "75dc649106827183547d3bedd4602442340d2f7f" }, - "indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" }, - "lazy.nvim": { "branch": "main", "commit": "24fa2a97085ca8a7220b5b078916f81e316036fd" }, - "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "a4caa0d083aab56f6cd5acf2d42331b74614a585" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "c1fbdcb0d8d1295314f1612c4a247253e70299d9" }, - "mason.nvim": { "branch": "main", "commit": "f8ce8768f296717c72b3910eee7bd5ac5223cdb9" }, - "mini.indentscope": { "branch": "main", "commit": "f0d7faa064c892b96997810afcddfadc3f2a15b3" }, - "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" }, - "nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" }, - "nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" }, - "nvim-lint": { "branch": "master", "commit": "e19842a05aae484957ad20710444757bc0a61d63" }, - "nvim-lspconfig": { "branch": "master", "commit": "b124ef3bd4435a6db7ff03ea2f5a23e1e0487552" }, - "nvim-tree.lua": { "branch": "master", "commit": "5a87ffe35c4739ffb6b62052572583ad277a20ae" }, - "nvim-treesitter": { "branch": "master", "commit": "b7d50e59b1b2990b3ce8761d4cf595f4b71c87e2" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" }, - "nvim-web-devicons": { "branch": "master", "commit": "b77921fdc44833c994fdb389d658ccbce5490c16" }, - "oil.nvim": { "branch": "master", "commit": "2cb39e838e9dcd8b374f09a3a87a2e5ec9d372f6" }, + "conform.nvim": { "branch": "master", "commit": "25d48271e3d4404ba017cb92a37d3a681c1ad149" }, + "copilot-lualine": { "branch": "main", "commit": "4cca52f4d4d6c7439c51227d8054e346ef5ff0e0" }, + "copilot.vim": { "branch": "release", "commit": "25f73977033c597d530c7ab0e211d99b60927d2d" }, + "fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" }, + "gitsigns.nvim": { "branch": "main", "commit": "f4928ba14eb6c667786ac7d69927f6aee6719f1e" }, + "indent-blankline.nvim": { "branch": "master", "commit": "65e20ab94a26d0e14acac5049b8641336819dfc7" }, + "lazy.nvim": { "branch": "main", "commit": "c02268ac6e6aab92249d020d75efc588bd9d24fa" }, + "lualine.nvim": { "branch": "master", "commit": "544dd1583f9bb27b393f598475c89809c4d5e86b" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "58bc9119ca273c0ce5a66fad1927ef0f617bd81b" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "mini.indentscope": { "branch": "main", "commit": "1222393d9c5e8d92b913ccab6701a7164b21781c" }, + "nvim-autopairs": { "branch": "master", "commit": "e38c5d837e755ce186ae51d2c48e1b387c4425c6" }, + "nvim-cmp": { "branch": "main", "commit": "d818fd0624205b34e14888358037fb6f5dc51234" }, + "nvim-dap": { "branch": "master", "commit": "bc03b83c94d0375145ff5ac6a6dcf28c1241e06f" }, + "nvim-dap-ui": { "branch": "master", "commit": "a5606bc5958db86f8d92803bea7400ee26a8d7e4" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "484995d573c0f0563f6a66ebdd6c67b649489615" }, + "nvim-dap-vscode-js": { "branch": "main", "commit": "03bd29672d7fab5e515fc8469b7d07cc5994bbf6" }, + "nvim-lint": { "branch": "master", "commit": "efc6fc83f0772283e064c53a8f9fb5645bde0bc0" }, + "nvim-lspconfig": { "branch": "master", "commit": "fa6c2a64100c6f692bbec29bbbc8ec2663c9e869" }, + "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, + "nvim-tree.lua": { "branch": "master", "commit": "4e396b26244444c911b73e9f2f40ae0115351fd1" }, + "nvim-treesitter": { "branch": "master", "commit": "9d252d00210ed8d43197ef048daa94e6dc821bd6" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "6b5f95aa4d24f2c629a74f2c935c702b08dbde62" }, + "nvim-web-devicons": { "branch": "master", "commit": "e612de3d3a41a6b7be47f51e956dddabcbf419d9" }, + "oil.nvim": { "branch": "master", "commit": "71c972fbd218723a3c15afcb70421f67340f5a6d" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, - "telescope.nvim": { "branch": "master", "commit": "dfa230be84a044e7f546a6c2b0a403c739732b86" }, - "todo-comments.nvim": { "branch": "main", "commit": "e1549807066947818113a7d7ed48f637e49620d3" }, - "tokyonight.nvim": { "branch": "main", "commit": "0fae425aaab04a5f97666bd431b96f2f19c36935" }, + "schemastore.nvim": { "branch": "main", "commit": "4abc1ab13ad5031049864cba0bfaec06a908e7e5" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, + "telescope-live-grep-args.nvim": { "branch": "master", "commit": "8ad632f793fd437865f99af5684f78300dac93fb" }, + "telescope.nvim": { "branch": "master", "commit": "79552ef8488cb492e0f9d2bf3b4e808f57515e35" }, + "todo-comments.nvim": { "branch": "main", "commit": "8f45f353dc3649cb9b44cecda96827ea88128584" }, + "tokyonight.nvim": { "branch": "main", "commit": "6c30395146c246055ac3cea32d39d6b9876a1dcc" }, + "ts-error-translator.nvim": { "branch": "main", "commit": "11ae55b28bde02663b5f983f59b0e3fd9c4e845b" }, "typescript.nvim": { "branch": "main", "commit": "4de85ef699d7e6010528dcfbddc2ed4c2c421467" }, - "vim-CtrlXA": { "branch": "master", "commit": "d5c463d7a9b1249b3ecc03f796639fadf391c05f" }, - "vim-fugitive": { "branch": "master", "commit": "4f59455d2388e113bd510e85b310d15b9228ca0d" }, + "vim-CtrlXA": { "branch": "master", "commit": "084d00284f532eab511a771f21a184d2024a9e46" }, + "vim-fugitive": { "branch": "master", "commit": "0444df68cd1cdabc7453d6bd84099458327e5513" }, "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, - "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } -} \ No newline at end of file + "vscode-js-debug": { "branch": "main", "commit": "6e34748cc8987e36a5033899ef1c8225a4b4f99a" }, + "which-key.nvim": { "branch": "main", "commit": "c1b062ae95c3ca3e6eb87c075da991523605d79b" } +} diff --git a/config/new-config-nvim/lua/lazy-bootstrap.lua b/config/new-config-nvim/lua/lazy-bootstrap.lua index a745ae9..c0e7a9d 100644 --- a/config/new-config-nvim/lua/lazy-bootstrap.lua +++ b/config/new-config-nvim/lua/lazy-bootstrap.lua @@ -3,6 +3,15 @@ local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then local lazyrepo = "https://github.com/folke/lazy.nvim.git" - vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end end ---@diagnostic disable-next-line: undefined-field vim.opt.rtp:prepend(lazypath) diff --git a/config/new-config-nvim/lua/lazy-plugins.lua b/config/new-config-nvim/lua/lazy-plugins.lua index bed4724..b790d2f 100644 --- a/config/new-config-nvim/lua/lazy-plugins.lua +++ b/config/new-config-nvim/lua/lazy-plugins.lua @@ -8,7 +8,6 @@ -- To update plugins you can run -- :Lazy update -- --- NOTE: Here is where you install your plugins. -- TODO: I can use require("lazy").setup("plugins") to install all plugins in the plugins directory -- migrate all config to files require("lazy").setup({ @@ -24,6 +23,7 @@ require("lazy").setup({ require("plugins/ctrlxa"), require("plugins/which-key"), require("plugins/oil"), + require("plugins/treesitter"), -- UI related plugins require("plugins/indentline"), -- show indent lines and highlight curent indent level @@ -45,8 +45,9 @@ require("lazy").setup({ require("plugins/lsp"), require("plugins/linting"), require("plugins/formatting"), - - require("plugins/treesitter"), + require("plugins/debugging"), + -- better TS errors + { "dmmulroy/ts-error-translator.nvim", opts = {} }, require("plugins/copilot"), diff --git a/config/new-config-nvim/lua/options.lua b/config/new-config-nvim/lua/options.lua index ec534c7..b9deddb 100644 --- a/config/new-config-nvim/lua/options.lua +++ b/config/new-config-nvim/lua/options.lua @@ -2,7 +2,7 @@ -- See `:help vim.opt` -- For more options, you can see `:help option-list` -local numWidth = 6 +local numWidth = 5 local options = { -- set term gui colors (most terminals support this) @@ -77,8 +77,9 @@ local options = { -- splitbelow = false, -- force all horizontal splits to go below current window -- splitright = false, -- force all vertical splits to go to the right of current window - - foldmethod = "syntax", -- config for automatic folds + -- foldmethod = "expr", + -- foldexpr = "nvim_treesitter#foldexpr()", + -- foldmethod = "syntax", -- config for automatic folds foldlevelstart = 99, -- start with all folds open foldcolumn = "auto", -- show fold column diff --git a/config/new-config-nvim/lua/plugins/_neo-tree.lua b/config/new-config-nvim/lua/plugins/_neo-tree.lua deleted file mode 100644 index 7e4aa3c..0000000 --- a/config/new-config-nvim/lua/plugins/_neo-tree.lua +++ /dev/null @@ -1,249 +0,0 @@ --- TODO: consider replacing nvim-tree with this plugin -return { - { - "nvim-neo-tree/neo-tree.nvim", - branch = "v3.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - -- "MunifTanjim/nui.nvim", - -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information - }, - config = function() - require("neo-tree").setup({ - close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab - popup_border_style = "rounded", - enable_git_status = true, - enable_diagnostics = true, - open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes - sort_case_insensitive = false, -- used when sorting files and directories in the tree - sort_function = nil, -- use a custom function for sorting files and directories in the tree - -- sort_function = function (a,b) - -- if a.type == b.type then - -- return a.path > b.path - -- else - -- return a.type > b.type - -- end - -- end , -- this sorts files and directories descendantly - default_component_configs = { - container = { - enable_character_fade = true, - }, - indent = { - indent_size = 2, - padding = 1, -- extra padding on left hand side - -- indent guides - with_markers = true, - indent_marker = "│", - last_indent_marker = "└", - highlight = "NeoTreeIndentMarker", - -- expander config, needed for nesting files - with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders - expander_collapsed = "", - expander_expanded = "", - expander_highlight = "NeoTreeExpander", - }, - icon = { - folder_closed = "", - folder_open = "", - folder_empty = "", - -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there - -- then these will never be used. - default = "*", - highlight = "NeoTreeFileIcon", - }, - modified = { - symbol = "[+]", - highlight = "NeoTreeModified", - }, - name = { - trailing_slash = false, - use_git_status_colors = true, - highlight = "NeoTreeFileName", - }, - git_status = { - symbols = { - -- Change type - added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name - modified = "", -- or "", but this is redundant info if you use git_status_colors on the name - deleted = "✖", -- this can only be used in the git_status source - renamed = "󰁕", -- this can only be used in the git_status source - -- Status type - untracked = "", - ignored = "", - unstaged = "󰄱", - staged = "", - conflict = "", - }, - }, - -- If you don't want to use these columns, you can set `enabled = false` for each of them individually - file_size = { - enabled = true, - required_width = 64, -- min width of window required to show this column - }, - type = { - enabled = true, - required_width = 122, -- min width of window required to show this column - }, - last_modified = { - enabled = false, - required_width = 88, -- min width of window required to show this column - }, - created = { - enabled = false, - required_width = 110, -- min width of window required to show this column - }, - symlink_target = { - enabled = false, - }, - }, - -- A list of functions, each representing a global custom command - -- that will be available in all sources (if not overridden in `opts[source_name].commands`) - -- see `:h neo-tree-custom-commands-global` - commands = {}, - window = { - position = "left", - width = 50, - mapping_options = { - noremap = true, - nowait = true, - }, - mappings = { - [""] = { - "toggle_node", - nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use - }, - ["<2-LeftMouse>"] = "open", - [""] = "open", - [""] = "cancel", -- close preview or floating neo-tree window - ["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } }, - -- Read `# Preview Mode` for more information - ["l"] = "focus_preview", - ["S"] = "open_split", - ["s"] = "open_vsplit", - -- ["S"] = "split_with_window_picker", - -- ["s"] = "vsplit_with_window_picker", - ["t"] = "open_tabnew", - -- [""] = "open_drop", - -- ["t"] = "open_tab_drop", - ["w"] = "open_with_window_picker", - --["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing - ["C"] = "close_node", - -- ['C'] = 'close_all_subnodes', - ["z"] = "close_all_nodes", - --["Z"] = "expand_all_nodes", - ["a"] = { - "add", - -- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details - -- some commands may take optional config options, see `:h neo-tree-mappings` for details - config = { - show_path = "none", -- "none", "relative", "absolute" - }, - }, - ["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion. - ["d"] = "delete", - ["r"] = "rename", - ["y"] = "copy_to_clipboard", - ["x"] = "cut_to_clipboard", - ["p"] = "paste_from_clipboard", - ["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add": - -- ["c"] = { - -- "copy", - -- config = { - -- show_path = "none" -- "none", "relative", "absolute" - -- } - --} - ["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add". - ["q"] = "close_window", - ["R"] = "refresh", - ["?"] = "show_help", - ["<"] = "prev_source", - [">"] = "next_source", - ["i"] = "show_file_details", - }, - }, - nesting_rules = {}, - filesystem = { - filtered_items = { - visible = false, -- when true, they will just be displayed differently than normal items - hide_dotfiles = true, - hide_gitignored = true, - hide_hidden = true, -- only works on Windows for hidden files/directories - hide_by_name = { - --"node_modules" - }, - hide_by_pattern = { -- uses glob style patterns - --"*.meta", - --"*/src/*/tsconfig.json", - }, - always_show = { -- remains visible even if other settings would normally hide it - --".gitignored", - }, - never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show - --".DS_Store", - --"thumbs.db" - }, - never_show_by_pattern = { -- uses glob style patterns - --".null-ls_*", - }, - }, - follow_current_file = { - enabled = false, -- This will find and focus the file in the active buffer every time - -- -- the current file is changed while the tree is open. - leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` - }, - group_empty_dirs = false, -- when true, empty folders will be grouped together - hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree - -- in whatever position is specified in window.position - -- "open_current", -- netrw disabled, opening a directory opens within the - -- window like netrw would, regardless of window.position - -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs - use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes - -- instead of relying on nvim autocmd events. - window = { - mappings = { - [""] = "navigate_up", - ["."] = "set_root", - ["H"] = "toggle_hidden", - ["/"] = "fuzzy_finder", - ["D"] = "fuzzy_finder_directory", - ["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm - -- ["D"] = "fuzzy_sorter_directory", - ["f"] = "filter_on_submit", - [""] = "clear_filter", - ["[g"] = "prev_git_modified", - ["]g"] = "next_git_modified", - ["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } }, - ["oc"] = { "order_by_created", nowait = false }, - ["od"] = { "order_by_diagnostics", nowait = false }, - ["og"] = { "order_by_git_status", nowait = false }, - ["om"] = { "order_by_modified", nowait = false }, - ["on"] = { "order_by_name", nowait = false }, - ["os"] = { "order_by_size", nowait = false }, - ["ot"] = { "order_by_type", nowait = false }, - -- [''] = function(state) ... end, - }, - fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode - [""] = "move_cursor_down", - [""] = "move_cursor_down", - [""] = "move_cursor_up", - [""] = "move_cursor_up", - -- [''] = function(state, scroll_padding) ... end, - }, - }, - - commands = {}, -- Add a custom command or override a global one using the same function name - }, - buffers = { - follow_current_file = { - enabled = true, -- This will find and focus the file in the active buffer every time - -- -- the current file is changed while the tree is open. - leave_dirs_open = true, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` - }, - group_empty_dirs = true, -- when true, empty folders will be grouped together - show_unloaded = true, - }, - }) - end, - }, -} diff --git a/config/new-config-nvim/lua/plugins/colorscheme.lua b/config/new-config-nvim/lua/plugins/colorscheme.lua index 49103ef..4fabae1 100644 --- a/config/new-config-nvim/lua/plugins/colorscheme.lua +++ b/config/new-config-nvim/lua/plugins/colorscheme.lua @@ -10,7 +10,8 @@ return { -- 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") + vim.cmd.colorscheme("tokyonight-storm") + -- vim.cmd.colorscheme("zellner") -- You can configure highlights by doing something like: vim.cmd.hi("Comment gui=none") diff --git a/config/new-config-nvim/lua/plugins/comments.lua b/config/new-config-nvim/lua/plugins/comments.lua index b030d83..c51bd3f 100644 --- a/config/new-config-nvim/lua/plugins/comments.lua +++ b/config/new-config-nvim/lua/plugins/comments.lua @@ -1,21 +1,26 @@ return { - { - "folke/ts-comments.nvim", - opts = {}, - event = "VeryLazy", - enabled = vim.fn.has("nvim-0.10.0") == 1, - }, + -- This works only for line comments, not block comments, I still find original commenting better + -- { + -- "folke/ts-comments.nvim", + -- opts = {}, + -- event = "VeryLazy", + -- enabled = vim.fn.has("nvim-0.10.0") == 1, + -- }, -- Use this in older VIM verisions - -- TODO: delete once I migrate to nvim 0.10.0 { "numToStr/Comment.nvim", opts = {}, - enabled = vim.fn.has("nvim-0.10.0") == 0, + config = function() + require("Comment").setup({ + pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(), + }) + end, + -- enabled = vim.fn.has("nvim-0.10.0") == 0, dependencies = { "JoosepAlviste/nvim-ts-context-commentstring" }, }, { "JoosepAlviste/nvim-ts-context-commentstring", opts = {}, - enabled = vim.fn.has("nvim-0.10.0") == 0, + -- enabled = vim.fn.has("nvim-0.10.0") == 0, }, } diff --git a/config/new-config-nvim/lua/plugins/debugging.lua b/config/new-config-nvim/lua/plugins/debugging.lua new file mode 100644 index 0000000..7043dc6 --- /dev/null +++ b/config/new-config-nvim/lua/plugins/debugging.lua @@ -0,0 +1,176 @@ +return { + { + "rcarriga/nvim-dap-ui", + lazy = true, + dependencies = { + "nvim-neotest/nvim-nio", + }, + }, + { + "mfussenegger/nvim-dap", + lazy = true, + dependencies = { + "rcarriga/nvim-dap-ui", + "theHamsta/nvim-dap-virtual-text", + "mxsdev/nvim-dap-vscode-js", + -- lazy spec to build "microsoft/vscode-js-debug" from source + { + "microsoft/vscode-js-debug", + version = "1.92.0", + build = "npm i && npm run compile vsDebugServerBundle && mv dist out", + }, + }, + config = function() + require("dap-vscode-js").setup({ + debugger_path = vim.fn.stdpath("data") .. "/lazy/vscode-js-debug", + adapters = { "pwa-node", "pwa-chrome", "node-terminal" }, + }) + + -- This function finds the closest jest.config.ts or jest.config.js file related to current file + -- and run test only for that file + local function find_closest_jest_config() + -- Get the full path of the current file in the active buffer + local file = vim.fn.expand("%:p") + + -- Check if the file is within a 'libs' or 'apps' directory + if string.find(file, "/libs/") or string.find(file, "/apps/") then + -- Extract the path up to the project directory (e.g., 'libs/one-lib/') + local project_dir = string.match(file, "(.-/[^/]+/)src") + if project_dir then + -- Return the path to the jest.config.ts or jest.config.js in the project directory + local jest_config_ts = project_dir .. "jest.config.ts" + local jest_config_js = project_dir .. "jest.config.js" + if vim.fn.filereadable(jest_config_ts) == 1 then + return jest_config_ts + elseif vim.fn.filereadable(jest_config_js) == 1 then + return jest_config_js + end + end + end + + -- Fallback to the jest.config.ts or jest.config.js in the root directory + local root_jest_config_ts = vim.fn.getcwd() .. "/jest.config.ts" + local root_jest_config_js = vim.fn.getcwd() .. "/jest.config.js" + if vim.fn.filereadable(root_jest_config_ts) == 1 then + return root_jest_config_ts + elseif vim.fn.filereadable(root_jest_config_js) == 1 then + return root_jest_config_js + end + + -- If no jest.config is found, return nil + return nil + end + + for _, language in ipairs({ "typescript", "javascript", "typescriptreact", "javascriptreact" }) do + require("dap").configurations[language] = { + { + type = "pwa-node", + request = "launch", + name = "Debug Jest Tests", + runtimeExecutable = "node", + runtimeArgs = { + "./node_modules/jest/bin/jest.js", + "--runInBand", + "--config=" .. find_closest_jest_config(), + -- Run only tests for the current file, will match either test file directly or if the source file has same name as test file + "--testPathPattern=" .. vim.fn.expand("%:t:r"), + }, + rootPath = "${workspaceFolder}", + cwd = "${workspaceFolder}", + console = "integratedTerminal", + internalConsoleOptions = "neverOpen", + }, + { + type = "pwa-chrome", + name = "Launch Chrome to debug React on port 3000", + request = "launch", + url = "http://localhost:3000", + sourceMaps = true, + protocol = "inspector", + port = 9222, + webRoot = "${workspaceFolder}/src", + -- skip files from vite's hmr + skipFiles = { "**/node_modules/**/*", "**/@vite/*", "**/src/client/*", "**/src/*" }, + }, + { + type = "pwa-chrome", + name = "Launch Chrome to debug MMM app", + request = "launch", + url = "http://localhost:8020", + sourceMaps = true, + protocol = "inspector", + port = 9222, + webRoot = "${workspaceFolder}/src", + -- skip files from vite's hmr + skipFiles = { "**/node_modules/**/*", "**/@vite/*", "**/src/client/*", "**/src/*" }, + }, + -- attach to a node process that has been started with + -- `--inspect` for longrunning tasks or `--inspect-brk` for short tasks + -- npm script -> `node --inspect-brk ./node_modules/.bin/vite dev` + -- TODO: not implemented yet + -- { + -- -- use nvim-dap-vscode-js's pwa-node debug adapter + -- type = "pwa-node", + -- -- attach to an already running node process with --inspect flag + -- -- default port: 9222 + -- request = "attach", + -- -- allows us to pick the process using a picker + -- processId = require("dap.utils").pick_process, + -- -- name of the debug action you have to select for this config + -- name = "Attach debugger to existing `node --inspect` process", + -- -- for compiled languages like TypeScript or Svelte.js + -- sourceMaps = true, + -- -- resolve source maps in nested locations while ignoring node_modules + -- resolveSourceMapLocations = { + -- "${workspaceFolder}/**", + -- "!**/node_modules/**", + -- }, + -- -- path to src in vite based projects (and most other projects as well) + -- cwd = "${workspaceFolder}/src", + -- -- we don't want to debug code inside node_modules, so skip it! + -- skipFiles = { "${workspaceFolder}/node_modules/**/*.js" }, + -- }, + -- { + -- type = "pwa-node", + -- request = "launch", + -- name = "Debug Vitest Tests _TODO", + -- -- trace = true, -- include debugger info + -- runtimeExecutable = "node", + -- runtimeArgs = { + -- "./node_modules/jest/bin/jest.js", + -- "--runInBand", + -- }, + -- rootPath = "${workspaceFolder}", + -- cwd = "${workspaceFolder}", + -- console = "integratedTerminal", + -- internalConsoleOptions = "neverOpen", + -- }, + -- only if language is javascript, offer this debug action + language == "javascript" + and { + -- use nvim-dap-vscode-js's pwa-node debug adapter + type = "pwa-node", + -- launch a new process to attach the debugger to + request = "launch", + -- name of the debug action you have to select for this config + name = "Launch file in new node process", + -- launch current file + program = "${file}", + cwd = "${workspaceFolder}", + } + or nil, + } + end + + require("dapui").setup() + require("nvim-dap-virtual-text").setup() + + local dap, dapui = require("dap"), require("dapui") + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open({ reset = true }) + end + dap.listeners.before.event_terminated["dapui_config"] = dapui.close + dap.listeners.before.event_exited["dapui_config"] = dapui.close + end, + }, +} diff --git a/config/new-config-nvim/lua/plugins/formatting.lua b/config/new-config-nvim/lua/plugins/formatting.lua index ff145b9..7980497 100644 --- a/config/new-config-nvim/lua/plugins/formatting.lua +++ b/config/new-config-nvim/lua/plugins/formatting.lua @@ -4,7 +4,7 @@ return { event = { "BufWritePre" }, config = function() local conform = require("conform") - local prettier_fmts = { { "prettierd", "prettier" } } + local prettier_fmts = { "prettierd", "prettier", stop_after_first = true, quiet = true } conform.setup({ formatters_by_ft = { @@ -30,7 +30,8 @@ return { end return { timeout_ms = 500, lsp_fallback = true } end, - notify_on_error = true, + notify_on_error = false, + notify_no_formatters = true, }) -- TODO: change keybinding diff --git a/config/new-config-nvim/lua/plugins/gitsigns.lua b/config/new-config-nvim/lua/plugins/gitsigns.lua index 04fd72a..a9dd406 100644 --- a/config/new-config-nvim/lua/plugins/gitsigns.lua +++ b/config/new-config-nvim/lua/plugins/gitsigns.lua @@ -1,33 +1,27 @@ return { { "lewis6991/gitsigns.nvim", + event = "VeryLazy", opts = { signs = { - add = { hl = "GitSignsAdd", text = "+", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, - change = { hl = "GitSignsChange", text = "~", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, - delete = { hl = "GitSignsDelete", text = "-", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, + add = { text = "+" }, + change = { text = "~" }, + delete = { text = "-" }, topdelete = { - hl = "GitSignsDelete", text = "^^", - numhl = "GitSignsDeleteNr", - linehl = "GitSignsDeleteLn", }, changedelete = { - hl = "GitSignsChange", text = "▎", - numhl = "GitSignsChangeNr", - linehl = "GitSignsChangeLn", }, -- untracked = { hl = "GitSignsAdd", text = "▎" }, - untracked = { hl = "GitSignsAdd", text = "│" }, + untracked = { text = "│" }, }, + signs_staged_enable = false, signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` numhl = false, -- Toggle with `:Gitsigns toggle_numhl` linehl = false, -- Toggle with `:Gitsigns toggle_linehl` word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` - current_line_blame_formatter_opts = { - relative_time = false, - }, + current_line_blame_formatter = ', - ', }, }, } diff --git a/config/new-config-nvim/lua/plugins/lsp.lua b/config/new-config-nvim/lua/plugins/lsp.lua index b1f6aff..30f313e 100644 --- a/config/new-config-nvim/lua/plugins/lsp.lua +++ b/config/new-config-nvim/lua/plugins/lsp.lua @@ -5,13 +5,10 @@ return { "williamboman/mason.nvim", -- TODO: Try nvim-notify instead { "j-hui/fidget.nvim", opts = {} }, - - -- `neodev` configures Lua LSP for your Neovim config, runtime and plugins - -- used for completion, annotations and signatures of Neovim apis - { "folke/neodev.nvim", opts = {} }, "hrsh7th/nvim-cmp", "hrsh7th/cmp-nvim-lsp", "jose-elias-alvarez/typescript.nvim", + "b0o/schemastore.nvim", }, opts = { -- Enable this to enable the builtin LSP inlay hints on Neovim >= 0.10.0 @@ -284,6 +281,22 @@ return { }, }) end, + ["jsonls"] = function() + lspconfig["jsonls"].setup({ + capabilities = capabilities, + settings = { + json = { + schemas = require("schemastore").json.schemas({ + -- select = { + -- "Renovate", + -- "GitHub Workflow Template Properties", + -- }, + }), + validate = { enable = true }, + }, + }, + }) + end, }) end, }, diff --git a/config/new-config-nvim/lua/plugins/telescope.lua b/config/new-config-nvim/lua/plugins/telescope.lua index 079c5bf..51ed6bc 100644 --- a/config/new-config-nvim/lua/plugins/telescope.lua +++ b/config/new-config-nvim/lua/plugins/telescope.lua @@ -17,6 +17,9 @@ return { return vim.fn.executable("make") == 1 end, }, + { + "nvim-telescope/telescope-live-grep-args.nvim", + }, -- TODO: what this do? -- { 'nvim-telescope/telescope-ui-select.nvim' }, @@ -24,6 +27,7 @@ return { { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font }, }, config = function() + local lga_actions = require("telescope-live-grep-args.actions") require("telescope").setup({ defaults = { prompt_prefix = "󰅂 ", @@ -48,6 +52,19 @@ return { find_command = { "fd", "--type", "f", "-H" }, }, }, + extensions = { + live_grep_args = { + auto_quoting = true, -- enable/disable auto-quoting + mappings = { -- extend mappings + i = { + [""] = lga_actions.quote_prompt(), + -- [""] = lga_actions.quote_prompt({ postfix = " --iglob " }), + -- freeze the current list and start a fuzzy search in the frozen list + -- [""] = actions.to_fuzzy_refine, + }, + }, + }, + }, -- extensions = { -- ["ui-select"] = { -- require("telescope.themes").get_dropdown(), @@ -57,6 +74,7 @@ return { -- Enable Telescope extensions if they are installed pcall(require("telescope").load_extension, "fzf") + pcall(require("telescope").load_extension, "live_grep_args") -- pcall(require("telescope").load_extension, "ui-select") -- See `:help telescope.builtin` @@ -66,15 +84,21 @@ return { builtin.buffers({ sort_mru = true, sort_lastused = false }) end, { desc = "Find existing b[U]ffers" }) vim.keymap.set("n", "f", builtin.find_files, { desc = "[S]earch [F]iles" }) - vim.keymap.set("n", "e", builtin.live_grep, { desc = "[S]earch by [G]rep" }) + vim.keymap.set( + "n", + "e", + require("telescope").extensions.live_grep_args.live_grep_args, + { desc = "[S]earch by [G]rep" } + ) -- Slightly advanced example of overriding default behavior and theme vim.keymap.set("n", "/", function() -- You can pass additional configuration to Telescope to change the theme, layout, etc. - builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ - winblend = 10, - previewer = false, - })) + -- builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ + -- winblend = 10, + -- previewer = false, + -- })) + builtin.current_buffer_fuzzy_find() end, { desc = "[/] Fuzzily search in current buffer" }) -- Shortcut for searching your Neovim configuration files diff --git a/config/new-config-nvim/lua/plugins/treesitter.lua b/config/new-config-nvim/lua/plugins/treesitter.lua index e9a710b..ebb5f37 100644 --- a/config/new-config-nvim/lua/plugins/treesitter.lua +++ b/config/new-config-nvim/lua/plugins/treesitter.lua @@ -58,4 +58,120 @@ return { -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects end, }, + { + "nvim-treesitter/nvim-treesitter-textobjects", + event = "VeryLazy", + enabled = true, + config = function() + local opts = { + textobjects = { + select = { + enable = true, + -- Automatically jump forward to textobj, similar to targets.vim + lookahead = true, + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + -- You can optionally set descriptions to the mappings (used in the desc parameter of + -- nvim_buf_set_keymap) which plugins like which-key display + ["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" }, + -- You can also use captures from other query groups like `locals.scm` + ["as"] = { query = "@scope", query_group = "locals", desc = "Select language scope" }, + }, + -- -- You can choose the select mode (default is charwise 'v') + -- -- + -- -- Can also be a function which gets passed a table with the keys + -- -- * query_string: eg '@function.inner' + -- -- * method: eg 'v' or 'o' + -- -- and should return the mode ('v', 'V', or '') or a table + -- -- mapping query_strings to modes. + -- selection_modes = { + -- ["@parameter.outer"] = "v", -- charwise + -- ["@function.outer"] = "V", -- linewise + -- ["@class.outer"] = "", -- blockwise + -- }, + -- -- If you set this to `true` (default is `false`) then any textobject is + -- -- extended to include preceding or succeeding whitespace. Succeeding + -- -- whitespace has priority in order to act similarly to eg the built-in + -- -- `ap`. + -- -- + -- -- Can also be a function which gets passed a table with the keys + -- -- * query_string: eg '@function.inner' + -- -- * selection_mode: eg 'v' + -- -- and should return true or false + -- include_surrounding_whitespace = true, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + ["]m"] = "@function.outer", + -- ["]]"] = { query = "@class.outer", desc = "Next class start" }, + -- -- + -- -- You can use regex matching (i.e. lua pattern) and/or pass a list in a "query" key to group multiple queires. + -- ["]o"] = "@loop.*", + -- -- ["]o"] = { query = { "@loop.inner", "@loop.outer" } } + -- -- + -- -- You can pass a query group to use query from `queries//.scm file in your runtime path. + -- -- Below example nvim-treesitter's `locals.scm` and `folds.scm`. They also provide highlights.scm and indent.scm. + -- ["]s"] = { query = "@scope", query_group = "locals", desc = "Next scope" }, + -- ["]z"] = { query = "@fold", query_group = "folds", desc = "Next fold" }, + }, + goto_next_end = { + ["]M"] = "@function.outer", + -- ["]["] = "@class.outer", + }, + goto_previous_start = { + ["[m"] = "@function.outer", + -- ["[["] = "@class.outer", + }, + goto_previous_end = { + ["[M"] = "@function.outer", + -- ["[]"] = "@class.outer", + }, + -- -- Below will go to either the start or the end, whichever is closer. + -- -- Use if you want more granular movements + -- -- Make it even more gradual by adding multiple queries and regex. + -- goto_next = { + -- ["]d"] = "@conditional.outer", + -- }, + -- goto_previous = { + -- ["[d"] = "@conditional.outer", + -- }, + }, + swap = { + enable = true, + swap_next = { + ["a"] = "@parameter.inner", + }, + swap_previous = { + ["A"] = "@parameter.inner", + }, + }, + }, + } + require("nvim-treesitter.configs").setup(opts) + end, + }, + -- { + -- "nvim-treesitter/nvim-treesitter-context", + -- config = function() + -- require("treesitter-context").setup({ + -- enable = false, -- Enable this plugin (Can be enabled/disabled later via commands) + -- max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. + -- min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit. + -- line_numbers = true, + -- multiline_threshold = 5, -- Maximum number of lines to show for a single context + -- trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' + -- mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline' + -- -- Separator between context and content. Should be a single character string, like '-'. + -- -- When separator is set, the context will only show up when there are at least 2 lines above cursorline. + -- separator = nil, + -- zindex = 20, -- The Z-index of the context window + -- on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching + -- }) + -- end, + -- }, } diff --git a/config/new-config-nvim/lua/plugins/which-key.lua b/config/new-config-nvim/lua/plugins/which-key.lua index 9391d27..7029ab8 100644 --- a/config/new-config-nvim/lua/plugins/which-key.lua +++ b/config/new-config-nvim/lua/plugins/which-key.lua @@ -1,7 +1,7 @@ return { { "folke/which-key.nvim", - event = "VimEnter", -- Sets the loading event to 'VimEnter' + event = "VeryLazy", -- Sets the loading event to 'VimEnter' config = function() -- This is the function that runs, AFTER loading require("which-key").setup({ plugins = { @@ -21,16 +21,12 @@ return { separator = "➜", -- symbol used between a key and it's label group = "+", -- symbol prepended to a group }, - popup_mappings = { - scroll_down = "", -- binding to scroll down inside the popup - scroll_up = "", -- binding to scroll up inside the popup - }, - window = { + win = { border = "none", -- none, single, double, shadow - position = "bottom", -- bottom, top - margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left] - padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left] - winblend = 0, + padding = { 2, 2 }, -- extra window padding [top, right, bottom, left] + wo = { + winblend = 0, + }, }, layout = { height = { min = 5, max = 25 }, -- min and max height of the columns @@ -38,14 +34,18 @@ return { spacing = 10, -- spacing between columns align = "left", -- align columns left, center or right }, - ignore_missing = true, -- enable this to hide mappings for which you didn't specify a label - hidden = { "", "", "", "", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate - show_help = true, -- show help message on the command line when the popup is visible - triggers = "auto", -- automatically setup triggers, use `triggers = {""}` to specify list manually - triggers_blacklist = { - i = { "j", "k" }, - v = { "j", "k" }, + filter = function(mapping) + -- example to exclude mappings without a description + -- return mapping.desc and mapping.desc ~= "" + return true + end, + triggers = { + { "", mode = "no" }, + { "", mode = { "n", "v" } }, }, + delay = 400, + show_help = true, -- show help message on the command line when the popup is visible + notify = true, }) -- Document existing key chains @@ -62,70 +62,80 @@ return { local builtin = require("telescope.builtin") - require("which-key").register({ - ["g"] = { - name = "[G]it", - b = { "lua require 'gitsigns'.blame_line()", "Blame" }, - l = { "lua require 'gitsigns'.toggle_current_line_blame()", "Toggle line git blame" }, - j = { "lua require 'gitsigns'.next_hunk()", "Go to next hunk" }, - k = { "lua require 'gitsigns'.prev_hunk()", "Go to prev hunk" }, - p = { "lua require 'gitsigns'.preview_hunk()", "Preview hunk" }, - r = { "lua require 'gitsigns'.reset_hunk()", "Reset Hunk" }, - R = { "lua require 'gitsigns'.reset_buffer()", "Reset Buffer" }, - a = { "lua require 'gitsigns'.stage_hunk()", "Stage Hunk" }, - A = { "lua require 'gitsigns'.stage_buffer()", "Stage file" }, - u = { - "lua require 'gitsigns'.undo_stage_hunk()", - "Undo Stage Hunk", - }, - s = { "vert G", "Git status..." }, - d = { - "Gitsigns diffthis HEAD", - "Diff", - }, - }, - ["t"] = { - name = "[T]ests", - r = { "lua require('neotest').run.run()", "Run nearest test" }, - d = { "lua require('neotest').run.run({strategy = 'dap'})", "Debug test" }, - f = { "lua require('neotest').run.run(vim.fn.expand('%'))", "Run all tests in file" }, - s = { "lua require('neotest').summary.toggle()", "Toggle test summary" }, - o = { "lua require('neotest').output.open({enter = true})", "Open test output" }, - w = { "lua require('neotest').watch.toggle(vim.fn.expand('%'))", "Watch file" }, - ["[e"] = { - "lua require('neotest').jump.prev({ status = 'failed' })", - "Jump to prev failed", + require("which-key").add({ + { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", }, - ["]e"] = { - "lua require('neotest').jump.next({ status = 'failed' })", - "Jump to next failed", + -- + -- GIT GROUP + { "g", group = "[G]it" }, + { "gA", "lua require 'gitsigns'.stage_buffer()", desc = "Stage file" }, + { "gR", "lua require 'gitsigns'.reset_buffer()", desc = "Reset Buffer" }, + { "ga", "lua require 'gitsigns'.stage_hunk()", desc = "Stage Hunk" }, + { "gb", "lua require 'gitsigns'.blame_line()", desc = "Blame" }, + { "gd", "Gitsigns diffthis HEAD", desc = "Diff" }, + { "gj", "lua require 'gitsigns'.next_hunk()", desc = "Go to next hunk" }, + { "gk", "lua require 'gitsigns'.prev_hunk()", desc = "Go to prev hunk" }, + { + "gl", + "lua require 'gitsigns'.toggle_current_line_blame()", + desc = "Toggle line git blame", }, - }, - ["w"] = { - name = "Toggle", - f = { "FormatToggle", "Toggle file formatting" }, - }, - ["s"] = { - name = "[S]earch", - h = { builtin.help_tags, "[S]earch [H]elp" }, - o = { + { "gp", "lua require 'gitsigns'.preview_hunk()", desc = "Preview hunk" }, + { "gr", "lua require 'gitsigns'.reset_hunk()", desc = "Reset Hunk" }, + { "gs", "vert G", desc = "Git status..." }, + { "gu", "lua require 'gitsigns'.undo_stage_hunk()", desc = "Undo Stage Hunk" }, + -- + -- SEACH GROUP + { "s", group = "[S]earch" }, + { "sc", builtin.colorscheme, desc = "[S]earch [C]olorscheme" }, + { "sd", builtin.diagnostics, desc = "[S]earch [D]iagnostics" }, + { "sh", builtin.help_tags, desc = "[S]earch [H]elp" }, + { "sm", builtin.commands, desc = "[S]earch Co[M]mands" }, + { + "so", function() builtin.oldfiles({ cwd_only = true }) end, - "[S]earch [O]ldfiles", + desc = "[S]earch [O]ldfiles", }, - c = { builtin.colorscheme, "[S]earch [C]olorscheme" }, - d = { builtin.diagnostics, "[S]earch [D]iagnostics" }, - m = { builtin.commands, "[S]earch Co[M]mands" }, + -- + -- TEST GROUP + -- { "t", group = "[T]ests" }, + -- { "t[e", "lua require('neotest').jump.prev({ status = 'failed' })", desc = "Jump to prev failed", }, + -- { "t]e", "lua require('neotest').jump.next({ status = 'failed' })", desc = "Jump to next failed", }, + -- { "td", "lua require('neotest').run.run({strategy = 'dap'})", desc = "Debug test", }, + -- { "tf", "lua require('neotest').run.run(vim.fn.expand('%'))", desc = "Run all tests in file", }, + -- { "to", "lua require('neotest').output.open({enter = true})", desc = "Open test output", }, + -- { "tr", "lua require('neotest').run.run()", desc = "Run nearest test" }, + -- { "ts", "lua require('neotest').summary.toggle()", desc = "Toggle test summary" }, + -- { "tw", "lua require('neotest').watch.toggle(vim.fn.expand('%'))", desc = "Watch file", }, + + -- + -- TOGGLE SETTINGS GROUP + { "w", group = "Toggle" }, + { "wf", "FormatToggle", desc = "Toggle file formatting" }, + { "wt", "TSContextToggle", desc = "Toggle tree-sitter scope con[T]ext" }, }, - -- TODO: setup DAP first - -- d = { - -- name = "Debugging", - -- c = { "lua require'dap'.continue()", "Continue" }, - -- o = { "lua require'dap'.step_over()", "Step over" }, - -- i = { "lua require'dap'.step_into()", "Step into" }, - -- t = { "lua require'dap'.step_out()", "Step out" }, - -- b = { "lua require'dap'.toggle_breakpoint()", "Toggle breakpoint" }, + -- + -- BUFFER SETTINGS GROUP + -- { "b", group = "Toggle" }, + -- { "bd", "FormatToggle", desc = "Show document diagnostincs" }, + -- { "wt", "TSContextToggle", desc = "Show document symbols" }, + -- + -- DEBUGGING GROUP + { "d", group = "[D]ebugging" }, + { "db", "lua require'dap'.toggle_breakpoint()", desc = "Toggle breakpoint" }, + { "dc", "lua require'dap'.continue()", desc = "Continue" }, + { "do", "lua require'dap'.step_over()", desc = "Step over" }, + { "di", "lua require'dap'.step_into()", desc = "Step into" }, + { "dt", "lua require'dap'.step_out()", desc = "Step out" }, + -- -- q = { -- "lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))", -- "Set breakpoint with condition", @@ -136,7 +146,6 @@ return { -- }, -- p = { "lua require'dap'.repl.open()", "REPL open" }, -- r = { "lua require'dap'.run_last()", "Run last" }, - -- }, }, opts) end, },