From dde8649ef0f12381092482f23e8123d417239245 Mon Sep 17 00:00:00 2001 From: arnold-lei Date: Fri, 22 Sep 2023 13:43:55 -0600 Subject: [PATCH 01/22] made an update --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index ea330eb16f4..2d31b44bc9a 100644 --- a/init.lua +++ b/init.lua @@ -159,8 +159,8 @@ require('lazy').setup({ options = { icons_enabled = false, theme = 'onedark', - component_separators = '|', - section_separators = '', + -- component_separators = '|', + -- section_separators = '', }, }, }, From 0693fcf41d7f43a465b5bab557add09e14395cdc Mon Sep 17 00:00:00 2001 From: arnold-lei Date: Sun, 24 Sep 2023 23:14:26 -0600 Subject: [PATCH 02/22] configuring my own kickstart --- init.lua | 63 +++++++++-------------------------------- lua/arnoldlei/remap.lua | 49 ++++++++++++++++++++++++++++++++ lua/arnoldlei/set.lua | 27 ++++++++++++++++++ lua/plugins/harpoon.lua | 15 ++++++++++ 4 files changed, 104 insertions(+), 50 deletions(-) create mode 100644 lua/arnoldlei/remap.lua create mode 100644 lua/arnoldlei/set.lua create mode 100644 lua/plugins/harpoon.lua diff --git a/init.lua b/init.lua index 2d31b44bc9a..03e1b9cf701 100644 --- a/init.lua +++ b/init.lua @@ -1,48 +1,9 @@ ---[[ - -===================================================================== -==================== READ THIS BEFORE CONTINUING ==================== -===================================================================== - -Kickstart.nvim is *not* a distribution. - -Kickstart.nvim is a template 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 should start exploring, configuring and tinkering to - explore Neovim! - - If you don't know anything about Lua, I recommend taking some time to read through - a guide. One possible example: - - https://learnxinyminutes.com/docs/lua/ - - - And then you can explore or search through `:help lua-guide` - - https://neovim.io/doc/user/lua-guide.html - - -Kickstart Guide: - -I have left several `:help X` comments throughout the init.lua -You should run that command and read that help section for more information. - -In addition, I have some `NOTE:` items throughout the file. -These are for you, the reader to help 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 nvim config. - -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 required (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' - +vim.keymap.set("n", "gs", vim.cmd.Git) -- Install package manager -- https://github.com/folke/lazy.nvim -- `:help lazy.nvim.txt` for more info @@ -66,9 +27,9 @@ vim.opt.rtp:prepend(lazypath) -- as they will be available in your neovim runtime. require('lazy').setup({ -- NOTE: First, some plugins that don't require any configuration - + {import = "plugins"}, -- Git related plugins - 'tpope/vim-fugitive', + "tpope/vim-fugitive", 'tpope/vim-rhubarb', -- Detect tabstop and shiftwidth automatically @@ -143,14 +104,14 @@ require('lazy').setup({ }, { - -- Theme inspired by Atom - 'navarasu/onedark.nvim', - priority = 1000, + "folke/tokyonight.nvim", + lazy = false, -- make sure we load this during startup if it is your main colorscheme + priority = 1000, -- make sure to load this before all the other start plugins config = function() - vim.cmd.colorscheme 'onedark' + -- load the colorscheme here + vim.cmd([[colorscheme tokyonight]]) end, }, - { -- Set lualine as statusline 'nvim-lualine/lualine.nvim', @@ -313,10 +274,10 @@ vim.keymap.set('n', '/', function() }) end, { desc = '[/] Fuzzily search in current buffer' }) -vim.keymap.set('n', 'gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) -vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) +vim.keymap.set('n', '', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) +vim.keymap.set('n', '', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) -vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) +vim.keymap.set('n', '', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]resume' }) @@ -537,3 +498,5 @@ cmp.setup { -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et +require('arnoldlei.set') +require('arnoldlei.remap') diff --git a/lua/arnoldlei/remap.lua b/lua/arnoldlei/remap.lua new file mode 100644 index 00000000000..753b7481c66 --- /dev/null +++ b/lua/arnoldlei/remap.lua @@ -0,0 +1,49 @@ +vim.g.mapleader = " " +vim.keymap.set("n", "pv", vim.cmd.Ex) + +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +vim.keymap.set("n", "J", "mzJ`z") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") + +vim.keymap.set("n", "vwm", function() + require("vim-with-me").StartVimWithMe() +end) +vim.keymap.set("n", "svwm", function() + require("vim-with-me").StopVimWithMe() +end) + +-- greatest remap ever +vim.keymap.set("x", "p", [["_dP]]) + +-- next greatest remap ever : asbjornHaland +vim.keymap.set({"n", "v"}, "y", [["+y]]) +vim.keymap.set("n", "Y", [["+Y]]) + +vim.keymap.set({"n", "v"}, "d", [["_d]]) + +-- This is going to get me cancelled +vim.keymap.set("i", "", "") + +vim.keymap.set("n", "Q", "") +vim.keymap.set("n", "", "silent !tmux neww tmux-sessionizer") +vim.keymap.set("n", "f", vim.lsp.buf.format) + +vim.keymap.set("n", "", "cnextzz") +vim.keymap.set("n", "", "cprevzz") +vim.keymap.set("n", "k", "lnextzz") +vim.keymap.set("n", "j", "lprevzz") + +vim.keymap.set("n", "s", [[:%s/\<\>//gI]]) +vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) + +vim.keymap.set("n", "vpp", "e ~/.dotfiles/nvim/.config/nvim/lua/theprimeagen/packer.lua"); +vim.keymap.set("n", "mr", "CellularAutomaton make_it_rain"); + +vim.keymap.set("n", "", function() + vim.cmd("so") +end) diff --git a/lua/arnoldlei/set.lua b/lua/arnoldlei/set.lua new file mode 100644 index 00000000000..45aa63b650a --- /dev/null +++ b/lua/arnoldlei/set.lua @@ -0,0 +1,27 @@ +vim.opt.nu = true +vim.opt.relativenumber = true + +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true + +vim.opt.smartindent = true + +vim.opt.wrap = false + +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" +vim.opt.undofile = true + +-- vim.opt.hlsearch = false +-- vim.opt.incsearch = true + +vim.opt.termguicolors = true + +vim.opt.scrolloff = 8 +vim.opt.signcolumn = "yes" +vim.opt.isfname:append("@-@") + +vim.opt.colorcolumn = "80" diff --git a/lua/plugins/harpoon.lua b/lua/plugins/harpoon.lua new file mode 100644 index 00000000000..8590d6176fc --- /dev/null +++ b/lua/plugins/harpoon.lua @@ -0,0 +1,15 @@ +return { + "ThePrimeagen/harpoon", + lazy = false, + dependencies = { + "nvim-lua/plenary.nvim", + }, + config = true, + keys = { + { "a", "lua require('harpoon.mark').add_file()", desc = "Mark file with harpoon" }, + { "hn", "lua require('harpoon.ui').nav_next()", desc = "Go to next harpoon mark" }, + { "hp", "lua require('harpoon.ui').nav_prev()", desc = "Go to previous harpoon mark" }, + { "", "lua require('harpoon.ui').toggle_quick_menu()", desc = "Show harpoon marks" }, + }, +} + From c74e696c0f4d96a37210b4ae29a5eeb815d1d5f4 Mon Sep 17 00:00:00 2001 From: arnold-lei Date: Mon, 25 Sep 2023 08:13:50 -0600 Subject: [PATCH 03/22] removed some overlapping keymaps --- init.lua | 9 --------- 1 file changed, 9 deletions(-) diff --git a/init.lua b/init.lua index 03e1b9cf701..5a716928851 100644 --- a/init.lua +++ b/init.lua @@ -336,15 +336,6 @@ require('nvim-treesitter.configs').setup { ['[]'] = '@class.outer', }, }, - swap = { - enable = true, - swap_next = { - ['a'] = '@parameter.inner', - }, - swap_previous = { - ['A'] = '@parameter.inner', - }, - }, }, } From dd35967f311caeb013d46ba4f8f2370ddcb9b62e Mon Sep 17 00:00:00 2001 From: arnold-lei Date: Mon, 25 Sep 2023 22:14:48 -0600 Subject: [PATCH 04/22] added carbon theme --- init.lua | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/init.lua b/init.lua index 5a716928851..4712264040c 100644 --- a/init.lua +++ b/init.lua @@ -103,15 +103,26 @@ require('lazy').setup({ }, }, - { - "folke/tokyonight.nvim", - lazy = false, -- make sure we load this during startup if it is your main colorscheme - priority = 1000, -- make sure to load this before all the other start plugins + { + "nyoom-engineering/oxocarbon.nvim", config = function() - -- load the colorscheme here - vim.cmd([[colorscheme tokyonight]]) + vim.cmd([[colorscheme oxocarbon]]) end, + + -- Add in any other configuration; + -- event = foo, + -- config = bar + -- end, }, + -- { + -- "folke/tokyonight.nvim", + -- lazy = false, -- make sure we load this during startup if it is your main colorscheme + -- priority = 1000, -- make sure to load this before all the other start plugins + -- config = function() + -- -- load the colorscheme here + -- vim.cmd([[colorscheme tokyonight]]) + -- end, + -- }, { -- Set lualine as statusline 'nvim-lualine/lualine.nvim', @@ -119,9 +130,9 @@ require('lazy').setup({ opts = { options = { icons_enabled = false, - theme = 'onedark', - -- component_separators = '|', - -- section_separators = '', + theme = 'auto', + component_separators = '|', + section_separators = '', }, }, }, From a42e0f1408045888651eba95b22ffd744d0d5da7 Mon Sep 17 00:00:00 2001 From: Arnold Date: Tue, 26 Sep 2023 11:31:07 -0600 Subject: [PATCH 05/22] wip --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 4712264040c..12715d091d1 100644 --- a/init.lua +++ b/init.lua @@ -133,6 +133,8 @@ require('lazy').setup({ theme = 'auto', component_separators = '|', section_separators = '', + 'filename', + path=1, }, }, }, From 22e4dc74d06e7be97b33c71007fc5ae4bb1a216c Mon Sep 17 00:00:00 2001 From: Arnold Date: Tue, 26 Sep 2023 15:03:20 -0600 Subject: [PATCH 06/22] testing osme things --- .gitignore | 1 - init.lua | 3 +-- lazy-lock.json | 28 ++++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 lazy-lock.json diff --git a/.gitignore b/.gitignore index ea93edad490..d699e1d68cc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,3 @@ tags test.sh .luarc.json nvim -lazy-lock.json diff --git a/init.lua b/init.lua index 12715d091d1..bafcbf79831 100644 --- a/init.lua +++ b/init.lua @@ -108,7 +108,6 @@ require('lazy').setup({ config = function() vim.cmd([[colorscheme oxocarbon]]) end, - -- Add in any other configuration; -- event = foo, -- config = bar @@ -133,7 +132,7 @@ require('lazy').setup({ theme = 'auto', component_separators = '|', section_separators = '', - 'filename', + 'filename', path=1, }, }, diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 00000000000..75eb7854524 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,28 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "LuaSnip": { "branch": "master", "commit": "480b032f6708573334f4437d3f83307d143f1a72" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, + "friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" }, + "gitsigns.nvim": { "branch": "main", "commit": "bdeba1cec3faddd89146690c10b9a87949c0ee66" }, + "harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" }, + "indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" }, + "lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" }, + "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "2451adb9bdb0fd32140bf3aa8dbc17ff60050db3" }, + "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" }, + "neodev.nvim": { "branch": "main", "commit": "bb2dfd43dc8a25d3c1f69bcfdf05357f2397be6e" }, + "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, + "nvim-lspconfig": { "branch": "master", "commit": "bfdf2e91e7297a54bcc09d3e092a12bff69a1cf4" }, + "nvim-treesitter": { "branch": "master", "commit": "b5873bacb4ce44e0aac313abb28bb72e67fc9a53" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" }, + "oxocarbon.nvim": { "branch": "main", "commit": "b47c0ecab3a4270815afb3b05e03423b04cca8f2" }, + "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, + "vim-fugitive": { "branch": "master", "commit": "99db68d9b3304580bd383da7aaee05c7a954a344" }, + "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, + "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, + "which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" } +} \ No newline at end of file From f7565c3e450c7c0c56d5df0d784455d4161b270b Mon Sep 17 00:00:00 2001 From: arnold-lei Date: Tue, 26 Sep 2023 19:27:51 -0600 Subject: [PATCH 07/22] wip --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index ea93edad490..d699e1d68cc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,3 @@ tags test.sh .luarc.json nvim -lazy-lock.json From 99ccd8cc58750f970eb01ddc2097e34f956be80d Mon Sep 17 00:00:00 2001 From: Arnold Date: Wed, 27 Sep 2023 10:59:09 -0600 Subject: [PATCH 08/22] added telescope-ui-select --- init.lua | 11 ++++++++++- lazy-lock.json | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index bafcbf79831..f883aee89cb 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,4 @@ +-- TODO look into tmux sessionizer -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) @@ -31,7 +32,7 @@ require('lazy').setup({ -- Git related plugins "tpope/vim-fugitive", 'tpope/vim-rhubarb', - + 'f-person/git-blame.nvim', -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', @@ -158,6 +159,7 @@ require('lazy').setup({ branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim', + 'nvim-telescope/telescope-ui-select.nvim', -- Fuzzy Finder Algorithm which requires local dependencies to be built. -- Only load if `make` is available. Make sure you have the system -- requirements installed. @@ -275,6 +277,9 @@ require('telescope').setup { -- Enable telescope fzf native, if installed pcall(require('telescope').load_extension, 'fzf') +-- Enable telescope ui select +require("telescope").load_extension("ui-select") + -- See `:help telescope.builtin` vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) vim.keymap.set('n', '', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) @@ -302,6 +307,10 @@ require('nvim-treesitter.configs').setup { -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, + modules={}, + sync_install = false, + ignore_install = {}, + parser_install_dir = nil, highlight = { enable = true }, indent = { enable = true }, diff --git a/lazy-lock.json b/lazy-lock.json index 75eb7854524..942ce7ceb86 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -5,6 +5,7 @@ "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, "friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" }, + "git-blame.nvim": { "branch": "master", "commit": "a36b277e527f9d34efe16c3636555ce0e0c0464c" }, "gitsigns.nvim": { "branch": "main", "commit": "bdeba1cec3faddd89146690c10b9a87949c0ee66" }, "harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" }, "indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" }, @@ -20,6 +21,7 @@ "oxocarbon.nvim": { "branch": "main", "commit": "b47c0ecab3a4270815afb3b05e03423b04cca8f2" }, "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" }, "telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, "vim-fugitive": { "branch": "master", "commit": "99db68d9b3304580bd383da7aaee05c7a954a344" }, "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, From c77521f028c27d02ff1e08820bec087eb72c5c2d Mon Sep 17 00:00:00 2001 From: arnold-lei Date: Wed, 27 Sep 2023 21:20:38 -0600 Subject: [PATCH 09/22] wip --- init.lua | 7 +++++++ lua/arnoldlei/set.lua | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 4712264040c..c6b4b8b8301 100644 --- a/init.lua +++ b/init.lua @@ -133,6 +133,8 @@ require('lazy').setup({ theme = 'auto', component_separators = '|', section_separators = '', + 'filename', + path=1, }, }, }, @@ -298,6 +300,10 @@ vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' }, + modules = {}, + sync_install = false, + ignore_install = {}, + parser_install_dir = nil, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, @@ -463,6 +469,7 @@ cmp.setup { luasnip.lsp_expand(args.body) end, }, + revision=1, mapping = cmp.mapping.preset.insert { [''] = cmp.mapping.select_next_item(), [''] = cmp.mapping.select_prev_item(), diff --git a/lua/arnoldlei/set.lua b/lua/arnoldlei/set.lua index 45aa63b650a..2da762e40e8 100644 --- a/lua/arnoldlei/set.lua +++ b/lua/arnoldlei/set.lua @@ -1,9 +1,9 @@ vim.opt.nu = true vim.opt.relativenumber = true -vim.opt.tabstop = 2 -vim.opt.softtabstop = 2 -vim.opt.shiftwidth = 2 +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 vim.opt.expandtab = true vim.opt.smartindent = true From a0ecdb6263f5faaf99539b87d4a3401ed4bd5e21 Mon Sep 17 00:00:00 2001 From: arnold-lei Date: Wed, 27 Sep 2023 21:23:07 -0600 Subject: [PATCH 10/22] Tracking lazy lock --- lazy-lock.json | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lazy-lock.json diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 00000000000..b42f84022f4 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,28 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "LuaSnip": { "branch": "master", "commit": "1fd22fa96c11573248f9fdd09f25e724c7bb3dd4" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, + "friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" }, + "gitsigns.nvim": { "branch": "main", "commit": "bdeba1cec3faddd89146690c10b9a87949c0ee66" }, + "harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" }, + "indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" }, + "lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" }, + "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "2451adb9bdb0fd32140bf3aa8dbc17ff60050db3" }, + "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" }, + "neodev.nvim": { "branch": "main", "commit": "ddf29935af5a510307850919d6772ea6a4e2c008" }, + "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, + "nvim-lspconfig": { "branch": "master", "commit": "ede4114e1fd41acb121c70a27e1b026ac68c42d6" }, + "nvim-treesitter": { "branch": "master", "commit": "0960322686bfa38afd4f1e0b9660473cf77e24b6" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" }, + "oxocarbon.nvim": { "branch": "main", "commit": "b47c0ecab3a4270815afb3b05e03423b04cca8f2" }, + "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, + "vim-fugitive": { "branch": "master", "commit": "99db68d9b3304580bd383da7aaee05c7a954a344" }, + "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, + "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, + "which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" } +} \ No newline at end of file From 764f44cb92511a6dde658ef5e6ac22d5e5d199af Mon Sep 17 00:00:00 2001 From: Arnold Date: Thu, 28 Sep 2023 08:59:24 -0600 Subject: [PATCH 11/22] using live grep on c-g --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index f883aee89cb..bcf64419347 100644 --- a/init.lua +++ b/init.lua @@ -294,8 +294,8 @@ end, { desc = '[/] Fuzzily search in current buffer' }) vim.keymap.set('n', '', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) vim.keymap.set('n', '', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) -vim.keymap.set('n', '', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) -vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set('n', '', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) +vim.keymap.set('n', '', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]resume' }) From b16a6a248a6dacf23c01b75dec0b6031c289f6cf Mon Sep 17 00:00:00 2001 From: Arnold Date: Thu, 28 Sep 2023 09:03:23 -0600 Subject: [PATCH 12/22] put lazy lock back in git ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d699e1d68cc..ea93edad490 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ tags test.sh .luarc.json nvim +lazy-lock.json From b76699037be6d756f296bcfdf627c9a5d9487a27 Mon Sep 17 00:00:00 2001 From: arnold-lei Date: Thu, 16 Nov 2023 18:51:40 -0700 Subject: [PATCH 13/22] added some harpoon customizations --- init.lua | 21 +++++++++------------ lazy-lock.json | 42 +++++++++++++++++++---------------------- lua/arnoldlei/remap.lua | 11 ++--------- lua/plugins/harpoon.lua | 6 ++++-- 4 files changed, 34 insertions(+), 46 deletions(-) diff --git a/init.lua b/init.lua index 9889dc854a3..7db9dd37e96 100644 --- a/init.lua +++ b/init.lua @@ -144,10 +144,8 @@ require('lazy').setup({ 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` -- See `:help indent_blankline.txt` - opts = { - char = '┊', - show_trailing_blankline_indent = false, - }, + main="ibl", + opts = {}, }, -- "gc" to comment visual regions/lines @@ -173,6 +171,9 @@ require('lazy').setup({ end, }, }, + defaults = { + vimgrep_arguments = { 'rg',}, + }, }, { @@ -292,7 +293,7 @@ vim.keymap.set('n', '/', function() end, { desc = '[/] Fuzzily search in current buffer' }) vim.keymap.set('n', '', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) -vim.keymap.set('n', '', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) +vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) vim.keymap.set('n', '', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', '', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) @@ -303,11 +304,7 @@ vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = -- See `:help nvim-treesitter` require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' }, - modules = {}, - sync_install = false, - ignore_install = {}, - parser_install_dir = nil, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'ruby'}, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, @@ -367,7 +364,7 @@ require('nvim-treesitter.configs').setup { -- Diagnostic keymaps vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) -vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) +vim.keymap.set('n', 'dq', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) -- [[ Configure LSP ]] @@ -399,7 +396,7 @@ local on_attach = function(_, bufnr) -- See `:help K` for why this keymap nmap('K', vim.lsp.buf.hover, 'Hover Documentation') - nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') + -- nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') -- Lesser used LSP functionality nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') diff --git a/lazy-lock.json b/lazy-lock.json index abff8075877..8b5f1a81d83 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,34 +1,30 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "LuaSnip": { "branch": "master", "commit": "480b032f6708573334f4437d3f83307d143f1a72" }, + "LuaSnip": { "branch": "master", "commit": "0df29db3543837f8b41597f2640397c5ec792b7b" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, - "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, - "friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" }, - "git-blame.nvim": { "branch": "master", "commit": "a36b277e527f9d34efe16c3636555ce0e0c0464c" }, - "gitsigns.nvim": { "branch": "main", "commit": "bdeba1cec3faddd89146690c10b9a87949c0ee66" }, - "harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" }, - "indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" }, - "lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" }, + "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, + "git-blame.nvim": { "branch": "master", "commit": "e4dafc79cc7dcf4eec0547dbc6f3f3821b2f2b14" }, + "gitsigns.nvim": { "branch": "main", "commit": "ff01d34daaed72f271a8ffa088a7e839a60c640f" }, + "harpoon": { "branch": "master", "commit": "c1aebbad9e3d13f20bedb8f2ce8b3a94e39e424a" }, + "indent-blankline.nvim": { "branch": "master", "commit": "0fe34b4c1b926e106d105d3ae88ef6cbf6743572" }, + "lazy.nvim": { "branch": "main", "commit": "276e572f645430bcfd6fd25faa301ea9077f6ab1" }, "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "2451adb9bdb0fd32140bf3aa8dbc17ff60050db3" }, - "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" }, - "neodev.nvim": { "branch": "main", "commit": "bb2dfd43dc8a25d3c1f69bcfdf05357f2397be6e" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "397273083f988c1a17acf3816947cd198338e700" }, + "mason.nvim": { "branch": "main", "commit": "cd7835b15f5a4204fc37e0aa739347472121a54c" }, + "neodev.nvim": { "branch": "main", "commit": "a4b6e7ca11ff5be2264d5c169fcedd97d8699ec4" }, "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, - "nvim-lspconfig": { "branch": "master", "commit": "bfdf2e91e7297a54bcc09d3e092a12bff69a1cf4" }, - "nvim-treesitter": { "branch": "master", "commit": "b5873bacb4ce44e0aac313abb28bb72e67fc9a53" }, - "neodev.nvim": { "branch": "main", "commit": "ddf29935af5a510307850919d6772ea6a4e2c008" }, - "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, - "nvim-lspconfig": { "branch": "master", "commit": "ede4114e1fd41acb121c70a27e1b026ac68c42d6" }, - "nvim-treesitter": { "branch": "master", "commit": "0960322686bfa38afd4f1e0b9660473cf77e24b6" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" }, + "nvim-lspconfig": { "branch": "master", "commit": "bb8e3dfbe10d80c294bb609c4bb4bba3ecdfbfe2" }, + "nvim-treesitter": { "branch": "master", "commit": "168972a0d53170767e49d44f678ca721a2472560" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "76c7a89b41de77a4f83fb77fa072c5ad7605fe3b" }, "oxocarbon.nvim": { "branch": "main", "commit": "b47c0ecab3a4270815afb3b05e03423b04cca8f2" }, - "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, + "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, - "telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" }, - "telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, - "vim-fugitive": { "branch": "master", "commit": "99db68d9b3304580bd383da7aaee05c7a954a344" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "b0015e6e4b46a64192c64b68dec9a9ac5a4e5690" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, + "vim-fugitive": { "branch": "master", "commit": "cbe9dfa162c178946afa689dd3f42d4ea8bf89c1" }, "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, - "which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" } + "which-key.nvim": { "branch": "main", "commit": "6962dae3565369363b59dd51fb206051555fcb4d" } } \ No newline at end of file diff --git a/lua/arnoldlei/remap.lua b/lua/arnoldlei/remap.lua index 753b7481c66..12d710e874f 100644 --- a/lua/arnoldlei/remap.lua +++ b/lua/arnoldlei/remap.lua @@ -10,13 +10,6 @@ vim.keymap.set("n", "", "zz") vim.keymap.set("n", "n", "nzzzv") vim.keymap.set("n", "N", "Nzzzv") -vim.keymap.set("n", "vwm", function() - require("vim-with-me").StartVimWithMe() -end) -vim.keymap.set("n", "svwm", function() - require("vim-with-me").StopVimWithMe() -end) - -- greatest remap ever vim.keymap.set("x", "p", [["_dP]]) @@ -33,8 +26,8 @@ vim.keymap.set("n", "Q", "") vim.keymap.set("n", "", "silent !tmux neww tmux-sessionizer") vim.keymap.set("n", "f", vim.lsp.buf.format) -vim.keymap.set("n", "", "cnextzz") -vim.keymap.set("n", "", "cprevzz") +-- vim.keymap.set("n", "", "cnextzz") +-- vim.keymap.set("n", "", "cprevzz") vim.keymap.set("n", "k", "lnextzz") vim.keymap.set("n", "j", "lprevzz") diff --git a/lua/plugins/harpoon.lua b/lua/plugins/harpoon.lua index 8590d6176fc..2dc8a720730 100644 --- a/lua/plugins/harpoon.lua +++ b/lua/plugins/harpoon.lua @@ -7,9 +7,11 @@ return { config = true, keys = { { "a", "lua require('harpoon.mark').add_file()", desc = "Mark file with harpoon" }, - { "hn", "lua require('harpoon.ui').nav_next()", desc = "Go to next harpoon mark" }, - { "hp", "lua require('harpoon.ui').nav_prev()", desc = "Go to previous harpoon mark" }, { "", "lua require('harpoon.ui').toggle_quick_menu()", desc = "Show harpoon marks" }, + { "", "lua require('harpoon.ui').nav_file(1)", desc = "Navigate to first file in Harpoon" }, + { "", "lua require('harpoon.ui').nav_file(2)", desc = "Navigate to second file in Harpoon" }, + { "", "lua require('harpoon.ui').nav_file(3)", desc = "Navigate to third file in Harpoon" }, + { "", "lua require('harpoon.ui').nav_file(4)", desc = "Navigate to fourth file in Harpoon" }, }, } From fe126d9d2ea488b56728ca01c799e59f32e532f2 Mon Sep 17 00:00:00 2001 From: arnold-lei Date: Wed, 13 Mar 2024 11:44:27 -0600 Subject: [PATCH 14/22] added search buffer --- init.lua | 1 + lua/plugins/comment.lua | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 lua/plugins/comment.lua diff --git a/init.lua b/init.lua index 7db9dd37e96..ac6978da36f 100644 --- a/init.lua +++ b/init.lua @@ -299,6 +299,7 @@ vim.keymap.set('n', '', require('telescope.builtin').grep_string, { d vim.keymap.set('n', '', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]resume' }) +vim.keymap.set('n', 'sb', require('telescope.builtin').buffers, { desc = '[S]earch [B]uffers' }) -- [[ Configure Treesitter ]] -- See `:help nvim-treesitter` diff --git a/lua/plugins/comment.lua b/lua/plugins/comment.lua new file mode 100644 index 00000000000..e6b597dbdc5 --- /dev/null +++ b/lua/plugins/comment.lua @@ -0,0 +1,7 @@ +return { + 'numToStr/Comment.nvim', + opts = { + -- add any options here + }, + lazy = false, +} From 8f792fa3bc6a517cc7fc0f6e64fc04f7e0db59f7 Mon Sep 17 00:00:00 2001 From: arnold-lei Date: Thu, 14 Mar 2024 22:11:47 -0600 Subject: [PATCH 15/22] color scheme back to tokyo night --- init.lua | 36 ++++++++++++++++++------------------ lazy-lock.json | 46 +++++++++++++++++++++++----------------------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/init.lua b/init.lua index ac6978da36f..2b1bfc6fbc6 100644 --- a/init.lua +++ b/init.lua @@ -104,25 +104,25 @@ require('lazy').setup({ }, }, - { - "nyoom-engineering/oxocarbon.nvim", - config = function() - vim.cmd([[colorscheme oxocarbon]]) - end, - -- Add in any other configuration; - -- event = foo, - -- config = bar - -- end, - }, - -- { - -- "folke/tokyonight.nvim", - -- lazy = false, -- make sure we load this during startup if it is your main colorscheme - -- priority = 1000, -- make sure to load this before all the other start plugins + -- { + -- "nyoom-engineering/oxocarbon.nvim", -- config = function() - -- -- load the colorscheme here - -- vim.cmd([[colorscheme tokyonight]]) + -- vim.cmd([[colorscheme oxocarbon]]) -- end, + -- -- Add in any other configuration; + -- -- event = foo, + -- -- config = bar + -- -- end, -- }, + { + "folke/tokyonight.nvim", + lazy = false, -- make sure we load this during startup if it is your main colorscheme + priority = 1000, -- make sure to load this before all the other start plugins + config = function() + -- load the colorscheme here + vim.cmd([[colorscheme tokyonight]]) + end, + }, { -- Set lualine as statusline 'nvim-lualine/lualine.nvim', @@ -423,10 +423,10 @@ end -- define the property 'filetypes' to the map in question. local servers = { -- clangd = {}, - -- gopls = {}, + gopls = {}, -- pyright = {}, -- rust_analyzer = {}, - -- tsserver = {}, + tsserver = {}, -- html = { filetypes = { 'html', 'twig', 'hbs'} }, lua_ls = { diff --git a/lazy-lock.json b/lazy-lock.json index 8b5f1a81d83..0de30573681 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,30 +1,30 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "LuaSnip": { "branch": "master", "commit": "0df29db3543837f8b41597f2640397c5ec792b7b" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, - "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, - "git-blame.nvim": { "branch": "master", "commit": "e4dafc79cc7dcf4eec0547dbc6f3f3821b2f2b14" }, - "gitsigns.nvim": { "branch": "main", "commit": "ff01d34daaed72f271a8ffa088a7e839a60c640f" }, - "harpoon": { "branch": "master", "commit": "c1aebbad9e3d13f20bedb8f2ce8b3a94e39e424a" }, - "indent-blankline.nvim": { "branch": "master", "commit": "0fe34b4c1b926e106d105d3ae88ef6cbf6743572" }, - "lazy.nvim": { "branch": "main", "commit": "276e572f645430bcfd6fd25faa301ea9077f6ab1" }, - "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "397273083f988c1a17acf3816947cd198338e700" }, - "mason.nvim": { "branch": "main", "commit": "cd7835b15f5a4204fc37e0aa739347472121a54c" }, - "neodev.nvim": { "branch": "main", "commit": "a4b6e7ca11ff5be2264d5c169fcedd97d8699ec4" }, - "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, - "nvim-lspconfig": { "branch": "master", "commit": "bb8e3dfbe10d80c294bb609c4bb4bba3ecdfbfe2" }, - "nvim-treesitter": { "branch": "master", "commit": "168972a0d53170767e49d44f678ca721a2472560" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "76c7a89b41de77a4f83fb77fa072c5ad7605fe3b" }, - "oxocarbon.nvim": { "branch": "main", "commit": "b47c0ecab3a4270815afb3b05e03423b04cca8f2" }, - "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, - "telescope-ui-select.nvim": { "branch": "master", "commit": "b0015e6e4b46a64192c64b68dec9a9ac5a4e5690" }, - "telescope.nvim": { "branch": "0.1.x", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, - "vim-fugitive": { "branch": "master", "commit": "cbe9dfa162c178946afa689dd3f42d4ea8bf89c1" }, + "friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" }, + "git-blame.nvim": { "branch": "master", "commit": "a0282d05adbee80aaf4e2ff35b81b52940b67bed" }, + "gitsigns.nvim": { "branch": "main", "commit": "4e348641b8206c3b8d23080999e3ddbe4ca90efc" }, + "harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" }, + "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, + "lazy.nvim": { "branch": "main", "commit": "83493db50a434a4c5c648faf41e2ead80f96e478" }, + "lualine.nvim": { "branch": "master", "commit": "26dac2fcadb6e622790ab08e36d0dba3d3765398" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "55716a879568a498fa236593c8119789054a3b8e" }, + "mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" }, + "neodev.nvim": { "branch": "main", "commit": "84e0290f5600e8b89c0dfcafc864f45496a53400" }, + "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, + "nvim-lspconfig": { "branch": "master", "commit": "4bdd3800b4148f670c6cf55ef65f490148eeb550" }, + "nvim-treesitter": { "branch": "master", "commit": "904f373fc4e6fb474e3df35b57f78edee8e45267" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "d2a4ffc22d9d38d44edb73da007b3cf43451e9b4" }, + "plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" }, + "tokyonight.nvim": { "branch": "main", "commit": "9a01eada39558dc3243278e6805d90e8dff45dc0" }, + "vim-fugitive": { "branch": "master", "commit": "41beedabc7e948c787ea5696e04c3544c3674e23" }, "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, - "which-key.nvim": { "branch": "main", "commit": "6962dae3565369363b59dd51fb206051555fcb4d" } + "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } } \ No newline at end of file From bad3683c8980ce28d1bee6d9d96bc41b899f9dbd Mon Sep 17 00:00:00 2001 From: Arnold Lei Date: Sun, 5 Oct 2025 20:24:11 -0600 Subject: [PATCH 16/22] attempting to update --- init.lua | 66 ++++++++++++++++++++++++++--------------- lazy-lock.json | 57 ++++++++++++++++++----------------- lua/arnoldlei/remap.lua | 20 +++++++++++-- lua/plugins/curl.lua | 31 +++++++++++++++++++ lua/plugins/harpoon.lua | 9 +++--- lua/plugins/oil.lua | 11 +++++++ 6 files changed, 136 insertions(+), 58 deletions(-) create mode 100644 lua/plugins/curl.lua create mode 100644 lua/plugins/oil.lua diff --git a/init.lua b/init.lua index 2b1bfc6fbc6..635afd10ab7 100644 --- a/init.lua +++ b/init.lua @@ -28,7 +28,7 @@ vim.opt.rtp:prepend(lazypath) -- as they will be available in your neovim runtime. require('lazy').setup({ -- NOTE: First, some plugins that don't require any configuration - {import = "plugins"}, + { import = "plugins" }, -- Git related plugins "tpope/vim-fugitive", 'tpope/vim-rhubarb', @@ -48,7 +48,7 @@ require('lazy').setup({ -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', tag = 'legacy', opts = {} }, + { 'j-hui/fidget.nvim', tag = 'legacy', opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! 'folke/neodev.nvim', @@ -90,33 +90,33 @@ require('lazy').setup({ -- don't override the built-in and fugitive keymaps local gs = package.loaded.gitsigns - vim.keymap.set({'n', 'v'}, ']c', function() + vim.keymap.set({ 'n', 'v' }, ']c', function() if vim.wo.diff then return ']c' end vim.schedule(function() gs.next_hunk() end) return '' - end, {expr=true, buffer = bufnr, desc = "Jump to next hunk"}) - vim.keymap.set({'n', 'v'}, '[c', function() + end, { expr = true, buffer = bufnr, desc = "Jump to next hunk" }) + vim.keymap.set({ 'n', 'v' }, '[c', function() if vim.wo.diff then return '[c' end vim.schedule(function() gs.prev_hunk() end) return '' - end, {expr=true, buffer = bufnr, desc = "Jump to previous hunk"}) + end, { expr = true, buffer = bufnr, desc = "Jump to previous hunk" }) end, }, }, - -- { + -- { -- "nyoom-engineering/oxocarbon.nvim", -- config = function() -- vim.cmd([[colorscheme oxocarbon]]) -- end, - -- -- Add in any other configuration; - -- -- event = foo, + -- -- Add in any other configuration; + -- -- event = foo, -- -- config = bar -- -- end, -- }, { "folke/tokyonight.nvim", - lazy = false, -- make sure we load this during startup if it is your main colorscheme + lazy = false, -- make sure we load this during startup if it is your main colorscheme priority = 1000, -- make sure to load this before all the other start plugins config = function() -- load the colorscheme here @@ -134,7 +134,7 @@ require('lazy').setup({ component_separators = '|', section_separators = '', 'filename', - path=1, + path = 1, }, }, }, @@ -144,7 +144,7 @@ require('lazy').setup({ 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` -- See `:help indent_blankline.txt` - main="ibl", + main = "ibl", opts = {}, }, @@ -172,7 +172,7 @@ require('lazy').setup({ }, }, defaults = { - vimgrep_arguments = { 'rg',}, + vimgrep_arguments = { 'rg', }, }, }, @@ -278,7 +278,7 @@ require('telescope').setup { -- Enable telescope fzf native, if installed pcall(require('telescope').load_extension, 'fzf') --- Enable telescope ui select +-- Enable telescope ui select require("telescope").load_extension("ui-select") -- See `:help telescope.builtin` @@ -293,23 +293,25 @@ vim.keymap.set('n', '/', function() end, { desc = '[/] Fuzzily search in current buffer' }) vim.keymap.set('n', '', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) -vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) -vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) -vim.keymap.set('n', '', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) -vim.keymap.set('n', '', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) -vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) -vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]resume' }) -vim.keymap.set('n', 'sb', require('telescope.builtin').buffers, { desc = '[S]earch [B]uffers' }) +vim.keymap.set('n', 'ff', require('telescope.builtin').find_files, { desc = '[f]ind [f]iles' }) +vim.keymap.set('n', 'fF', function() require('telescope.builtin').find_files({ hidden = true }) end, { desc = '[f]ind [F]iles (hidden)' }) +vim.keymap.set('n', 'fh', require('telescope.builtin').help_tags, { desc = '[f]ind [H]elp' }) +-- vim.keymap.set('n', 'fg', require('telescope.builtin').grep_string, { desc = '[f]ind [g]rep' }) +vim.keymap.set('n', 'fg', require('telescope.builtin').live_grep, { desc = '[f]ind by [G]rep' }) +vim.keymap.set('n', 'fd', require('telescope.builtin').diagnostics, { desc = '[f]ind [D]iagnostics' }) +vim.keymap.set('n', 'fr', require('telescope.builtin').resume, { desc = '[f]ind [R]resume' }) +vim.keymap.set('n', 'fb', require('telescope.builtin').buffers, { desc = '[f]ind [B]uffers' }) -- [[ Configure Treesitter ]] -- See `:help nvim-treesitter` require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'ruby'}, + ensure_installed = + { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, - modules={}, + modules = {}, sync_install = false, ignore_install = {}, parser_install_dir = nil, @@ -427,6 +429,22 @@ local servers = { -- pyright = {}, -- rust_analyzer = {}, tsserver = {}, + volar = { + filetypes = { 'vue', 'javascript', 'typescript', 'javascriptreact', 'typescriptreact' }, + init_options = { + vue = { + hybridMode = false, + }, + typescript = { + -- Global install of typescript + --tsdk = '~/.nvm/versions/node/v20.11.1/lib/node_modules/typescript', + -- Current project version and what I will likely use + tsdk = vim.fn.getcwd() .. "node_modules/typescript/lib", + + }, + }, + }, + -- html = { filetypes = { 'html', 'twig', 'hbs'} }, lua_ls = { @@ -475,7 +493,7 @@ cmp.setup { luasnip.lsp_expand(args.body) end, }, - revision=1, + revision = 1, mapping = cmp.mapping.preset.insert { [''] = cmp.mapping.select_next_item(), [''] = cmp.mapping.select_prev_item(), diff --git a/lazy-lock.json b/lazy-lock.json index 0de30573681..a872c75a4ff 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,30 +1,33 @@ { - "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, - "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "73813308abc2eaeff2bc0d3f2f79270c491be9d7" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "curl.nvim": { "branch": "main", "commit": "3ee14fbafc8169fc803e80562ce7ac5b4474bdff" }, "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, - "friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" }, - "git-blame.nvim": { "branch": "master", "commit": "a0282d05adbee80aaf4e2ff35b81b52940b67bed" }, - "gitsigns.nvim": { "branch": "main", "commit": "4e348641b8206c3b8d23080999e3ddbe4ca90efc" }, - "harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" }, - "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, - "lazy.nvim": { "branch": "main", "commit": "83493db50a434a4c5c648faf41e2ead80f96e478" }, - "lualine.nvim": { "branch": "master", "commit": "26dac2fcadb6e622790ab08e36d0dba3d3765398" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "55716a879568a498fa236593c8119789054a3b8e" }, - "mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" }, - "neodev.nvim": { "branch": "main", "commit": "84e0290f5600e8b89c0dfcafc864f45496a53400" }, - "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, - "nvim-lspconfig": { "branch": "master", "commit": "4bdd3800b4148f670c6cf55ef65f490148eeb550" }, - "nvim-treesitter": { "branch": "master", "commit": "904f373fc4e6fb474e3df35b57f78edee8e45267" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "d2a4ffc22d9d38d44edb73da007b3cf43451e9b4" }, - "plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "git-blame.nvim": { "branch": "master", "commit": "9874ec1ec8bc53beb33b7cd82c092b85271a578b" }, + "gitsigns.nvim": { "branch": "main", "commit": "1ee5c1fd068c81f9dd06483e639c2aa4587dc197" }, + "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "lazy.nvim": { "branch": "main", "commit": "59334064f8604ca073791c25dcc5c9698865406e" }, + "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "155eac5d8609a2f110041f8ac3491664cc126354" }, + "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, + "mini.icons": { "branch": "main", "commit": "284798619aed9f4c1ac1b9417b9a5e3b4b85ef3a" }, + "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-lspconfig": { "branch": "master", "commit": "e688b486fe9291f151eae7e5c0b5a5c4ef980847" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "71385f191ec06ffc60e80e6b0c9a9d5daed4824c" }, + "oil.nvim": { "branch": "master", "commit": "919e155fdf38e9148cdb5304faaaf53c20d703ea" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, - "telescope.nvim": { "branch": "0.1.x", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" }, - "tokyonight.nvim": { "branch": "main", "commit": "9a01eada39558dc3243278e6805d90e8dff45dc0" }, - "vim-fugitive": { "branch": "master", "commit": "41beedabc7e948c787ea5696e04c3544c3674e23" }, - "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, - "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, - "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } -} \ No newline at end of file + "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "tokyonight.nvim": { "branch": "main", "commit": "4d159616aee17796c2c94d2f5f87d2ee1a3f67c7" }, + "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, + "vim-rhubarb": { "branch": "master", "commit": "5496d7c94581c4c9ad7430357449bb57fc59f501" }, + "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, + "which-key.nvim": { "branch": "main", "commit": "904308e6885bbb7b60714c80ab3daf0c071c1492" } +} diff --git a/lua/arnoldlei/remap.lua b/lua/arnoldlei/remap.lua index 12d710e874f..f606fe4854c 100644 --- a/lua/arnoldlei/remap.lua +++ b/lua/arnoldlei/remap.lua @@ -1,5 +1,17 @@ vim.g.mapleader = " " -vim.keymap.set("n", "pv", vim.cmd.Ex) +-- vim.keymap.set("n", "pv", vim.cmd.Ex) +vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory" }) +vim.keymap.set("n", "pv", "Oil", { desc = "Open parent directory" }) + +-- Window splits +vim.keymap.set("n", "|", "vsplit", { desc = "Split window vertically" }) +vim.keymap.set("n", "_", "split", { desc = "Split window horizontally" }) + +-- Window navigation +vim.keymap.set("n", "", "h", { desc = "Move to left window" }) +vim.keymap.set("n", "", "j", { desc = "Move to window below" }) +vim.keymap.set("n", "", "k", { desc = "Move to window above" }) +vim.keymap.set("n", "", "l", { desc = "Move to right window" }) vim.keymap.set("v", "J", ":m '>+1gv=gv") vim.keymap.set("v", "K", ":m '<-2gv=gv") @@ -14,10 +26,10 @@ vim.keymap.set("n", "N", "Nzzzv") vim.keymap.set("x", "p", [["_dP]]) -- next greatest remap ever : asbjornHaland -vim.keymap.set({"n", "v"}, "y", [["+y]]) +vim.keymap.set({ "n", "v" }, "y", [["+y]]) vim.keymap.set("n", "Y", [["+Y]]) -vim.keymap.set({"n", "v"}, "d", [["_d]]) +vim.keymap.set({ "n", "v" }, "d", [["_d]]) -- This is going to get me cancelled vim.keymap.set("i", "", "") @@ -37,6 +49,8 @@ vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) vim.keymap.set("n", "vpp", "e ~/.dotfiles/nvim/.config/nvim/lua/theprimeagen/packer.lua"); vim.keymap.set("n", "mr", "CellularAutomaton make_it_rain"); +vim.keymap.set("n", "sf", ":source $HOME/.config/nvim/init.lua ", { desc = "Source Neovim config" }) + vim.keymap.set("n", "", function() vim.cmd("so") end) diff --git a/lua/plugins/curl.lua b/lua/plugins/curl.lua new file mode 100644 index 00000000000..293d8265e03 --- /dev/null +++ b/lua/plugins/curl.lua @@ -0,0 +1,31 @@ +return { + "oysandvik94/curl.nvim", + cmd = { "CurlOpen" }, + dependencies = { + "nvim-lua/plenary.nvim", + }, + config = true, + keys = { + { "cc", "lua require('curl').open_curl_tab()", desc = "Open a curl tab scoped to the current working directory" }, + { "csc", "lua require('curl').create_scoped_collection()", desc = "Create or open a collection with a name from user input" }, + { "cgc", "lua require('curl').create_global_collection()", desc = "Create or open a global collection with a name from user input" }, + }, + on_attach = function (bufnr) + -- These commands will prompt you for a name for your collection + vim.keymap.set("n", "csc", function() + curl.create_scoped_collection() + end, { desc = "Create or open a collection with a name from user input" }) + + vim.keymap.set("n", "cgc", function() + curl.create_global_collection() + end, { desc = "Create or open a global collection with a name from user input" }) + + vim.keymap.set("n", "fsc", function() + curl.pick_scoped_collection() + end, { desc = "Choose a scoped collection and open it" }) + + vim.keymap.set("n", "fgc", function() + curl.pick_global_collection() + end, { desc = "Choose a global collection and open it" }) + end +} diff --git a/lua/plugins/harpoon.lua b/lua/plugins/harpoon.lua index 2dc8a720730..d7c3e97cea5 100644 --- a/lua/plugins/harpoon.lua +++ b/lua/plugins/harpoon.lua @@ -1,5 +1,6 @@ return { "ThePrimeagen/harpoon", + branch = "harpoon2", lazy = false, dependencies = { "nvim-lua/plenary.nvim", @@ -8,10 +9,10 @@ return { keys = { { "a", "lua require('harpoon.mark').add_file()", desc = "Mark file with harpoon" }, { "", "lua require('harpoon.ui').toggle_quick_menu()", desc = "Show harpoon marks" }, - { "", "lua require('harpoon.ui').nav_file(1)", desc = "Navigate to first file in Harpoon" }, - { "", "lua require('harpoon.ui').nav_file(2)", desc = "Navigate to second file in Harpoon" }, - { "", "lua require('harpoon.ui').nav_file(3)", desc = "Navigate to third file in Harpoon" }, - { "", "lua require('harpoon.ui').nav_file(4)", desc = "Navigate to fourth file in Harpoon" }, + -- { "", "lua require('harpoon.ui').nav_file(1)", desc = "Navigate to first file in Harpoon" }, + -- { "", "lua require('harpoon.ui').nav_file(2)", desc = "Navigate to second file in Harpoon" }, + -- { "", "lua require('harpoon.ui').nav_file(3)", desc = "Navigate to third file in Harpoon" }, + -- { "", "lua require('harpoon.ui').nav_file(4)", desc = "Navigate to fourth file in Harpoon" }, }, } diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua new file mode 100644 index 00000000000..8f5d6ff50d2 --- /dev/null +++ b/lua/plugins/oil.lua @@ -0,0 +1,11 @@ +return { + 'stevearc/oil.nvim', + ---@module 'oil' + ---@type oil.SetupOpts + opts = {}, + -- Optional dependencies + dependencies = { { "nvim-mini/mini.icons", opts = {} } }, + -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons + -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. + lazy = false, +} From d46f0729952a6b33273753ca53f227a384ed456c Mon Sep 17 00:00:00 2001 From: Arnold Lei Date: Sun, 5 Oct 2025 21:42:58 -0600 Subject: [PATCH 17/22] wip --- init.lua | 1444 +++++++++++++++++++++++++++------------ lazy-lock.json | 26 +- lua/arnoldlei/remap.lua | 68 +- lua/plugins/comment.lua | 7 - lua/plugins/curl.lua | 31 - lua/plugins/harpoon.lua | 18 - lua/plugins/oil.lua | 11 - 7 files changed, 1040 insertions(+), 565 deletions(-) delete mode 100644 lua/plugins/comment.lua delete mode 100644 lua/plugins/curl.lua delete mode 100644 lua/plugins/harpoon.lua delete mode 100644 lua/plugins/oil.lua diff --git a/init.lua b/init.lua index 635afd10ab7..f623a9dc6d5 100644 --- a/init.lua +++ b/init.lua @@ -1,83 +1,279 @@ --- TODO look into tmux sessionizer +--[[ + +===================================================================== +===================== 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 required (otherwise wrong leader will be used) +-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -vim.keymap.set("n", "gs", vim.cmd.Git) --- Install package manager --- https://github.com/folke/lazy.nvim --- `:help lazy.nvim.txt` for more info -local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' -if not vim.loop.fs_stat(lazypath) then - vim.fn.system { - 'git', - 'clone', - '--filter=blob:none', - 'https://github.com/folke/lazy.nvim.git', - '--branch=stable', -- latest stable release - lazypath, - } -end -vim.opt.rtp:prepend(lazypath) --- NOTE: Here is where you install your plugins. --- You can configure plugins using the `config` key. +-- Set to true if you have a Nerd Font installed and selected in the terminal +vim.g.have_nerd_font = false + +-- [[ Setting options ]] +-- See `:help vim.o` +-- NOTE: You can change these options as you wish! +-- For more options, you can see `:help option-list` + +-- Make line numbers default +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 + +-- Enable mouse mode, can be useful for resizing splits for example! +vim.o.mouse = 'a' + +-- Don't show the mode, since it's already in the status line +vim.o.showmode = false + +-- Sync clipboard between OS and Neovim. +-- Schedule the setting after `UiEnter` because it can increase startup-time. +-- Remove this option if you want your OS clipboard to remain independent. +-- See `:help 'clipboard'` +vim.schedule(function() + vim.o.clipboard = 'unnamedplus' +end) + +-- Enable break indent +vim.o.breakindent = true + +-- Save undo history +vim.o.undofile = true + +-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term +vim.o.ignorecase = true +vim.o.smartcase = true + +-- Keep signcolumn on by default +vim.o.signcolumn = 'yes' + +-- Decrease update time +vim.o.updatetime = 250 + +-- Decrease mapped sequence wait time +vim.o.timeoutlen = 300 + +-- Configure how new splits should be opened +vim.o.splitright = true +vim.o.splitbelow = true + +-- Sets how neovim will display certain whitespace characters in the editor. +-- See `:help 'list'` +-- and `:help 'listchars'` -- --- You can also configure plugins after the setup call, --- as they will be available in your neovim runtime. -require('lazy').setup({ - -- NOTE: First, some plugins that don't require any configuration - { import = "plugins" }, - -- Git related plugins - "tpope/vim-fugitive", - 'tpope/vim-rhubarb', - 'f-person/git-blame.nvim', - -- Detect tabstop and shiftwidth automatically - 'tpope/vim-sleuth', - - -- NOTE: This is where your plugins related to LSP can be installed. - -- The configuration is done below. Search for lspconfig to find it below. - { - -- LSP Configuration & Plugins - 'neovim/nvim-lspconfig', - dependencies = { - -- Automatically install LSPs to stdpath for neovim - { 'williamboman/mason.nvim', config = true }, - 'williamboman/mason-lspconfig.nvim', +-- Notice listchars is set using `vim.opt` instead of `vim.o`. +-- It is very similar to `vim.o` but offers an interface for conveniently interacting with tables. +-- See `:help lua-options` +-- and `:help lua-options-guide` +vim.o.list = true +vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } - -- Useful status updates for LSP - -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', tag = 'legacy', opts = {} }, +-- Preview substitutions live, as you type! +vim.o.inccommand = 'split' - -- Additional lua configuration, makes nvim stuff amazing! - 'folke/neodev.nvim', - }, - }, +-- Show which line your cursor is on +vim.o.cursorline = true - { - -- Autocompletion - 'hrsh7th/nvim-cmp', - dependencies = { - -- Snippet Engine & its associated nvim-cmp source - 'L3MON4D3/LuaSnip', - 'saadparwaiz1/cmp_luasnip', +-- Minimal number of screen lines to keep above and below the cursor. +vim.o.scrolloff = 10 - -- Adds LSP completion capabilities - 'hrsh7th/cmp-nvim-lsp', +-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`), +-- instead raise a dialog asking if you wish to save the current file(s) +-- See `:help 'confirm'` +vim.o.confirm = true - -- Adds a number of user-friendly snippets - 'rafamadriz/friendly-snippets', - }, - }, +-- [[ Basic Keymaps ]] +-- See `:help vim.keymap.set()` - -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, - { - -- Adds git related signs to the gutter, as well as utilities for managing changes +-- Clear highlights on search when pressing in normal mode +-- See `:help hlsearch` +vim.keymap.set('n', '', 'nohlsearch') + +-- Diagnostic keymaps +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) + +-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier +-- for people to discover. Otherwise, you normally need to press , which +-- is not what someone will guess without a bit more experience. +-- +-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping +-- or just use to exit terminal mode +vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) + +-- TIP: Disable arrow keys in normal mode +-- vim.keymap.set('n', '', 'echo "Use h to move!!"') +-- vim.keymap.set('n', '', 'echo "Use l to move!!"') +-- vim.keymap.set('n', '', 'echo "Use k to move!!"') +-- vim.keymap.set('n', '', 'echo "Use j to move!!"') + +-- Keybinds to make split navigation easier. +-- Use CTRL+ to switch between windows +-- +-- See `:help wincmd` for a list of all window commands +vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) + +-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes +-- vim.keymap.set("n", "", "H", { desc = "Move window to the left" }) +-- vim.keymap.set("n", "", "L", { desc = "Move window to the right" }) +-- vim.keymap.set("n", "", "J", { desc = "Move window to the lower" }) +-- vim.keymap.set("n", "", "K", { desc = "Move window to the upper" }) + +-- [[ Basic Autocommands ]] +-- See `:help lua-guide-autocommands` + +-- Highlight when yanking (copying) text +-- Try it with `yap` in normal mode +-- See `:help vim.hl.on_yank()` +vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), + callback = function() + vim.hl.on_yank() + end, +}) + +-- [[ Install `lazy.nvim` plugin manager ]] +-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info +local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = 'https://github.com/folke/lazy.nvim.git' + local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } + if vim.v.shell_error ~= 0 then + error('Error cloning lazy.nvim:\n' .. out) + end +end + +---@type vim.Option +local rtp = vim.opt.rtp +rtp:prepend(lazypath) + +-- [[ Configure and install plugins ]] +-- +-- To check the current status of your plugins, run +-- :Lazy +-- +-- You can press `?` in this menu for help. Use `:q` to close the window +-- +-- To update plugins you can run +-- :Lazy update +-- +-- NOTE: Here is where you install your plugins. +require('lazy').setup({ + -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). + 'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically + + -- NOTE: Plugins can also be added by using a table, + -- with the first argument being the link and the following + -- keys can be used to configure plugin behavior/loading/etc. + -- + -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded. + -- + + -- Alternatively, use `config = function() ... end` for full control over the configuration. + -- If you prefer to call `setup` explicitly, use: + -- { + -- 'lewis6991/gitsigns.nvim', + -- config = function() + -- require('gitsigns').setup({ + -- -- Your gitsigns configuration here + -- }) + -- end, + -- } + -- + -- Here is a more advanced example where we pass configuration + -- options to `gitsigns.nvim`. + -- + -- See `:help gitsigns` to understand what the configuration keys do + { -- Adds git related signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', opts = { - -- See `:help gitsigns.txt` signs = { add = { text = '+' }, change = { text = '~' }, @@ -85,451 +281,807 @@ require('lazy').setup({ topdelete = { text = '‾' }, changedelete = { text = '~' }, }, - on_attach = function(bufnr) - vim.keymap.set('n', 'hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' }) - - -- don't override the built-in and fugitive keymaps - local gs = package.loaded.gitsigns - vim.keymap.set({ 'n', 'v' }, ']c', function() - if vim.wo.diff then return ']c' end - vim.schedule(function() gs.next_hunk() end) - return '' - end, { expr = true, buffer = bufnr, desc = "Jump to next hunk" }) - vim.keymap.set({ 'n', 'v' }, '[c', function() - if vim.wo.diff then return '[c' end - vim.schedule(function() gs.prev_hunk() end) - return '' - end, { expr = true, buffer = bufnr, desc = "Jump to previous hunk" }) - end, }, }, - -- { - -- "nyoom-engineering/oxocarbon.nvim", - -- config = function() - -- vim.cmd([[colorscheme oxocarbon]]) - -- end, - -- -- Add in any other configuration; - -- -- event = foo, - -- -- config = bar - -- -- end, - -- }, - { - "folke/tokyonight.nvim", - lazy = false, -- make sure we load this during startup if it is your main colorscheme - priority = 1000, -- make sure to load this before all the other start plugins - config = function() - -- load the colorscheme here - vim.cmd([[colorscheme tokyonight]]) - end, - }, - { - -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', - -- See `:help lualine.txt` + -- NOTE: Plugins can also be configured to run Lua code when they are loaded. + -- + -- This is often very useful to both group configuration, as well as handle + -- lazy loading plugins that don't need to be loaded immediately at startup. + -- + -- For example, in the following configuration, we use: + -- event = 'VimEnter' + -- + -- which loads which-key before all the UI elements are loaded. Events can be + -- normal autocommands events (`:help autocmd-events`). + -- + -- Then, because we use the `opts` key (recommended), the configuration runs + -- after the plugin has been loaded as `require(MODULE).setup(opts)`. + + { -- Useful plugin to show you pending keybinds. + 'folke/which-key.nvim', + event = 'VimEnter', -- Sets the loading event to 'VimEnter' opts = { - options = { - icons_enabled = false, - theme = 'auto', - component_separators = '|', - section_separators = '', - 'filename', - path = 1, + -- delay between pressing a key and opening which-key (milliseconds) + -- this setting is independent of vim.o.timeoutlen + delay = 0, + icons = { + -- set icon mappings to true if you have a Nerd Font + mappings = vim.g.have_nerd_font, + -- If you are using a Nerd Font: set icons.keys to an empty table which will use the + -- default which-key.nvim defined Nerd Font icons, otherwise define a string table + keys = vim.g.have_nerd_font and {} or { + Up = ' ', + Down = ' ', + Left = ' ', + Right = ' ', + C = ' ', + M = ' ', + D = ' ', + S = ' ', + CR = ' ', + Esc = ' ', + ScrollWheelDown = ' ', + ScrollWheelUp = ' ', + NL = ' ', + BS = ' ', + Space = ' ', + Tab = ' ', + F1 = '', + F2 = '', + F3 = '', + F4 = '', + F5 = '', + F6 = '', + F7 = '', + F8 = '', + F9 = '', + F10 = '', + F11 = '', + F12 = '', + }, }, - }, - }, - { - -- Add indentation guides even on blank lines - 'lukas-reineke/indent-blankline.nvim', - -- Enable `lukas-reineke/indent-blankline.nvim` - -- See `:help indent_blankline.txt` - main = "ibl", - opts = {}, + -- Document existing key chains + spec = { + { 's', group = '[S]earch' }, + { 't', group = '[T]oggle' }, + { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, + }, + }, }, - -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {} }, + -- NOTE: Plugins can specify dependencies. + -- + -- The dependencies are proper plugin specifications as well - anything + -- you do for a plugin at the top level, you can do for a dependency. + -- + -- Use the `dependencies` key to specify the dependencies of a particular plugin - -- Fuzzy Finder (files, lsp, etc) - { + { -- Fuzzy Finder (files, lsp, etc) 'nvim-telescope/telescope.nvim', - branch = '0.1.x', + event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim', - 'nvim-telescope/telescope-ui-select.nvim', - -- Fuzzy Finder Algorithm which requires local dependencies to be built. - -- Only load if `make` is available. Make sure you have the system - -- requirements installed. - { + { -- If encountering errors, see telescope-fzf-native README for installation instructions 'nvim-telescope/telescope-fzf-native.nvim', - -- NOTE: If you are having trouble with this installation, - -- refer to the README for telescope-fzf-native for more instructions. + + -- `build` is used to run some command when the plugin is installed/updated. + -- This is only run then, not every time Neovim starts up. build = 'make', + + -- `cond` is a condition used to determine whether this plugin should be + -- installed and loaded. cond = function() return vim.fn.executable 'make' == 1 end, }, + { 'nvim-telescope/telescope-ui-select.nvim' }, + + -- Useful for getting pretty icons, but requires a Nerd Font. + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, - defaults = { - vimgrep_arguments = { 'rg', }, - }, + config = function() + -- Telescope is a fuzzy finder that comes with a lot of different things that + -- it can fuzzy find! It's more than just a "file finder", it can search + -- many different aspects of Neovim, your workspace, LSP, and more! + -- + -- The easiest way to use Telescope, is to start by doing something like: + -- :Telescope help_tags + -- + -- After running this command, a window will open up and you're able to + -- type in the prompt window. You'll see a list of `help_tags` options and + -- a corresponding preview of the help. + -- + -- Two important keymaps to use while in Telescope are: + -- - Insert mode: + -- - Normal mode: ? + -- + -- This opens a window that shows you all of the keymaps for the current + -- Telescope picker. This is really useful to discover what Telescope can + -- do as well as how to actually do it! + + -- [[ Configure Telescope ]] + -- See `:help telescope` and `:help telescope.setup()` + require('telescope').setup { + -- You can put your default mappings / updates / etc. in here + -- All the info you're looking for is in `:help telescope.setup()` + -- + -- defaults = { + -- mappings = { + -- i = { [''] = 'to_fuzzy_refine' }, + -- }, + -- }, + -- pickers = {} + extensions = { + ['ui-select'] = { + require('telescope.themes').get_dropdown(), + }, + }, + } + + -- Enable Telescope extensions if they are installed + pcall(require('telescope').load_extension, 'fzf') + pcall(require('telescope').load_extension, 'ui-select') + + -- See `:help telescope.builtin` + local builtin = require 'telescope.builtin' + vim.keymap.set('n', 'fh', builtin.help_tags, { desc = '[F]ind [H]elp' }) + vim.keymap.set('n', 'fk', builtin.keymaps, { desc = '[F]ind [K]eymaps' }) + vim.keymap.set('n', 'ff', builtin.find_files, { desc = '[F]ind [F]iles' }) + vim.keymap.set('n', 'fs', builtin.builtin, { desc = '[F]ind [S]elect Telescope' }) + vim.keymap.set('n', 'fw', builtin.grep_string, { desc = '[F]ind current [W]ord' }) + vim.keymap.set('n', 'fg', builtin.live_grep, { desc = '[F]ind by [G]rep' }) + vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' }) + vim.keymap.set('n', 'fr', builtin.resume, { desc = '[F]ind [R]esume' }) + vim.keymap.set('n', 'f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) + vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + + -- 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, + }) + end, { desc = '[/] Fuzzily search in current buffer' }) + + -- It's also possible to pass additional configuration options. + -- See `:help telescope.builtin.live_grep()` for information about particular keys + vim.keymap.set('n', 's/', function() + builtin.live_grep { + grep_open_files = true, + prompt_title = 'Live Grep in Open Files', + } + end, { desc = '[S]earch [/] in Open Files' }) + + -- Shortcut for searching your Neovim configuration files + vim.keymap.set('n', 'sn', function() + builtin.find_files { cwd = vim.fn.stdpath 'config' } + end, { desc = '[S]earch [N]eovim files' }) + end, }, + -- LSP Plugins { - -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - dependencies = { - 'nvim-treesitter/nvim-treesitter-textobjects', + -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins + -- used for completion, annotations and signatures of Neovim apis + 'folke/lazydev.nvim', + ft = 'lua', + opts = { + library = { + -- Load luvit types when the `vim.uv` word is found + { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, + }, }, - build = ':TSUpdate', }, + { + -- Main LSP Configuration + 'neovim/nvim-lspconfig', + dependencies = { + -- Automatically install LSPs and related tools to stdpath for Neovim + -- Mason must be loaded before its dependents so we need to set it up here. + -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` + { 'mason-org/mason.nvim', opts = {} }, + 'mason-org/mason-lspconfig.nvim', + 'WhoIsSethDaniel/mason-tool-installer.nvim', - -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart - -- These are some example plugins that I've included in the kickstart repository. - -- Uncomment any of the lines below to enable them. - -- require 'kickstart.plugins.autoformat', - -- require 'kickstart.plugins.debug', + -- Useful status updates for LSP. + { 'j-hui/fidget.nvim', opts = {} }, - -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` - -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping - -- up-to-date with whatever is in the kickstart repo. - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- - -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- { import = 'custom.plugins' }, -}, {}) + -- Allows extra capabilities provided by blink.cmp + 'saghen/blink.cmp', + }, + config = function() + -- Brief aside: **What is LSP?** + -- + -- LSP is an initialism you've probably heard, but might not understand what it is. + -- + -- LSP stands for Language Server Protocol. It's a protocol that helps editors + -- and language tooling communicate in a standardized fashion. + -- + -- In general, you have a "server" which is some tool built to understand a particular + -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers + -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone + -- processes that communicate with some "client" - in this case, Neovim! + -- + -- LSP provides Neovim with features like: + -- - Go to definition + -- - Find references + -- - Autocompletion + -- - Symbol Search + -- - and more! + -- + -- Thus, Language Servers are external tools that must be installed separately from + -- Neovim. This is where `mason` and related plugins come into play. + -- + -- If you're wondering about lsp vs treesitter, you can check out the wonderfully + -- and elegantly composed help section, `:help lsp-vs-treesitter` --- [[ Setting options ]] --- See `:help vim.o` --- NOTE: You can change these options as you wish! + -- This function gets run when an LSP attaches to a particular buffer. + -- That is to say, every time a new file is opened that is associated with + -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this + -- function will be executed to configure the current buffer + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), + callback = function(event) + -- NOTE: Remember that Lua is a real programming language, and as such it is possible + -- to define small helper and utility functions so you don't have to repeat yourself. + -- + -- In this case, we create a function that lets us more easily define mappings specific + -- for LSP related items. It sets the mode, buffer and description for us each time. + local map = function(keys, func, desc, mode) + mode = mode or 'n' + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end --- Set highlight on search -vim.o.hlsearch = false + -- Rename the variable under your cursor. + -- Most Language Servers support renaming across files, etc. + map('grn', vim.lsp.buf.rename, '[R]e[n]ame') --- Make line numbers default -vim.wo.number = true + -- Execute a code action, usually your cursor needs to be on top of an error + -- or a suggestion from your LSP for this to activate. + map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) --- Enable mouse mode -vim.o.mouse = 'a' + -- Find references for the word under your cursor. + map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') --- Sync clipboard between OS and Neovim. --- Remove this option if you want your OS clipboard to remain independent. --- See `:help 'clipboard'` -vim.o.clipboard = 'unnamedplus' + -- Jump to the implementation of the word under your cursor. + -- Useful when your language has ways of declaring types without an actual implementation. + map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') --- Enable break indent -vim.o.breakindent = true + -- Jump to the definition of the word under your cursor. + -- This is where a variable was first declared, or where a function is defined, etc. + -- To jump back, press . + map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') --- Save undo history -vim.o.undofile = true + -- WARN: This is not Goto Definition, this is Goto Declaration. + -- For example, in C this would take you to the header. + map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') --- Case-insensitive searching UNLESS \C or capital in search -vim.o.ignorecase = true -vim.o.smartcase = true + -- Fuzzy find all the symbols in your current document. + -- Symbols are things like variables, functions, types, etc. + map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') --- Keep signcolumn on by default -vim.wo.signcolumn = 'yes' + -- Fuzzy find all the symbols in your current workspace. + -- Similar to document symbols, except searches over your entire project. + map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') --- Decrease update time -vim.o.updatetime = 250 -vim.o.timeoutlen = 300 + -- Jump to the type of the word under your cursor. + -- Useful when you're not sure what type a variable is and you want to see + -- the definition of its *type*, not where it was *defined*. + map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') --- Set completeopt to have a better completion experience -vim.o.completeopt = 'menuone,noselect' + -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) + ---@param client vim.lsp.Client + ---@param method vim.lsp.protocol.Method + ---@param bufnr? integer some lsp support methods only in specific files + ---@return boolean + local function client_supports_method(client, method, bufnr) + if vim.fn.has 'nvim-0.11' == 1 then + return client:supports_method(method, bufnr) + else + return client.supports_method(method, { bufnr = bufnr }) + end + end --- NOTE: You should make sure your terminal supports this -vim.o.termguicolors = true + -- The following two autocommands are used to highlight references of the + -- word under your cursor when your cursor rests there for a little while. + -- See `:help CursorHold` for information about when this is executed + -- + -- When you move your cursor, the highlights will be cleared (the second autocommand). + local client = vim.lsp.get_client_by_id(event.data.client_id) + if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then + local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) + vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) --- [[ Basic Keymaps ]] + vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) --- Keymaps for better default experience --- See `:help vim.keymap.set()` -vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) + vim.api.nvim_create_autocmd('LspDetach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } + end, + }) + end --- Remap for dealing with word wrap -vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) -vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) + -- The following code creates a keymap to toggle inlay hints in your + -- code, if the language server you are using supports them + -- + -- This may be unwanted, since they displace some of your code + if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then + map('th', function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) + end, '[T]oggle Inlay [H]ints') + end + end, + }) --- [[ Highlight on yank ]] --- See `:help vim.highlight.on_yank()` -local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) -vim.api.nvim_create_autocmd('TextYankPost', { - callback = function() - vim.highlight.on_yank() - end, - group = highlight_group, - pattern = '*', -}) + -- Diagnostic Config + -- See :help vim.diagnostic.Opts + vim.diagnostic.config { + severity_sort = true, + float = { border = 'rounded', source = 'if_many' }, + underline = { severity = vim.diagnostic.severity.ERROR }, + signs = vim.g.have_nerd_font and { + text = { + [vim.diagnostic.severity.ERROR] = '󰅚 ', + [vim.diagnostic.severity.WARN] = '󰀪 ', + [vim.diagnostic.severity.INFO] = '󰋽 ', + [vim.diagnostic.severity.HINT] = '󰌶 ', + }, + } or {}, + virtual_text = { + source = 'if_many', + spacing = 2, + format = function(diagnostic) + local diagnostic_message = { + [vim.diagnostic.severity.ERROR] = diagnostic.message, + [vim.diagnostic.severity.WARN] = diagnostic.message, + [vim.diagnostic.severity.INFO] = diagnostic.message, + [vim.diagnostic.severity.HINT] = diagnostic.message, + } + return diagnostic_message[diagnostic.severity] + end, + }, + } + + -- LSP servers and clients are able to communicate to each other what features they support. + -- By default, Neovim doesn't support everything that is in the LSP specification. + -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities. + -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers. + local capabilities = require('blink.cmp').get_lsp_capabilities() + + -- Enable the following language servers + -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. + -- + -- Add any additional override configuration in the following tables. Available keys are: + -- - cmd (table): Override the default command used to start the server + -- - filetypes (table): Override the default list of associated filetypes for the server + -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. + -- - settings (table): Override the default settings passed when initializing the server. + -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ + local servers = { + -- clangd = {}, + -- gopls = {}, + -- pyright = {}, + -- rust_analyzer = {}, + -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs + -- + -- Some languages (like typescript) have entire language plugins that can be useful: + -- https://github.com/pmizio/typescript-tools.nvim + -- + -- But for many setups, the LSP (`ts_ls`) will work just fine + ts_ls = { + init_options = { + plugins = { + { + name = '@vue/typescript-plugin', + location = '', + languages = { 'vue' }, + }, + }, + }, + filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' }, + }, + + -- + + lua_ls = { + -- cmd = { ... }, + -- filetypes = { ... }, + -- capabilities = {}, + settings = { + Lua = { + completion = { + callSnippet = 'Replace', + }, + -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings + -- diagnostics = { disable = { 'missing-fields' } }, + }, + }, + }, + } + + -- Ensure the servers and tools above are installed + -- + -- To check the current status of installed tools and/or manually install + -- other tools, you can run + -- :Mason + -- + -- You can press `g?` for help in this menu. + -- + -- `mason` had to be setup earlier: to configure its options see the + -- `dependencies` table for `nvim-lspconfig` above. + -- + -- You can add other tools here that you want Mason to install + -- for you, so that they are available from within Neovim. + local ensure_installed = vim.tbl_keys(servers or {}) + vim.list_extend(ensure_installed, { + 'stylua', -- Used to format Lua code + }) + require('mason-tool-installer').setup { ensure_installed = ensure_installed } + + require('mason-lspconfig').setup { + ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) + automatic_installation = false, + handlers = { + function(server_name) + local server = servers[server_name] or {} + -- This handles overriding only values explicitly passed + -- by the server configuration above. Useful when disabling + -- certain features of an LSP (for example, turning off formatting for ts_ls) + server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) + require('lspconfig')[server_name].setup(server) + end, + }, + } + local vue_language_server_path = vim.fn.expand '$MASON/packages' .. '/vue-language-server' .. '/node_modules/@vue/language-server' + + local vue_plugin = { + name = '@vue/typescript-plugin', + location = vue_language_server_path, + languages = { 'vue' }, + configNamespace = 'typescript', + } + + local vtsls_config = { + settings = { + vtsls = { + tsserver = { + globalPlugins = { + vue_plugin, + }, + }, + }, + }, + filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' }, + } + + local vue_ls_config = { + on_init = function(client) + client.handlers['tsserver/request'] = function(_, result, context) + local clients = vim.lsp.get_clients { bufnr = context.bufnr, name = 'vtsls' } + if #clients == 0 then + vim.notify('Could not find `vtsls` lsp client, `vue_ls` would not work without it.', vim.log.levels.ERROR) + return + end + local ts_client = clients[1] + + local param = unpack(result) + local id, command, payload = unpack(param) + ts_client:exec_cmd({ + title = 'vue_request_forward', -- You can give title anything as it's used to represent a command in the UI, `:h Client:exec_cmd` + command = 'typescript.tsserverRequest', + arguments = { + command, + payload, + }, + }, { bufnr = context.bufnr }, function(_, r) + local response = r and r.body + -- TODO: handle error or response nil here, e.g. logging + -- NOTE: Do NOT return if there's an error or no response, just return nil back to the vue_ls to prevent memory leak + local response_data = { { id, response } } --- [[ Configure Telescope ]] --- See `:help telescope` and `:help telescope.setup()` -require('telescope').setup { - defaults = { - mappings = { - i = { - [''] = false, - [''] = false, + ---@diagnostic disable-next-line: param-type-mismatch + client:notify('tsserver/response', response_data) + end) + end + end, + } + -- nvim 0.11 or above + vim.lsp.config('vtsls', vtsls_config) + vim.lsp.config('vue_ls', vue_ls_config) + vim.lsp.enable { 'vtsls', 'vue_ls' } + end, + }, + + { -- Autoformat + 'stevearc/conform.nvim', + event = { 'BufWritePre' }, + cmd = { 'ConformInfo' }, + keys = { + { + 'f', + function() + require('conform').format { async = true, lsp_format = 'fallback' } + end, + mode = '', + desc = '[F]ormat buffer', }, }, - }, -} - --- Enable telescope fzf native, if installed -pcall(require('telescope').load_extension, 'fzf') - --- Enable telescope ui select -require("telescope").load_extension("ui-select") - --- See `:help telescope.builtin` -vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) -vim.keymap.set('n', '', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) -vim.keymap.set('n', '/', function() - -- You can pass additional configuration to telescope to change theme, layout, etc. - require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) -end, { desc = '[/] Fuzzily search in current buffer' }) - -vim.keymap.set('n', '', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) -vim.keymap.set('n', 'ff', require('telescope.builtin').find_files, { desc = '[f]ind [f]iles' }) -vim.keymap.set('n', 'fF', function() require('telescope.builtin').find_files({ hidden = true }) end, { desc = '[f]ind [F]iles (hidden)' }) -vim.keymap.set('n', 'fh', require('telescope.builtin').help_tags, { desc = '[f]ind [H]elp' }) --- vim.keymap.set('n', 'fg', require('telescope.builtin').grep_string, { desc = '[f]ind [g]rep' }) -vim.keymap.set('n', 'fg', require('telescope.builtin').live_grep, { desc = '[f]ind by [G]rep' }) -vim.keymap.set('n', 'fd', require('telescope.builtin').diagnostics, { desc = '[f]ind [D]iagnostics' }) -vim.keymap.set('n', 'fr', require('telescope.builtin').resume, { desc = '[f]ind [R]resume' }) -vim.keymap.set('n', 'fb', require('telescope.builtin').buffers, { desc = '[f]ind [B]uffers' }) - --- [[ Configure Treesitter ]] --- See `:help nvim-treesitter` -require('nvim-treesitter.configs').setup { - -- Add languages to be installed here that you want installed for treesitter - ensure_installed = - { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' }, - - -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) - auto_install = false, - modules = {}, - sync_install = false, - ignore_install = {}, - parser_install_dir = nil, - - highlight = { enable = true }, - indent = { enable = true }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = '', - node_incremental = '', - scope_incremental = '', - node_decremental = '', + opts = { + notify_on_error = false, + format_on_save = function(bufnr) + -- Disable "format_on_save lsp_fallback" for languages that don't + -- have a well standardized coding style. You can add additional + -- languages here or re-enable it for the disabled ones. + local disable_filetypes = { c = true, cpp = true } + if disable_filetypes[vim.bo[bufnr].filetype] then + return nil + else + return { + timeout_ms = 500, + lsp_format = 'fallback', + } + end + end, + formatters_by_ft = { + lua = { 'stylua' }, + -- Conform can also run multiple formatters sequentially + -- python = { "isort", "black" }, + -- + -- You can use 'stop_after_first' to run the first available formatter from the list + -- javascript = { "prettierd", "prettier", stop_after_first = true }, + }, }, }, - textobjects = { - select = { - enable = true, - lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim - keymaps = { - -- You can use the capture groups defined in textobjects.scm - ['aa'] = '@parameter.outer', - ['ia'] = '@parameter.inner', - ['af'] = '@function.outer', - ['if'] = '@function.inner', - ['ac'] = '@class.outer', - ['ic'] = '@class.inner', + + { -- Autocompletion + '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', }, - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - [']m'] = '@function.outer', - [']]'] = '@class.outer', - }, - goto_next_end = { - [']M'] = '@function.outer', - [']['] = '@class.outer', + --- @module 'blink.cmp' + --- @type blink.cmp.Config + opts = { + keymap = { + -- 'default' (recommended) for mappings similar to built-in completions + -- to accept ([y]es) the completion. + -- This will auto-import if your LSP supports it. + -- This will expand snippets if the LSP sent a snippet. + -- 'super-tab' for tab to accept + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- For an understanding of why the 'default' preset is recommended, + -- you will need to read `:help ins-completion` + -- + -- No, but seriously. Please read `:help ins-completion`, it is really good! + -- + -- All presets have the following mappings: + -- /: move to right/left of your snippet expansion + -- : Open menu or open docs if already open + -- / or /: Select next/previous item + -- : Hide menu + -- : Toggle signature help + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + preset = 'super-tab', + + -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: + -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps }, - goto_previous_start = { - ['[m'] = '@function.outer', - ['[['] = '@class.outer', + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = 'mono', }, - goto_previous_end = { - ['[M'] = '@function.outer', - ['[]'] = '@class.outer', + + completion = { + -- 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 }, }, - }, - }, -} --- Diagnostic keymaps -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) -vim.keymap.set('n', 'dq', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) - --- [[ Configure LSP ]] --- This function gets run when an LSP connects to a particular buffer. -local on_attach = function(_, bufnr) - -- NOTE: Remember that lua is a real programming language, and as such it is possible - -- to define small helper and utility functions so you don't have to repeat yourself - -- many times. - -- - -- In this case, we create a function that lets us more easily define mappings specific - -- for LSP related items. It sets the mode, buffer and description for us each time. - local nmap = function(keys, func, desc) - if desc then - desc = 'LSP: ' .. desc - end - - vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) - end + sources = { + default = { 'lsp', 'path', 'snippets', 'lazydev' }, + providers = { + lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, + }, + }, - nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') - nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') - - nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') - nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') - nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') - nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') - - -- See `:help K` for why this keymap - nmap('K', vim.lsp.buf.hover, 'Hover Documentation') - -- nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') - - -- Lesser used LSP functionality - nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') - nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') - nmap('wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, '[W]orkspace [L]ist Folders') - - -- Create a command `:Format` local to the LSP buffer - vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) - vim.lsp.buf.format() - end, { desc = 'Format current buffer with LSP' }) -end + snippets = { preset = 'luasnip' }, --- Enable the following language servers --- Feel free to add/remove any LSPs that you want here. They will automatically be installed. --- --- Add any additional override configuration in the following tables. They will be passed to --- the `settings` field of the server config. You must look up that documentation yourself. --- --- If you want to override the default filetypes that your language server will attach to you can --- define the property 'filetypes' to the map in question. -local servers = { - -- clangd = {}, - gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, - tsserver = {}, - volar = { - filetypes = { 'vue', 'javascript', 'typescript', 'javascriptreact', 'typescriptreact' }, - init_options = { - vue = { - hybridMode = false, - }, - typescript = { - -- Global install of typescript - --tsdk = '~/.nvm/versions/node/v20.11.1/lib/node_modules/typescript', - -- Current project version and what I will likely use - tsdk = vim.fn.getcwd() .. "node_modules/typescript/lib", + -- Blink.cmp includes an optional, recommended rust fuzzy matcher, + -- which automatically downloads a prebuilt binary when enabled. + -- + -- By default, we use the Lua implementation instead, but you may enable + -- the rust implementation via `'prefer_rust_with_warning'` + -- + -- See :h blink-cmp-config-fuzzy for more information + fuzzy = { implementation = 'lua' }, - }, + -- Shows a signature help window while you type arguments for a function + signature = { enabled = true }, }, }, - - -- html = { filetypes = { 'html', 'twig', 'hbs'} }, - lua_ls = { - Lua = { - workspace = { checkThirdParty = false }, - telemetry = { enable = false }, - }, + { -- You can easily change to a different colorscheme. + -- Change the name of the colorscheme plugin below, and then + -- 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', + 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 + }, + } + + -- 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' + end, }, -} - --- Setup neovim lua configuration -require('neodev').setup() - --- nvim-cmp supports additional completion capabilities, so broadcast that to servers -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) - --- Ensure the servers above are installed -local mason_lspconfig = require 'mason-lspconfig' - -mason_lspconfig.setup { - ensure_installed = vim.tbl_keys(servers), -} - -mason_lspconfig.setup_handlers { - function(server_name) - require('lspconfig')[server_name].setup { - capabilities = capabilities, - on_attach = on_attach, - settings = servers[server_name], - filetypes = (servers[server_name] or {}).filetypes, - } - end -} - --- [[ Configure nvim-cmp ]] --- See `:help cmp` -local cmp = require 'cmp' -local luasnip = require 'luasnip' -require('luasnip.loaders.from_vscode').lazy_load() -luasnip.config.setup {} - -cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) + + -- Highlight todo, notes, etc in comments + { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, + + { -- Collection of various small independent plugins/modules + 'echasnovski/mini.nvim', + config = function() + -- Better Around/Inside textobjects + -- + -- Examples: + -- - va) - [V]isually select [A]round [)]paren + -- - yinq - [Y]ank [I]nside [N]ext [Q]uote + -- - ci' - [C]hange [I]nside [']quote + require('mini.ai').setup { n_lines = 500 } + + -- Add/delete/replace surroundings (brackets, quotes, etc.) + -- + -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren + -- - sd' - [S]urround [D]elete [']quotes + -- - sr)' - [S]urround [R]eplace [)] ['] + require('mini.surround').setup() + + -- Simple and easy statusline. + -- You could remove this setup call if you don't like it, + -- and try some other statusline plugin + local statusline = require 'mini.statusline' + -- set use_icons to true if you have a Nerd Font + statusline.setup { use_icons = vim.g.have_nerd_font } + + -- You can configure sections in the statusline by overriding their + -- default behavior. For example, here we set the section for + -- cursor location to LINE:COLUMN + ---@diagnostic disable-next-line: duplicate-set-field + statusline.section_location = function() + return '%2l:%-2v' + end + + -- ... and there is more! + -- Check out: https://github.com/echasnovski/mini.nvim end, }, - revision = 1, - mapping = cmp.mapping.preset.insert { - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete {}, - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, + { -- 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' } }, }, - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { 'i', 's' }), + -- 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 }, - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, + + -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the + -- init.lua. If you want these files, they are in the repository, so you can just download them and + -- place them in the correct locations. + + -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart + -- + -- 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.autopairs', + -- 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' }, + -- + -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` + -- Or use telescope! + -- In normal mode type `sh` then write `lazy.nvim-plugin` + -- you can continue same window with `sr` which resumes last telescope search +}, { + ui = { + -- If you are using a Nerd Font: set icons to an empty table which will use the + -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table + icons = vim.g.have_nerd_font and {} or { + cmd = '⌘', + config = '🛠', + event = '📅', + ft = '📂', + init = '⚙', + keys = '🗝', + plugin = '🔌', + runtime = '💻', + require = '🌙', + source = '📄', + start = '🚀', + task = '📌', + lazy = '💤 ', + }, }, -} +}) +require 'arnoldlei.set' +require 'arnoldlei.remap' -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et -require('arnoldlei.set') -require('arnoldlei.remap') diff --git a/lazy-lock.json b/lazy-lock.json index a872c75a4ff..37c77c31bda 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,33 +1,23 @@ { - "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "LuaSnip": { "branch": "master", "commit": "73813308abc2eaeff2bc0d3f2f79270c491be9d7" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" }, - "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "curl.nvim": { "branch": "main", "commit": "3ee14fbafc8169fc803e80562ce7ac5b4474bdff" }, + "blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" }, + "conform.nvim": { "branch": "master", "commit": "9d859cbfbde7a1bd1770e7c97aef30ec5a237a71" }, "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, - "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "git-blame.nvim": { "branch": "master", "commit": "9874ec1ec8bc53beb33b7cd82c092b85271a578b" }, "gitsigns.nvim": { "branch": "main", "commit": "1ee5c1fd068c81f9dd06483e639c2aa4587dc197" }, - "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" }, - "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, "lazy.nvim": { "branch": "main", "commit": "59334064f8604ca073791c25dcc5c9698865406e" }, - "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, + "lazydev.nvim": { "branch": "main", "commit": "258d2a5ef4a3e3d6d9ba9da72c9725c53e9afcbd" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "155eac5d8609a2f110041f8ac3491664cc126354" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, - "mini.icons": { "branch": "main", "commit": "284798619aed9f4c1ac1b9417b9a5e3b4b85ef3a" }, - "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, - "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "mini.nvim": { "branch": "main", "commit": "61a5d44a8f31370710e6a998c5a8ee7e61c7e576" }, "nvim-lspconfig": { "branch": "master", "commit": "e688b486fe9291f151eae7e5c0b5a5c4ef980847" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "71385f191ec06ffc60e80e6b0c9a9d5daed4824c" }, - "oil.nvim": { "branch": "master", "commit": "919e155fdf38e9148cdb5304faaaf53c20d703ea" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, - "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "tokyonight.nvim": { "branch": "main", "commit": "4d159616aee17796c2c94d2f5f87d2ee1a3f67c7" }, - "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, - "vim-rhubarb": { "branch": "master", "commit": "5496d7c94581c4c9ad7430357449bb57fc59f501" }, - "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, "which-key.nvim": { "branch": "main", "commit": "904308e6885bbb7b60714c80ab3daf0c071c1492" } } diff --git a/lua/arnoldlei/remap.lua b/lua/arnoldlei/remap.lua index f606fe4854c..a1670942e7b 100644 --- a/lua/arnoldlei/remap.lua +++ b/lua/arnoldlei/remap.lua @@ -1,56 +1,56 @@ -vim.g.mapleader = " " --- vim.keymap.set("n", "pv", vim.cmd.Ex) -vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory" }) -vim.keymap.set("n", "pv", "Oil", { desc = "Open parent directory" }) +vim.g.mapleader = ' ' +vim.keymap.set('n', 'pv', vim.cmd.Ex) +vim.keymap.set('n', '-', 'Oil', { desc = 'Open parent directory' }) +-- vim.keymap.set("n", "pv", "Oil", { desc = "Open parent directory" }) -- Window splits -vim.keymap.set("n", "|", "vsplit", { desc = "Split window vertically" }) -vim.keymap.set("n", "_", "split", { desc = "Split window horizontally" }) +vim.keymap.set('n', '|', 'vsplit', { desc = 'Split window vertically' }) +vim.keymap.set('n', '_', 'split', { desc = 'Split window horizontally' }) -- Window navigation -vim.keymap.set("n", "", "h", { desc = "Move to left window" }) -vim.keymap.set("n", "", "j", { desc = "Move to window below" }) -vim.keymap.set("n", "", "k", { desc = "Move to window above" }) -vim.keymap.set("n", "", "l", { desc = "Move to right window" }) +vim.keymap.set('n', '', 'h', { desc = 'Move to left window' }) +vim.keymap.set('n', '', 'j', { desc = 'Move to window below' }) +vim.keymap.set('n', '', 'k', { desc = 'Move to window above' }) +vim.keymap.set('n', '', 'l', { desc = 'Move to right window' }) -vim.keymap.set("v", "J", ":m '>+1gv=gv") -vim.keymap.set("v", "K", ":m '<-2gv=gv") +vim.keymap.set('v', 'J', ":m '>+1gv=gv") +vim.keymap.set('v', 'K', ":m '<-2gv=gv") -vim.keymap.set("n", "J", "mzJ`z") -vim.keymap.set("n", "", "zz") -vim.keymap.set("n", "", "zz") -vim.keymap.set("n", "n", "nzzzv") -vim.keymap.set("n", "N", "Nzzzv") +vim.keymap.set('n', 'J', 'mzJ`z') +vim.keymap.set('n', '', 'zz') +vim.keymap.set('n', '', 'zz') +vim.keymap.set('n', 'n', 'nzzzv') +vim.keymap.set('n', 'N', 'Nzzzv') -- greatest remap ever -vim.keymap.set("x", "p", [["_dP]]) +vim.keymap.set('x', 'p', [["_dP]]) -- next greatest remap ever : asbjornHaland -vim.keymap.set({ "n", "v" }, "y", [["+y]]) -vim.keymap.set("n", "Y", [["+Y]]) +vim.keymap.set({ 'n', 'v' }, 'y', [["+y]]) +vim.keymap.set('n', 'Y', [["+Y]]) -vim.keymap.set({ "n", "v" }, "d", [["_d]]) +vim.keymap.set({ 'n', 'v' }, 'd', [["_d]]) -- This is going to get me cancelled -vim.keymap.set("i", "", "") +vim.keymap.set('i', '', '') -vim.keymap.set("n", "Q", "") -vim.keymap.set("n", "", "silent !tmux neww tmux-sessionizer") -vim.keymap.set("n", "f", vim.lsp.buf.format) +vim.keymap.set('n', 'Q', '') +vim.keymap.set('n', '', 'silent !tmux neww tmux-sessionizer') +vim.keymap.set('n', 'f', vim.lsp.buf.format) -- vim.keymap.set("n", "", "cnextzz") -- vim.keymap.set("n", "", "cprevzz") -vim.keymap.set("n", "k", "lnextzz") -vim.keymap.set("n", "j", "lprevzz") +vim.keymap.set('n', 'k', 'lnextzz') +vim.keymap.set('n', 'j', 'lprevzz') -vim.keymap.set("n", "s", [[:%s/\<\>//gI]]) -vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) +vim.keymap.set('n', 's', [[:%s/\<\>//gI]]) +vim.keymap.set('n', 'x', '!chmod +x %', { silent = true }) -vim.keymap.set("n", "vpp", "e ~/.dotfiles/nvim/.config/nvim/lua/theprimeagen/packer.lua"); -vim.keymap.set("n", "mr", "CellularAutomaton make_it_rain"); +vim.keymap.set('n', 'vpp', 'e ~/.dotfiles/nvim/.config/nvim/lua/theprimeagen/packer.lua') +vim.keymap.set('n', 'mr', 'CellularAutomaton make_it_rain') -vim.keymap.set("n", "sf", ":source $HOME/.config/nvim/init.lua ", { desc = "Source Neovim config" }) +vim.keymap.set('n', 'sf', ':source $HOME/.config/nvim/init.lua ', { desc = 'Source Neovim config' }) -vim.keymap.set("n", "", function() - vim.cmd("so") +vim.keymap.set('n', '', function() + vim.cmd 'so' end) diff --git a/lua/plugins/comment.lua b/lua/plugins/comment.lua deleted file mode 100644 index e6b597dbdc5..00000000000 --- a/lua/plugins/comment.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - 'numToStr/Comment.nvim', - opts = { - -- add any options here - }, - lazy = false, -} diff --git a/lua/plugins/curl.lua b/lua/plugins/curl.lua deleted file mode 100644 index 293d8265e03..00000000000 --- a/lua/plugins/curl.lua +++ /dev/null @@ -1,31 +0,0 @@ -return { - "oysandvik94/curl.nvim", - cmd = { "CurlOpen" }, - dependencies = { - "nvim-lua/plenary.nvim", - }, - config = true, - keys = { - { "cc", "lua require('curl').open_curl_tab()", desc = "Open a curl tab scoped to the current working directory" }, - { "csc", "lua require('curl').create_scoped_collection()", desc = "Create or open a collection with a name from user input" }, - { "cgc", "lua require('curl').create_global_collection()", desc = "Create or open a global collection with a name from user input" }, - }, - on_attach = function (bufnr) - -- These commands will prompt you for a name for your collection - vim.keymap.set("n", "csc", function() - curl.create_scoped_collection() - end, { desc = "Create or open a collection with a name from user input" }) - - vim.keymap.set("n", "cgc", function() - curl.create_global_collection() - end, { desc = "Create or open a global collection with a name from user input" }) - - vim.keymap.set("n", "fsc", function() - curl.pick_scoped_collection() - end, { desc = "Choose a scoped collection and open it" }) - - vim.keymap.set("n", "fgc", function() - curl.pick_global_collection() - end, { desc = "Choose a global collection and open it" }) - end -} diff --git a/lua/plugins/harpoon.lua b/lua/plugins/harpoon.lua deleted file mode 100644 index d7c3e97cea5..00000000000 --- a/lua/plugins/harpoon.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - "ThePrimeagen/harpoon", - branch = "harpoon2", - lazy = false, - dependencies = { - "nvim-lua/plenary.nvim", - }, - config = true, - keys = { - { "a", "lua require('harpoon.mark').add_file()", desc = "Mark file with harpoon" }, - { "", "lua require('harpoon.ui').toggle_quick_menu()", desc = "Show harpoon marks" }, - -- { "", "lua require('harpoon.ui').nav_file(1)", desc = "Navigate to first file in Harpoon" }, - -- { "", "lua require('harpoon.ui').nav_file(2)", desc = "Navigate to second file in Harpoon" }, - -- { "", "lua require('harpoon.ui').nav_file(3)", desc = "Navigate to third file in Harpoon" }, - -- { "", "lua require('harpoon.ui').nav_file(4)", desc = "Navigate to fourth file in Harpoon" }, - }, -} - diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua deleted file mode 100644 index 8f5d6ff50d2..00000000000 --- a/lua/plugins/oil.lua +++ /dev/null @@ -1,11 +0,0 @@ -return { - 'stevearc/oil.nvim', - ---@module 'oil' - ---@type oil.SetupOpts - opts = {}, - -- Optional dependencies - dependencies = { { "nvim-mini/mini.icons", opts = {} } }, - -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons - -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. - lazy = false, -} From e8e3ee376949aff25b6cfd1d6d93a33654b5b7f0 Mon Sep 17 00:00:00 2001 From: Arnold Lei Date: Sun, 5 Oct 2025 21:43:14 -0600 Subject: [PATCH 18/22] moved some files --- .DS_Store | Bin 0 -> 6148 bytes lua/.DS_Store | Bin 0 -> 6148 bytes lua/custom/.DS_Store | Bin 0 -> 6148 bytes lua/custom/plugins/comment.lua | 7 +++++ lua/custom/plugins/curl.lua | 31 ++++++++++++++++++++++ lua/custom/plugins/harpoon.lua | 46 +++++++++++++++++++++++++++++++++ lua/custom/plugins/oil.lua | 11 ++++++++ 7 files changed, 95 insertions(+) create mode 100644 .DS_Store create mode 100644 lua/.DS_Store create mode 100644 lua/custom/.DS_Store create mode 100644 lua/custom/plugins/comment.lua create mode 100644 lua/custom/plugins/curl.lua create mode 100644 lua/custom/plugins/harpoon.lua create mode 100644 lua/custom/plugins/oil.lua diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..960f340fc29f5045dd8d357f27060dc4cd24360d GIT binary patch literal 6148 zcmeHKv2DXZ3?yS02GY1p`730Dhv7`%1(H~$02P6IRhcWJ<&Go*8-j`yZj2*9-iy!s zhprGsGxNh`cs1Lb*$z&$Z-%9DpT4lC$`GAroX5{;8nLv^qIe}i?#2e2>^yv3^GCbb z$8~Du0HvjX6p#W^Knh5Ke<{F54ck2@DoOzoD-979yjBhy4h<&@wgrN7UkwWQBev=fm;P? zNZ+&nzrk1L|67utq<|E7C#^56 zwmik{Er7D#b$7rDz>;o=FB|4&`{pyd$cSO_GkSFB@q*WGoMoR6821`a_`o{`a*zCN z|2zymkHr88#e>ymL3qV{j?8dqG62xi&VoRI?8KIS+5`$W@#VA2%yk=fYoC1T6;y3f0yt!nD zQv7zttEZ#1K#fvB3Y;o%8OxQ`|9kom{r@RRD=8oa{*?k{v3c06`J}9^v&UJjt@KB_ uPFdI4K|n{=NeKeQ0#YUN|Pkr-MVZ0K^%?VVp-V zL2Mo%_QEld5t=2Hm{hA4!;;Q;tGr$~CMF$L&4<;^Rvn7P?L5ClI;as{jB1 literal 0 HcmV?d00001 diff --git a/lua/custom/plugins/comment.lua b/lua/custom/plugins/comment.lua new file mode 100644 index 00000000000..e6b597dbdc5 --- /dev/null +++ b/lua/custom/plugins/comment.lua @@ -0,0 +1,7 @@ +return { + 'numToStr/Comment.nvim', + opts = { + -- add any options here + }, + lazy = false, +} diff --git a/lua/custom/plugins/curl.lua b/lua/custom/plugins/curl.lua new file mode 100644 index 00000000000..293d8265e03 --- /dev/null +++ b/lua/custom/plugins/curl.lua @@ -0,0 +1,31 @@ +return { + "oysandvik94/curl.nvim", + cmd = { "CurlOpen" }, + dependencies = { + "nvim-lua/plenary.nvim", + }, + config = true, + keys = { + { "cc", "lua require('curl').open_curl_tab()", desc = "Open a curl tab scoped to the current working directory" }, + { "csc", "lua require('curl').create_scoped_collection()", desc = "Create or open a collection with a name from user input" }, + { "cgc", "lua require('curl').create_global_collection()", desc = "Create or open a global collection with a name from user input" }, + }, + on_attach = function (bufnr) + -- These commands will prompt you for a name for your collection + vim.keymap.set("n", "csc", function() + curl.create_scoped_collection() + end, { desc = "Create or open a collection with a name from user input" }) + + vim.keymap.set("n", "cgc", function() + curl.create_global_collection() + end, { desc = "Create or open a global collection with a name from user input" }) + + vim.keymap.set("n", "fsc", function() + curl.pick_scoped_collection() + end, { desc = "Choose a scoped collection and open it" }) + + vim.keymap.set("n", "fgc", function() + curl.pick_global_collection() + end, { desc = "Choose a global collection and open it" }) + end +} diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua new file mode 100644 index 00000000000..a08b2c02b11 --- /dev/null +++ b/lua/custom/plugins/harpoon.lua @@ -0,0 +1,46 @@ +return { + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + lazy = false, + dependencies = { + 'nvim-lua/plenary.nvim', + }, + config = function() + local harpoon = require 'harpoon' + harpoon:setup() + + -- Keymaps + vim.keymap.set('n', 'a', function() + harpoon:list():add() + end, { desc = 'Harpoon: Mark file' }) + + vim.keymap.set('n', '', function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, { desc = 'Harpoon: Toggle quick menu' }) + + vim.keymap.set('n', 'h1', function() + harpoon:list():select(1) + end, { desc = 'Harpoon: Go to file 1' }) + + vim.keymap.set('n', 'h2', function() + harpoon:list():select(2) + end, { desc = 'Harpoon: Go to file 2' }) + + vim.keymap.set('n', 'h3', function() + harpoon:list():select(3) + end, { desc = 'Harpoon: Go to file 3' }) + + vim.keymap.set('n', 'h4', function() + harpoon:list():select(4) + end, { desc = 'Harpoon: Go to file 4' }) + + -- Navigate to previous & next buffers in the list + vim.keymap.set('n', '', function() + harpoon:list():prev() + end, { desc = 'Harpoon: Previous buffer' }) + + vim.keymap.set('n', '', function() + harpoon:list():next() + end, { desc = 'Harpoon: Next buffer' }) + end, +} diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua new file mode 100644 index 00000000000..8f5d6ff50d2 --- /dev/null +++ b/lua/custom/plugins/oil.lua @@ -0,0 +1,11 @@ +return { + 'stevearc/oil.nvim', + ---@module 'oil' + ---@type oil.SetupOpts + opts = {}, + -- Optional dependencies + dependencies = { { "nvim-mini/mini.icons", opts = {} } }, + -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons + -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. + lazy = false, +} From afafe9735c000b2835589d5f46b62c1b889c2134 Mon Sep 17 00:00:00 2001 From: Arnold Lei Date: Wed, 8 Oct 2025 17:58:44 -0600 Subject: [PATCH 19/22] added vue.js support --- init.lua | 31 +++++++++++++++---------------- lua/arnoldlei/remap.lua | 7 +++++-- lua/custom/plugins/gitblame.lua | 17 +++++++++++++++++ lua/custom/plugins/oil.lua | 33 +++++++++++++++++++++++++++++++-- 4 files changed, 68 insertions(+), 20 deletions(-) create mode 100644 lua/custom/plugins/gitblame.lua diff --git a/init.lua b/init.lua index f623a9dc6d5..ce673961560 100644 --- a/init.lua +++ b/init.lua @@ -436,6 +436,7 @@ require('lazy').setup({ vim.keymap.set('n', 'fr', builtin.resume, { desc = '[F]ind [R]esume' }) vim.keymap.set('n', 'f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + -- vim.api.nvim_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', { noremap = true, silent = true }) -- Slightly advanced example of overriding default behavior and theme vim.keymap.set('n', '/', function() @@ -534,7 +535,12 @@ require('lazy').setup({ mode = mode or 'n' vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) end - + vim.api.nvim_create_autocmd({ 'LspAttach' }, { + callback = function() + -- Map 'gd' to go to definition using Telescope's LSP definitions picker + vim.keymap.set('n', 'gd', require('telescope.builtin').lsp_definitions, { buffer = 0, desc = 'Go to definition' }) + end, + }) -- Rename the variable under your cursor. -- Most Language Servers support renaming across files, etc. map('grn', vim.lsp.buf.rename, '[R]e[n]ame') @@ -681,19 +687,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 = { - init_options = { - plugins = { - { - name = '@vue/typescript-plugin', - location = '', - languages = { 'vue' }, - }, - }, - }, - filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' }, - }, - + ts_ls = {}, -- lua_ls = { @@ -745,8 +739,8 @@ require('lazy').setup({ end, }, } - local vue_language_server_path = vim.fn.expand '$MASON/packages' .. '/vue-language-server' .. '/node_modules/@vue/language-server' + local vue_language_server_path = vim.fn.expand '$MASON/packages' .. '/vue-language-server' .. '/node_modules/@vue/language-server' local vue_plugin = { name = '@vue/typescript-plugin', location = vue_language_server_path, @@ -825,7 +819,7 @@ require('lazy').setup({ -- Disable "format_on_save lsp_fallback" for languages that don't -- have a well standardized coding style. You can add additional -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true } + local disable_filetypes = { c = true, cpp = true, vue = true } if disable_filetypes[vim.bo[bufnr].filetype] then return nil else @@ -920,6 +914,11 @@ 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 = { + border = 'rounded', + -- Show completion menu at cursor position + direction_priority = { 's', 'n' }, + }, }, sources = { diff --git a/lua/arnoldlei/remap.lua b/lua/arnoldlei/remap.lua index a1670942e7b..eccc412d9b6 100644 --- a/lua/arnoldlei/remap.lua +++ b/lua/arnoldlei/remap.lua @@ -1,7 +1,6 @@ vim.g.mapleader = ' ' -vim.keymap.set('n', 'pv', vim.cmd.Ex) vim.keymap.set('n', '-', 'Oil', { desc = 'Open parent directory' }) --- vim.keymap.set("n", "pv", "Oil", { desc = "Open parent directory" }) +vim.keymap.set('n', 'pv', 'Oil', { desc = 'Open parent directory' }) -- Window splits vim.keymap.set('n', '|', 'vsplit', { desc = 'Split window vertically' }) @@ -54,3 +53,7 @@ vim.keymap.set('n', 'sf', ':source $HOME/.config/nvim/init.lua ', { vim.keymap.set('n', '', function() vim.cmd 'so' end) + +-- Jump to beginning/end of method +vim.keymap.set('n', '[m', '[m', { desc = 'Jump to beginning of method' }) +vim.keymap.set('n', ']m', ']m', { desc = 'Jump to end of method' }) diff --git a/lua/custom/plugins/gitblame.lua b/lua/custom/plugins/gitblame.lua new file mode 100644 index 00000000000..97a16202f23 --- /dev/null +++ b/lua/custom/plugins/gitblame.lua @@ -0,0 +1,17 @@ +return { + 'f-person/git-blame.nvim', + -- load the plugin at startup + event = 'VeryLazy', + -- Because of the keys part, you will be lazy loading this plugin. + -- The plugin will only load once one of the keys is used. + -- If you want to load the plugin at startup, add something like event = "VeryLazy", + -- or lazy = false. One of both options will work. + opts = { + -- your configuration comes here + -- for example + enabled = true, -- if you want to enable the plugin + message_template = ' • <>', -- template for the blame message, check the Message template section for more options + date_format = '%m-%d-%Y %H:%M:%S', -- template for the date, check Date format section for more options + virtual_text_column = 1, -- virtual text start column, check Start virtual text at column section for more options + }, +} diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua index 8f5d6ff50d2..8a8b577b0d5 100644 --- a/lua/custom/plugins/oil.lua +++ b/lua/custom/plugins/oil.lua @@ -2,9 +2,38 @@ return { 'stevearc/oil.nvim', ---@module 'oil' ---@type oil.SetupOpts - opts = {}, + opts = { + view_options = { + -- Show files and directories that start with "." + show_hidden = true, + -- This function defines what is considered a "hidden" file + is_hidden_file = function(name, bufnr) + local m = name:match '^%.' + return m ~= nil + end, + -- This function defines what will never be shown, even when `show_hidden` is set + is_always_hidden = function(name, bufnr) + return false + end, + -- Sort file names with numbers in a more intuitive order for humans. + -- Can be "fast", true, or false. "fast" will turn it off for large directories. + natural_order = 'fast', + -- Sort file and directory names case insensitive + case_insensitive = false, + sort = { + -- sort order can be "asc" or "desc" + -- see :help oil-columns to see which columns are sortable + { 'type', 'asc' }, + { 'name', 'asc' }, + }, + -- Customize the highlight group for the file name + highlight_filename = function(entry, is_hidden, is_link_target, is_link_orphan) + return nil + end, + }, + }, -- Optional dependencies - dependencies = { { "nvim-mini/mini.icons", opts = {} } }, + dependencies = { { 'nvim-mini/mini.icons', opts = {} } }, -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. lazy = false, From 276aea77a55569ea689938879ef56062c6df890b Mon Sep 17 00:00:00 2001 From: Arnold <4966358+arnold-lei@users.noreply.github.com> Date: Tue, 25 Nov 2025 13:54:47 -0700 Subject: [PATCH 20/22] adding all my latest changes --- init.lua | 79 +++++----- lazy-lock.json | 41 +++-- lua/arnoldlei/remap.lua | 23 ++- lua/custom/plugins/TEST.md | 1 + lua/custom/plugins/harpoon.lua | 8 +- lua/custom/plugins/lazygit.lua | 22 +++ lua/custom/plugins/theme-switcher.lua | 18 +++ lua/custom/themes/theme.lua | 117 ++++++++++++++ lua/theme-switcher/fuzzy.lua | 101 ++++++++++++ lua/theme-switcher/init.lua | 216 ++++++++++++++++++++++++++ lua/theme-switcher/persistence.lua | 33 ++++ lua/theme-switcher/themes.lua | 48 ++++++ lua/theme-switcher/ui.lua | 124 +++++++++++++++ 13 files changed, 769 insertions(+), 62 deletions(-) create mode 100644 lua/custom/plugins/TEST.md create mode 100644 lua/custom/plugins/lazygit.lua create mode 100644 lua/custom/plugins/theme-switcher.lua create mode 100644 lua/custom/themes/theme.lua create mode 100644 lua/theme-switcher/fuzzy.lua create mode 100644 lua/theme-switcher/init.lua create mode 100644 lua/theme-switcher/persistence.lua create mode 100644 lua/theme-switcher/themes.lua create mode 100644 lua/theme-switcher/ui.lua diff --git a/init.lua b/init.lua index ce673961560..ee9ea1265bb 100644 --- a/init.lua +++ b/init.lua @@ -407,11 +407,30 @@ require('lazy').setup({ -- You can put your default mappings / updates / etc. in here -- All the info you're looking for is in `:help telescope.setup()` -- - -- defaults = { - -- mappings = { - -- i = { [''] = 'to_fuzzy_refine' }, - -- }, - -- }, + defaults = { + mappings = { + i = { + [''] = 'move_selection_next', + [''] = 'move_selection_previous', + }, + }, + file_ignore_patterns = { '.git/' }, + }, + pickers = { + find_files = { + hidden = true, + }, + live_grep = { + additional_args = function() + return { '--hidden' } + end, + }, + grep_string = { + additional_args = function() + return { '--hidden' } + end, + }, + }, -- pickers = {} extensions = { ['ui-select'] = { @@ -432,14 +451,14 @@ require('lazy').setup({ vim.keymap.set('n', 'fs', builtin.builtin, { desc = '[F]ind [S]elect Telescope' }) vim.keymap.set('n', 'fw', builtin.grep_string, { desc = '[F]ind current [W]ord' }) vim.keymap.set('n', 'fg', builtin.live_grep, { desc = '[F]ind by [G]rep' }) + vim.keymap.set('n', '/', builtin.live_grep, { desc = '[F]ind by [G]rep' }) vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' }) vim.keymap.set('n', 'fr', builtin.resume, { desc = '[F]ind [R]esume' }) vim.keymap.set('n', 'f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) - -- vim.api.nvim_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', { noremap = true, silent = true }) -- Slightly advanced example of overriding default behavior and theme - vim.keymap.set('n', '/', function() + vim.keymap.set('n', 'f/', 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, @@ -688,6 +707,7 @@ require('lazy').setup({ -- -- But for many setups, the LSP (`ts_ls`) will work just fine ts_ls = {}, + cssls = {}, -- lua_ls = { @@ -819,7 +839,7 @@ require('lazy').setup({ -- Disable "format_on_save lsp_fallback" for languages that don't -- have a well standardized coding style. You can add additional -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true, vue = true } + local disable_filetypes = { c = true, cpp = true } if disable_filetypes[vim.bo[bufnr].filetype] then return nil else @@ -831,11 +851,17 @@ require('lazy').setup({ end, formatters_by_ft = { lua = { 'stylua' }, - -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, - -- - -- You can use 'stop_after_first' to run the first available formatter from the list - -- javascript = { "prettierd", "prettier", stop_after_first = true }, + javascript = { 'prettierd', 'prettier', stop_after_first = true }, + typescript = { 'prettierd', 'prettier', stop_after_first = true }, + javascriptreact = { 'prettierd', 'prettier', stop_after_first = true }, + typescriptreact = { 'prettierd', 'prettier', stop_after_first = true }, + vue = { 'prettierd', 'prettier', stop_after_first = true }, + css = { 'prettierd', 'prettier', stop_after_first = true }, + scss = { 'prettierd', 'prettier', stop_after_first = true }, + html = { 'prettierd', 'prettier', stop_after_first = true }, + json = { 'prettierd', 'prettier', stop_after_first = true }, + yaml = { 'prettierd', 'prettier', stop_after_first = true }, + markdown = { 'prettierd', 'prettier', stop_after_first = true }, }, }, }, @@ -895,10 +921,11 @@ require('lazy').setup({ -- : Open menu or open docs if already open -- / or /: Select next/previous item -- : Hide menu - -- : Toggle signature help -- -- See :h blink-cmp-config-keymap for defining your own keymap preset = 'super-tab', + [''] = { 'select_next', 'fallback' }, + [''] = { 'select_prev', 'fallback' }, -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps @@ -944,28 +971,6 @@ require('lazy').setup({ }, }, - { -- You can easily change to a different colorscheme. - -- Change the name of the colorscheme plugin below, and then - -- 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', - 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 - }, - } - - -- 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' - end, - }, - -- Highlight todo, notes, etc in comments { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, @@ -1053,7 +1058,9 @@ require('lazy').setup({ -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. { import = 'custom.plugins' }, + { import = 'custom.themes' }, -- + -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! -- In normal mode type `sh` then write `lazy.nvim-plugin` diff --git a/lazy-lock.json b/lazy-lock.json index 37c77c31bda..95d26921d83 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,23 +1,36 @@ { + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "LuaSnip": { "branch": "master", "commit": "73813308abc2eaeff2bc0d3f2f79270c491be9d7" }, "blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" }, - "conform.nvim": { "branch": "master", "commit": "9d859cbfbde7a1bd1770e7c97aef30ec5a237a71" }, - "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, - "gitsigns.nvim": { "branch": "main", "commit": "1ee5c1fd068c81f9dd06483e639c2aa4587dc197" }, + "catppuccin": { "branch": "main", "commit": "da33755d00e09bff2473978910168ff9ea5dc453" }, + "conform.nvim": { "branch": "master", "commit": "cde4da5c1083d3527776fee69536107d98dae6c9" }, + "curl.nvim": { "branch": "main", "commit": "3ee14fbafc8169fc803e80562ce7ac5b4474bdff" }, + "fidget.nvim": { "branch": "main", "commit": "e32b672d8fd343f9d6a76944fedb8c61d7d8111a" }, + "git-blame.nvim": { "branch": "master", "commit": "9874ec1ec8bc53beb33b7cd82c092b85271a578b" }, + "github-theme": { "branch": "main", "commit": "c106c9472154d6b2c74b74565616b877ae8ed31d" }, + "gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" }, "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, - "lazy.nvim": { "branch": "main", "commit": "59334064f8604ca073791c25dcc5c9698865406e" }, - "lazydev.nvim": { "branch": "main", "commit": "258d2a5ef4a3e3d6d9ba9da72c9725c53e9afcbd" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "155eac5d8609a2f110041f8ac3491664cc126354" }, + "harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" }, + "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, + "lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" }, + "lazygit.nvim": { "branch": "main", "commit": "2305deed25bc61b866d5d39189e9105a45cf1cfb" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "b1d9a914b02ba5660f1e272a03314b31d4576fe2" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, - "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, - "mini.nvim": { "branch": "main", "commit": "61a5d44a8f31370710e6a998c5a8ee7e61c7e576" }, - "nvim-lspconfig": { "branch": "master", "commit": "e688b486fe9291f151eae7e5c0b5a5c4ef980847" }, + "mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" }, + "mini.icons": { "branch": "main", "commit": "ff2e4f1d29f659cc2bad0f9256f2f6195c6b2428" }, + "mini.nvim": { "branch": "main", "commit": "dce9bc4e19d02d5c37fe71c16f40f8a5536b0386" }, + "monokai-pro.nvim": { "branch": "master", "commit": "1ac671f6da720cba967d28d25c2f16b8b4e18808" }, + "nightfox.nvim": { "branch": "main", "commit": "ba47d4b4c5ec308718641ba7402c143836f35aa9" }, + "nvim-lspconfig": { "branch": "master", "commit": "95fe3c170753238d3ca4f760e79a991400677abc" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "oil.nvim": { "branch": "master", "commit": "7e1cd7703ff2924d7038476dcbc04b950203b902" }, + "onedark.nvim": { "branch": "master", "commit": "6c10964f91321c6a0f09bcc41dd64e7a6602bc4f" }, + "oxocarbon.nvim": { "branch": "main", "commit": "9f85f6090322f39b11ae04a343d4eb9d12a86897" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, - "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, - "tokyonight.nvim": { "branch": "main", "commit": "4d159616aee17796c2c94d2f5f87d2ee1a3f67c7" }, - "which-key.nvim": { "branch": "main", "commit": "904308e6885bbb7b60714c80ab3daf0c071c1492" } + "telescope.nvim": { "branch": "master", "commit": "3a12a853ebf21ec1cce9a92290e3013f8ae75f02" }, + "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, + "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } } diff --git a/lua/arnoldlei/remap.lua b/lua/arnoldlei/remap.lua index eccc412d9b6..cfcac33d564 100644 --- a/lua/arnoldlei/remap.lua +++ b/lua/arnoldlei/remap.lua @@ -7,10 +7,10 @@ vim.keymap.set('n', '|', 'vsplit', { desc = 'Split window vertically' } vim.keymap.set('n', '_', 'split', { desc = 'Split window horizontally' }) -- Window navigation -vim.keymap.set('n', '', 'h', { desc = 'Move to left window' }) -vim.keymap.set('n', '', 'j', { desc = 'Move to window below' }) -vim.keymap.set('n', '', 'k', { desc = 'Move to window above' }) -vim.keymap.set('n', '', 'l', { desc = 'Move to right window' }) +-- vim.keymap.set('n', '', 'h', { desc = 'Move to left window' }) +-- vim.keymap.set('n', '', 'j', { desc = 'Move to window below' }) +-- vim.keymap.set('n', '', 'k', { desc = 'Move to window above' }) +-- vim.keymap.set('n', '', 'l', { desc = 'Move to right window' }) vim.keymap.set('v', 'J', ":m '>+1gv=gv") vim.keymap.set('v', 'K', ":m '<-2gv=gv") @@ -50,10 +50,17 @@ vim.keymap.set('n', 'mr', 'CellularAutomaton make_it_rain') vim.keymap.set('n', 'sf', ':source $HOME/.config/nvim/init.lua ', { desc = 'Source Neovim config' }) -vim.keymap.set('n', '', function() - vim.cmd 'so' -end) - -- Jump to beginning/end of method vim.keymap.set('n', '[m', '[m', { desc = 'Jump to beginning of method' }) vim.keymap.set('n', ']m', ']m', { desc = 'Jump to end of method' }) + +-- Diagnostic navigation with float +vim.keymap.set('n', '[d', function() + vim.diagnostic.goto_prev() + vim.diagnostic.open_float() +end, { desc = 'Go to previous diagnostic' }) + +vim.keymap.set('n', ']d', function() + vim.diagnostic.goto_next() + vim.diagnostic.open_float() +end, { desc = 'Go to next diagnostic' }) diff --git a/lua/custom/plugins/TEST.md b/lua/custom/plugins/TEST.md new file mode 100644 index 00000000000..478c4bce84e --- /dev/null +++ b/lua/custom/plugins/TEST.md @@ -0,0 +1 @@ +[a relative link](../../../README.md.md) diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua index a08b2c02b11..160b490f388 100644 --- a/lua/custom/plugins/harpoon.lua +++ b/lua/custom/plugins/harpoon.lua @@ -18,19 +18,19 @@ return { harpoon.ui:toggle_quick_menu(harpoon:list()) end, { desc = 'Harpoon: Toggle quick menu' }) - vim.keymap.set('n', 'h1', function() + vim.keymap.set('n', '', function() harpoon:list():select(1) end, { desc = 'Harpoon: Go to file 1' }) - vim.keymap.set('n', 'h2', function() + vim.keymap.set('n', '', function() harpoon:list():select(2) end, { desc = 'Harpoon: Go to file 2' }) - vim.keymap.set('n', 'h3', function() + vim.keymap.set('n', '', function() harpoon:list():select(3) end, { desc = 'Harpoon: Go to file 3' }) - vim.keymap.set('n', 'h4', function() + vim.keymap.set('n', '', function() harpoon:list():select(4) end, { desc = 'Harpoon: Go to file 4' }) diff --git a/lua/custom/plugins/lazygit.lua b/lua/custom/plugins/lazygit.lua new file mode 100644 index 00000000000..86d809114fb --- /dev/null +++ b/lua/custom/plugins/lazygit.lua @@ -0,0 +1,22 @@ +return { + 'kdheepak/lazygit.nvim', + lazy = false, + cmd = { + 'LazyGit', + 'LazyGitConfig', + 'LazyGitCurrentFile', + 'LazyGitFilter', + 'LazyGitFilterCurrentFile', + }, + -- optional for floating window border decoration + dependencies = { + 'nvim-telescope/telescope.nvim', + 'nvim-lua/plenary.nvim', + }, + config = function() + require('telescope').load_extension 'lazygit' + end, + keys = { + { 'gh', 'LazyGit', desc = 'LazyGit' }, + }, +} diff --git a/lua/custom/plugins/theme-switcher.lua b/lua/custom/plugins/theme-switcher.lua new file mode 100644 index 00000000000..8ccbf0aa667 --- /dev/null +++ b/lua/custom/plugins/theme-switcher.lua @@ -0,0 +1,18 @@ +return { + dir = vim.fn.stdpath 'config' .. '/lua/theme-switcher', + name = 'theme-switcher', + lazy = false, + priority = 100, + config = function() + require('theme-switcher').setup { + save_on_select = true, + preview_on_navigate = true, + restore_on_startup = true, + } + + -- Keybindings (global, not buffer-specific) + vim.keymap.set('n', 'tt', function() + require('theme-switcher').open() + end, { desc = '[T]heme [T]oggle', noremap = true, silent = true }) + end, +} diff --git a/lua/custom/themes/theme.lua b/lua/custom/themes/theme.lua new file mode 100644 index 00000000000..02ccb684b0e --- /dev/null +++ b/lua/custom/themes/theme.lua @@ -0,0 +1,117 @@ +-- Default theme to load on startup +local DEFAULT_THEME = 'nightfox' + +return { + { + 'projekt0n/github-nvim-theme', + name = 'github-theme', + lazy = false, -- make sure we load this during startup if it is your main colorscheme + priority = 1000, -- make sure to load this before all the other start plugins + config = function() + require('github-theme').setup { + -- ... + } + + vim.cmd 'colorscheme github_dark' + end, + }, + -- Nightfox theme + { + 'EdenEast/nightfox.nvim', + lazy = false, + priority = 1000, + config = function() + require('nightfox').setup { + options = { + compile_path = vim.fn.stdpath 'cache' .. '/nightfox', + compile_file_suffix = '_compiled', + transparent = false, + terminal_colors = true, + dim_inactive = false, + module_default = true, + colorblind = { + enable = false, + simulate_only = false, + severity = { + protan = 0, + deutan = 0, + tritan = 0, + }, + }, + styles = { + comments = 'NONE', + conditionals = 'NONE', + constants = 'NONE', + functions = 'NONE', + keywords = 'NONE', + numbers = 'NONE', + operators = 'NONE', + strings = 'NONE', + types = 'NONE', + variables = 'NONE', + }, + inverse = { + match_paren = false, + visual = false, + search = false, + }, + modules = {}, + }, + palettes = {}, + specs = {}, + groups = {}, + } + end, + }, + + -- Oxocarbon theme + { + 'nyoom-engineering/oxocarbon.nvim', + lazy = false, + priority = 1000, + }, + + -- Tokyo Night theme + { + 'folke/tokyonight.nvim', + lazy = false, + priority = 1000, + config = function() + ---@diagnostic disable-next-line: missing-fields + require('tokyonight').setup { + styles = { + comments = { italic = false }, + }, + } + + -- Set default colorscheme on startup + vim.cmd.colorscheme(DEFAULT_THEME) + end, + }, + { + 'catppuccin/nvim', + name = 'catppuccin', + lazy = false, + priority = 1000, + config = function() + require('catppuccin').setup { + flavour = 'mocha', -- latte, frappe, macchiato, mocha + } + end, + }, + { + 'loctvl842/monokai-pro.nvim', + lazy = false, + priority = 1000, + }, + { + 'navarasu/onedark.nvim', + lazy = false, + priority = 1000, + config = function() + require('onedark').setup { + style = 'dark', -- dark, darker, cool, deep, warm, warmer + } + end, + }, +} diff --git a/lua/theme-switcher/fuzzy.lua b/lua/theme-switcher/fuzzy.lua new file mode 100644 index 00000000000..90f06e55122 --- /dev/null +++ b/lua/theme-switcher/fuzzy.lua @@ -0,0 +1,101 @@ +local M = {} + +-- Simple fuzzy match algorithm +-- Returns score (higher is better) or nil if no match +function M.fuzzy_match(str, pattern) + if pattern == '' then + return 1000 -- Empty pattern matches everything with high score + end + + str = str:lower() + pattern = pattern:lower() + + local str_idx = 1 + local pattern_idx = 1 + local score = 0 + local consecutive = 0 + local last_match_idx = 0 + + while pattern_idx <= #pattern do + local pattern_char = pattern:sub(pattern_idx, pattern_idx) + local found = false + + -- Search for pattern character in remaining string + while str_idx <= #str do + local str_char = str:sub(str_idx, str_idx) + + if str_char == pattern_char then + found = true + + -- Score bonuses + score = score + 1 + + -- Bonus for consecutive matches + if str_idx == last_match_idx + 1 then + consecutive = consecutive + 1 + score = score + consecutive * 5 + else + consecutive = 0 + end + + -- Bonus for matching at start + if str_idx == 1 then + score = score + 10 + end + + -- Bonus for matching after separator + if str_idx > 1 then + local prev_char = str:sub(str_idx - 1, str_idx - 1) + if prev_char == '-' or prev_char == '_' or prev_char == ' ' then + score = score + 8 + end + end + + last_match_idx = str_idx + str_idx = str_idx + 1 + break + end + + str_idx = str_idx + 1 + end + + if not found then + return nil -- Pattern doesn't match + end + + pattern_idx = pattern_idx + 1 + end + + return score +end + +-- Filter and sort themes by fuzzy match +function M.filter_themes(themes, query) + if query == '' then + return themes + end + + local matches = {} + + for _, theme in ipairs(themes) do + local score = M.fuzzy_match(theme, query) + if score then + table.insert(matches, { theme = theme, score = score }) + end + end + + -- Sort by score (descending) + table.sort(matches, function(a, b) + return a.score > b.score + end) + + -- Extract just the theme names + local filtered = {} + for _, match in ipairs(matches) do + table.insert(filtered, match.theme) + end + + return filtered +end + +return M diff --git a/lua/theme-switcher/init.lua b/lua/theme-switcher/init.lua new file mode 100644 index 00000000000..49cbafc8fb3 --- /dev/null +++ b/lua/theme-switcher/init.lua @@ -0,0 +1,216 @@ +local M = {} + +-- Configuration +local config = { + save_on_select = true, + preview_on_navigate = true, + restore_on_startup = true, +} + +-- Store original theme for preview cancellation +local original_theme = nil +local preview_enabled = false +local all_themes = {} +local filtered_themes = {} +local query = '' + +-- Setup function +function M.setup(user_config) + config = vim.tbl_deep_extend('force', config, user_config or {}) + + -- Restore saved theme on startup + if config.restore_on_startup then + local persistence = require 'theme-switcher.persistence' + local themes = require 'theme-switcher.themes' + local saved_theme = persistence.load_theme() + if saved_theme then + themes.apply_theme(saved_theme) + end + end + + -- Create user commands + vim.api.nvim_create_user_command('ThemeSwitcher', function() + M.open() + end, {}) + + vim.api.nvim_create_user_command('ThemeSwitcherSave', function() + local themes = require 'theme-switcher.themes' + local persistence = require 'theme-switcher.persistence' + local current = themes.get_current_theme() + persistence.save_theme(current) + vim.notify('Saved theme: ' .. current, vim.log.levels.INFO) + end, {}) +end + +-- Open theme switcher +function M.open() + local themes = require 'theme-switcher.themes' + local ui = require 'theme-switcher.ui' + + all_themes = themes.get_available_themes() + filtered_themes = all_themes + query = '' + + local current_theme = themes.get_current_theme() + + -- Store original for preview cancellation + original_theme = current_theme + preview_enabled = config.preview_on_navigate + + local buf, win = ui.create_window(filtered_themes, current_theme) + + M.setup_keymaps(buf) +end + +function M.setup_keymaps(buf) + local opts = { buffer = buf, nowait = true, silent = true } + + -- Close and cancel + vim.keymap.set('n', 'q', function() + M.cancel() + end, opts) + + vim.keymap.set('n', '', function() + M.cancel() + end, opts) + + -- Select and apply + vim.keymap.set('n', '', function() + M.select() + end, opts) + + -- Navigation with preview + vim.keymap.set('n', 'j', function() + vim.cmd 'normal! j' + M.preview() + end, opts) + + vim.keymap.set('n', 'k', function() + vim.cmd 'normal! k' + M.preview() + end, opts) + + vim.keymap.set('n', '', function() + vim.cmd 'normal! j' + M.preview() + end, opts) + + vim.keymap.set('n', '', function() + vim.cmd 'normal! k' + M.preview() + end, opts) + + vim.keymap.set('n', '', function() + vim.cmd 'normal! j' + M.preview() + end, opts) + + vim.keymap.set('n', '', function() + vim.cmd 'normal! k' + M.preview() + end, opts) + + -- Text input - any printable character + for i = 32, 126 do + local char = string.char(i) + vim.keymap.set('n', char, function() + M.add_char(char) + end, opts) + end + + -- Backspace + vim.keymap.set('n', '', function() + M.remove_char() + end, opts) + + vim.keymap.set('n', '', function() + M.remove_char() + end, opts) + + -- Clear input + vim.keymap.set('n', '', function() + M.clear_input() + end, opts) + + -- Toggle preview + vim.keymap.set('n', '', function() + preview_enabled = not preview_enabled + vim.notify(preview_enabled and 'Preview enabled' or 'Preview disabled', vim.log.levels.INFO) + end, opts) +end + +function M.add_char(char) + query = query .. char + M.update_filter() +end + +function M.remove_char() + if #query > 0 then + query = query:sub(1, -2) + M.update_filter() + end +end + +function M.clear_input() + query = '' + M.update_filter() +end + +function M.update_filter() + local fuzzy = require 'theme-switcher.fuzzy' + local ui = require 'theme-switcher.ui' + local themes = require 'theme-switcher.themes' + + filtered_themes = fuzzy.filter_themes(all_themes, query) + ui.update_display(filtered_themes, themes.get_current_theme(), query) +end + +-- Preview theme while navigating +function M.preview() + if not preview_enabled then + return + end + + local ui = require 'theme-switcher.ui' + local themes = require 'theme-switcher.themes' + + local selected = ui.get_selected_theme(filtered_themes) + if selected then + themes.apply_theme(selected) + end +end + +-- Select and apply theme +function M.select() + local ui = require 'theme-switcher.ui' + local themes = require 'theme-switcher.themes' + local persistence = require 'theme-switcher.persistence' + + local selected = ui.get_selected_theme(filtered_themes) + + if selected then + themes.apply_theme(selected) + + if config.save_on_select then + persistence.save_theme(selected) + end + + vim.notify('Applied theme: ' .. selected, vim.log.levels.INFO) + end + + ui.close_window() +end + +-- Cancel and restore original theme +function M.cancel() + local ui = require 'theme-switcher.ui' + local themes = require 'theme-switcher.themes' + + if preview_enabled and original_theme then + themes.apply_theme(original_theme) + end + + ui.close_window() +end + +return M diff --git a/lua/theme-switcher/persistence.lua b/lua/theme-switcher/persistence.lua new file mode 100644 index 00000000000..11301252237 --- /dev/null +++ b/lua/theme-switcher/persistence.lua @@ -0,0 +1,33 @@ +local M = {} + +local config_dir = vim.fn.stdpath 'data' +local theme_file = config_dir .. '/theme_preference.txt' + +-- Save theme preference +function M.save_theme(theme_name) + local file = io.open(theme_file, 'w') + if file then + file:write(theme_name) + file:close() + return true + end + return false +end + +-- Load theme preference +function M.load_theme() + local file = io.open(theme_file, 'r') + if file then + local theme = file:read '*all' + file:close() + return theme:match '^%s*(.-)%s*$' -- trim whitespace + end + return nil +end + +-- Delete preference +function M.clear_theme() + os.remove(theme_file) +end + +return M diff --git a/lua/theme-switcher/themes.lua b/lua/theme-switcher/themes.lua new file mode 100644 index 00000000000..e6716141d86 --- /dev/null +++ b/lua/theme-switcher/themes.lua @@ -0,0 +1,48 @@ +local M = {} + +-- Automatically detect installed colorschemes +function M.get_available_themes() + local themes = {} + + -- Get all available colorschemes from runtime paths + local colorscheme_files = vim.api.nvim_get_runtime_file('colors/*.vim', true) + local lua_colorschemes = vim.api.nvim_get_runtime_file('colors/*.lua', true) + + -- Combine both vim and lua colorschemes + vim.list_extend(colorscheme_files, lua_colorschemes) + + for _, file in ipairs(colorscheme_files) do + local name = vim.fn.fnamemodify(file, ':t:r') + table.insert(themes, name) + end + + -- Remove duplicates and sort + local seen = {} + local unique = {} + for _, theme in ipairs(themes) do + if not seen[theme] then + seen[theme] = true + table.insert(unique, theme) + end + end + + table.sort(unique) + return unique +end + +-- Get current colorscheme +function M.get_current_theme() + return vim.g.colors_name or 'default' +end + +-- Apply a theme +function M.apply_theme(theme_name) + local ok, err = pcall(vim.cmd.colorscheme, theme_name) + if not ok then + vim.notify('Failed to load theme: ' .. theme_name, vim.log.levels.ERROR) + return false + end + return true +end + +return M diff --git a/lua/theme-switcher/ui.lua b/lua/theme-switcher/ui.lua new file mode 100644 index 00000000000..84ad96e8b3e --- /dev/null +++ b/lua/theme-switcher/ui.lua @@ -0,0 +1,124 @@ +local M = {} + +-- Store window and buffer IDs +local win_id = nil +local buf_id = nil +local input_ns = nil + +-- Create floating window with search input +function M.create_window(themes, current_theme) + -- Calculate window size + local width = 60 + local height = math.min(#themes + 4, 20) -- +4 for header and input + + -- Calculate position (center of screen) + local row = math.floor((vim.o.lines - height) / 2) + local col = math.floor((vim.o.columns - width) / 2) + + -- Create buffer + buf_id = vim.api.nvim_create_buf(false, true) -- No file, scratch buffer + + -- Set buffer options + vim.api.nvim_buf_set_option(buf_id, 'bufhidden', 'wipe') + vim.api.nvim_buf_set_option(buf_id, 'filetype', 'theme-switcher') + vim.api.nvim_buf_set_option(buf_id, 'modifiable', false) + + -- Window options + local opts = { + relative = 'editor', + width = width, + height = height, + row = row, + col = col, + style = 'minimal', + border = 'rounded', + title = ' Theme Switcher ', + title_pos = 'center', + } + + -- Create window + win_id = vim.api.nvim_open_win(buf_id, true, opts) + + -- Window-local options + vim.api.nvim_win_set_option(win_id, 'cursorline', true) + vim.api.nvim_win_set_option(win_id, 'number', false) + vim.api.nvim_win_set_option(win_id, 'relativenumber', false) + + input_ns = vim.api.nvim_create_namespace 'theme-switcher-input' + + M.update_display(themes, current_theme, '') + + return buf_id, win_id +end + +-- Update the display with filtered themes +function M.update_display(themes, current_theme, query) + if not buf_id or not vim.api.nvim_buf_is_valid(buf_id) then + return + end + + vim.api.nvim_buf_set_option(buf_id, 'modifiable', true) + + local lines = {} + + -- Input line + table.insert(lines, '> ' .. query) + table.insert(lines, string.rep('─', vim.api.nvim_win_get_width(win_id) - 2)) + + -- Theme list + local current_line = 3 + for i, theme in ipairs(themes) do + local prefix = theme == current_theme and '● ' or ' ' + table.insert(lines, prefix .. theme) + + if theme == current_theme and query == '' then + current_line = i + 2 + end + end + + -- Handle empty results + if #themes == 0 then + table.insert(lines, ' No matches found') + end + + vim.api.nvim_buf_set_lines(buf_id, 0, -1, false, lines) + vim.api.nvim_buf_set_option(buf_id, 'modifiable', false) + + -- Set cursor to first theme (after separator) + if #themes > 0 then + vim.api.nvim_win_set_cursor(win_id, { query == '' and current_line or 3, 0 }) + else + vim.api.nvim_win_set_cursor(win_id, { 3, 0 }) + end +end + +-- Close window +function M.close_window() + if win_id and vim.api.nvim_win_is_valid(win_id) then + vim.api.nvim_win_close(win_id, true) + end + win_id = nil + buf_id = nil + input_ns = nil +end + +-- Get selected theme from cursor position +function M.get_selected_theme(themes) + if not win_id then + return nil + end + + local cursor = vim.api.nvim_win_get_cursor(win_id) + local line_num = cursor[1] + + -- Subtract 2 for input line and separator + local theme_idx = line_num - 2 + + if theme_idx >= 1 and theme_idx <= #themes then + return themes[theme_idx] + end + + return nil +end + +return M From 2c711d36a705afd6b3c555cf58be33f421e6cf82 Mon Sep 17 00:00:00 2001 From: Arnold <4966358+arnold-lei@users.noreply.github.com> Date: Tue, 9 Dec 2025 09:25:32 -0700 Subject: [PATCH 21/22] tweaking the config --- init.lua | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index ee9ea1265bb..498e72b896b 100644 --- a/init.lua +++ b/init.lua @@ -451,11 +451,11 @@ require('lazy').setup({ vim.keymap.set('n', 'fs', builtin.builtin, { desc = '[F]ind [S]elect Telescope' }) vim.keymap.set('n', 'fw', builtin.grep_string, { desc = '[F]ind current [W]ord' }) vim.keymap.set('n', 'fg', builtin.live_grep, { desc = '[F]ind by [G]rep' }) - vim.keymap.set('n', '/', builtin.live_grep, { desc = '[F]ind by [G]rep' }) + vim.keymap.set('n', '', builtin.live_grep, { desc = '[F]ind by [G]rep' }) vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' }) vim.keymap.set('n', 'fr', builtin.resume, { desc = '[F]ind [R]esume' }) vim.keymap.set('n', 'f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) - vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + vim.keymap.set('n', '/', builtin.buffers, { desc = '[ ] Find existing buffers' }) -- Slightly advanced example of overriding default behavior and theme vim.keymap.set('n', 'f/', function() @@ -832,10 +832,28 @@ require('lazy').setup({ mode = '', desc = '[F]ormat buffer', }, + { + 'F', + function() + vim.g.disable_autoformat = not vim.g.disable_autoformat + if vim.g.disable_autoformat then + print('Autoformat disabled') + else + print('Autoformat enabled') + end + end, + mode = '', + desc = 'Toggle auto[F]ormat on save', + }, }, opts = { notify_on_error = false, format_on_save = function(bufnr) + -- Check if autoformat is globally disabled + if vim.g.disable_autoformat then + return nil + end + -- Disable "format_on_save lsp_fallback" for languages that don't -- have a well standardized coding style. You can add additional -- languages here or re-enable it for the disabled ones. From 5e922b7ef5bbeda5b6a3de251066df2bba84c39a Mon Sep 17 00:00:00 2001 From: Arnold <4966358+arnold-lei@users.noreply.github.com> Date: Fri, 2 Jan 2026 13:05:18 -0700 Subject: [PATCH 22/22] adding some remamps --- init.lua | 70 ++++++++++++++++++++++++++++++++-- lua/arnoldlei/remap.lua | 4 ++ lua/custom/plugins/harpoon.lua | 5 +-- 3 files changed, 73 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 498e72b896b..3c923baa267 100644 --- a/init.lua +++ b/init.lua @@ -419,15 +419,38 @@ require('lazy').setup({ pickers = { find_files = { hidden = true, + -- Include .env.local files even if they're gitignored + find_command = { + 'rg', '--files', '--hidden', '--no-ignore-vcs', + '--glob', '!.git/*', + '--glob', '!node_modules/*', + '--glob', '!.next/*', + '--glob', '!dist/*', + '--glob', '!build/*', + }, }, live_grep = { additional_args = function() - return { '--hidden' } + return { + '--hidden', '--no-ignore-vcs', + '--glob', '!.git/*', + '--glob', '!node_modules/*', + '--glob', '!.next/*', + '--glob', '!dist/*', + '--glob', '!build/*', + } end, }, grep_string = { additional_args = function() - return { '--hidden' } + return { + '--hidden', '--no-ignore-vcs', + '--glob', '!.git/*', + '--glob', '!node_modules/*', + '--glob', '!.next/*', + '--glob', '!dist/*', + '--glob', '!build/*', + } end, }, }, @@ -1032,10 +1055,13 @@ require('lazy').setup({ { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', + }, 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', 'vue', 'javascript', 'typescript', 'css' }, -- Autoinstall languages that are not installed auto_install = true, highlight = { @@ -1046,6 +1072,44 @@ require('lazy').setup({ additional_vim_regex_highlighting = { 'ruby' }, }, indent = { enable = true, disable = { 'ruby' } }, + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj + keymaps = { + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', + }, + }, + move = { + enable = true, + set_jumps = true, -- Add to jumplist + goto_next_start = { + [']m'] = '@function.outer', + [']c'] = '@class.outer', + [']a'] = '@parameter.inner', + }, + goto_next_end = { + [']M'] = '@function.outer', + [']C'] = '@class.outer', + [']A'] = '@parameter.inner', + }, + goto_previous_start = { + ['[m'] = '@function.outer', + ['[c'] = '@class.outer', + ['[a'] = '@parameter.inner', + }, + goto_previous_end = { + ['[M'] = '@function.outer', + ['[C'] = '@class.outer', + ['[A'] = '@parameter.inner', + }, + }, + }, }, -- 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: diff --git a/lua/arnoldlei/remap.lua b/lua/arnoldlei/remap.lua index cfcac33d564..653be3d3a6b 100644 --- a/lua/arnoldlei/remap.lua +++ b/lua/arnoldlei/remap.lua @@ -50,6 +50,10 @@ vim.keymap.set('n', 'mr', 'CellularAutomaton make_it_rain') vim.keymap.set('n', 'sf', ':source $HOME/.config/nvim/init.lua ', { desc = 'Source Neovim config' }) +vim.keymap.set('n', '', function() + vim.cmd 'so' +end) + -- Jump to beginning/end of method vim.keymap.set('n', '[m', '[m', { desc = 'Jump to beginning of method' }) vim.keymap.set('n', ']m', ']m', { desc = 'Jump to end of method' }) diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua index 160b490f388..c605ba9ab4b 100644 --- a/lua/custom/plugins/harpoon.lua +++ b/lua/custom/plugins/harpoon.lua @@ -34,12 +34,11 @@ return { harpoon:list():select(4) end, { desc = 'Harpoon: Go to file 4' }) - -- Navigate to previous & next buffers in the list - vim.keymap.set('n', '', function() + vim.keymap.set('n', 'hp', function() harpoon:list():prev() end, { desc = 'Harpoon: Previous buffer' }) - vim.keymap.set('n', '', function() + vim.keymap.set('n', 'hn', function() harpoon:list():next() end, { desc = 'Harpoon: Next buffer' }) end,