diff --git a/lazy-lock.json b/lazy-lock.json index 589633f..b574532 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,6 +1,7 @@ { - "LuaSnip": { "branch": "master", "commit": "e81cbe6004051c390721d8570a4a0541ceb0df10" }, - "asyncrun.vim": { "branch": "master", "commit": "762e5ce9a60861af4fb25fb8719cef294ab8e894" }, + "LuaSnip": { "branch": "master", "commit": "99a94cc35ec99bf06263d0346128e908a204575c" }, + "asyncrun.vim": { "branch": "master", "commit": "0f99f96b1a408c37ea6f78e5990554328bc22dd1" }, + "bufresize.nvim": { "branch": "master", "commit": "3b19527ab936d6910484dcc20fb59bdb12322d8b" }, "cellular-automaton.nvim": { "branch": "main", "commit": "679943b8e1e5ef79aaeeaf4b00782c52eb4e928f" }, "cloak.nvim": { "branch": "main", "commit": "c6a92e2fbc6b931bc9ed0d07e80931c2324e05cb" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, @@ -8,9 +9,9 @@ "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, - "copilot.vim": { "branch": "release", "commit": "a4a6d6b3f9e284e7f5c849619e06cd228cad8abd" }, - "dressing.nvim": { "branch": "master", "commit": "829bc80400651aea31b03d8fc9a99135512fe67a" }, + "copilot.vim": { "branch": "release", "commit": "4a361e8cf327590d51d214c5c01c6391727390d7" }, "flash.nvim": { "branch": "main", "commit": "967117690bd677cb7b6a87f0bc0077d2c0be3a27" }, + "focus.nvim": { "branch": "master", "commit": "31f41d91b6b331faa07f0a513adcbc37087d028d" }, "friendly-snippets": { "branch": "main", "commit": "bc38057e513458cb2486b6cd82d365fa294ee398" }, "harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" }, "indent-blankline.nvim": { "branch": "master", "commit": "4541d690816cb99a7fc248f1486aa87f3abce91c" }, @@ -23,33 +24,36 @@ "mini.bufremove": { "branch": "main", "commit": "7821606e35c1ac931b56d8e3155f45ffe76ee7e5" }, "mini.comment": { "branch": "main", "commit": "877acea5b2a32ff55f808fc0ebe9aa898648318c" }, "neoconf.nvim": { "branch": "main", "commit": "08f146d53e075055500dca35e93281faff95716b" }, - "neodev.nvim": { "branch": "main", "commit": "f860e226abd283a4fa5505ea7aa8c066ce495e04" }, - "noice.nvim": { "branch": "main", "commit": "894db25ec726d32047799d4d0a982b701bec453b" }, - "nui.nvim": { "branch": "main", "commit": "9e3916e784660f55f47daa6f26053ad044db5d6a" }, + "neodev.nvim": { "branch": "main", "commit": "9f0205a08757711f57589a1dffa8abf525f4a23b" }, "null-ls.nvim": { "branch": "main", "commit": "db09b6c691def0038c456551e4e2772186449f35" }, - "nvim-bqf": { "branch": "main", "commit": "60ebdf05c273e8e7f420851c6a33bbd731a1de8d" }, + "nvim-bqf": { "branch": "main", "commit": "c920a55c6153766bd909e474b7feffa9739f07e8" }, "nvim-cmp": { "branch": "main", "commit": "c4e491a87eeacf0408902c32f031d802c7eafce8" }, - "nvim-lspconfig": { "branch": "master", "commit": "a59d74e12340242c0735666fb2e91afdbe6f2496" }, - "nvim-spectre": { "branch": "master", "commit": "3ba6edeea1390457caaf73e96ab9c086ff6f90e9" }, - "nvim-treesitter": { "branch": "master", "commit": "80aee02921085435b04e880cabd1fbe29f6da99a" }, - "nvim-treesitter-context": { "branch": "master", "commit": "6f8f788738b968f24a108ee599c5be0031f94f06" }, + "nvim-lspconfig": { "branch": "master", "commit": "c0de180ddb3df36feef8ac3607670894d0e7497f" }, + "nvim-spectre": { "branch": "master", "commit": "5b39919a2947b1266b3aa34d0b0b14c35523bc69" }, + "nvim-surround": { "branch": "main", "commit": "0d6882635817a2677749a330127d12ac30a4f3c8" }, + "nvim-treesitter": { "branch": "master", "commit": "8d5e5dc40a4c480483690777cefb8cf67e710702" }, + "nvim-treesitter-context": { "branch": "master", "commit": "3d4ab25056dcaf6dd11ebacf1da8525c8df6550f" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "9e519b6146512c8e2e702faf8ac48420f4f5deec" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "e9062e2dfb9854e6a927370f2d720de354c88524" }, - "nvim-web-devicons": { "branch": "master", "commit": "efbfed0567ef4bfac3ce630524a0f6c8451c5534" }, + "nvim-ufo": { "branch": "main", "commit": "5be5b800b4f3512bca128f345e9c98574b5637c0" }, + "nvim-web-devicons": { "branch": "master", "commit": "eb8f80f30fd5e9a6176dee5c46661ebd7437ac46" }, "oil.nvim": { "branch": "master", "commit": "eaa20a6aee7c4df89d80ec8208de63ec2fa4d38a" }, "playground": { "branch": "master", "commit": "2b81a018a49f8e476341dfcb228b7b808baba68b" }, "plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" }, + "promise-async": { "branch": "main", "commit": "e94f35161b8c5d4a4ca3b6ff93dd073eb9214c0e" }, "readline.nvim": { "branch": "master", "commit": "cab666cbd026dea9c817182e22255ecb3b3419b1" }, "refactoring.nvim": { "branch": "master", "commit": "5359e74291164fcaeaaecdea9ba753ad54eb53d0" }, "rose-pine": { "branch": "main", "commit": "e29002cbee4854a9c8c4b148d8a52fae3176070f" }, - "telescope.nvim": { "branch": "master", "commit": "d2e17ba18a6840b7e7079764b282616c3188e0de" }, + "smart-splits.nvim": { "branch": "master", "commit": "7aad6019dee974a01333523a5b8e122b7e7da454" }, + "symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" }, + "telescope.nvim": { "branch": "master", "commit": "5a3fb8a012f9fcf777ba8deeae1c759362413efa" }, "todo-comments.nvim": { "branch": "main", "commit": "3094ead8edfa9040de2421deddec55d3762f64d1" }, "trouble.nvim": { "branch": "main", "commit": "40aad004f53ae1d1ba91bcc5c29d59f07c5f01d3" }, "undotree": { "branch": "master", "commit": "0e11ba7325efbbb3f3bebe06213afa3e7ec75131" }, "vim-fugitive": { "branch": "master", "commit": "b3b838d690f315a503ec4af8c634bdff3b200aaf" }, "vim-illuminate": { "branch": "master", "commit": "5ed17582a8e97bf0a0c617c3cf762e98f87b9859" }, "vim-startuptime": { "branch": "master", "commit": "454b3de856b7bd298700de33d79774ca9b9e3875" }, - "vim-tmux-navigator": { "branch": "master", "commit": "cdd66d6a37d991bba7997d593586fc51a5b37aa8" }, "which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" }, "zen-mode.nvim": { "branch": "main", "commit": "68f554702de63f4b7b6b6d4bcb10178f41a0acc7" } } \ No newline at end of file diff --git a/lua/rayandrew/plugins.lua b/lua/rayandrew/plugins.lua index 123470b..cd03113 100644 --- a/lua/rayandrew/plugins.lua +++ b/lua/rayandrew/plugins.lua @@ -18,7 +18,18 @@ return { { "nvim-telescope/telescope.nvim", cmd = "Telescope", - dependencies = { "nvim-lua/plenary.nvim" }, + dependencies = { + "nvim-lua/plenary.nvim", + { + "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 = "make", + cond = function() + return vim.fn.executable("make") == 1 + end, + }, + }, version = false, opts = { pickers = { @@ -30,6 +41,7 @@ return { actions.delete_buffer(prompt_bufnr) actions.move_to_top(prompt_bufnr) end, + [""] = false, }, n = { ["d"] = "delete_buffer", @@ -113,6 +125,29 @@ return { end, desc = "Find Help Tags", }, + { + "/", + function() + -- require("telescope.builtin").current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ + -- winblend = 10, + -- previewer = false, + -- })) + local Util = require("rayandrew.util") + local fun = Util.telescope("current_buffer_fuzzy_find", { + winblend = 10, + previewer = false, + }) + fun() + end, + }, + { + "sd", + function() + local Util = require("rayandrew.util") + local fun = Util.telescope("diagnostics") + fun() + end, + }, }, }, @@ -165,6 +200,49 @@ return { node_decremental = "", }, }, + textobjects = { + select = { + enable = true, + lookahead = true, + keymaps = { + ["aa"] = "@parameter.outer", + ["ia"] = "@parameter.inner", + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + }, + }, + move = { + enable = true, + set_jumps = true, + goto_next_start = { + ["]m"] = "@function.outer", + ["]]"] = "@class.outer", + }, + goto_next_end = { + ["]M"] = "@function.outer", + ["]["] = "@class.outer", + }, + goto_previous_start = { + ["[m"] = "@function.outer", + ["[["] = "@class.outer", + }, + goto_previous_end = { + ["[M"] = "@function.outer", + ["[]"] = "@class.outer", + }, + }, + swap = { + enable = true, + swap_next = { + ["a"] = "@parameter.inner", + }, + swap_previous = { + ["A"] = "@parameter.inner", + }, + }, + }, }, cmd = { "TSUpdateSync" }, keys = { @@ -226,18 +304,13 @@ return { dependencies = { "nvim-tree/nvim-web-devicons" }, cmd = { "Oil" }, keys = { - -- { - -- "-", - -- function() - -- require("oil").open() - -- end, - -- desc = "Open parent directory", - -- }, { "e", function() - -- split window then open oil - -- vim.cmd.vsplit() + -- disable in oil filetype + if vim.bo.filetype == "oil" then + return + end require("oil").open() end, desc = "Open current directory", @@ -245,8 +318,10 @@ return { { "E", function() - -- split window then open oil - -- vim.cmd.vsplit() + -- disable in oil filetype + if vim.bo.filetype == "oil" then + return + end require("oil").open(".") end, desc = "Open current directory", @@ -295,75 +370,6 @@ return { ------------------------------ -- User Interface ------------------------------ - -- { - -- "folke/noice.nvim", - -- event = "VeryLazy", - -- opts = { - -- lsp = { - -- override = { - -- ["vim.lsp.util.convert_input_to_markdown_lines"] = true, - -- ["vim.lsp.util.stylize_markdown"] = true, - -- ["cmp.entry.get_documentation"] = true, - -- }, - -- hover = { - -- enabled = false, - -- }, - -- signature = { - -- enabled = false, - -- }, - -- }, - -- cmdline = { - -- enabled = true, - -- view = "cmdline", - -- }, - -- routes = { - -- { - -- filter = { - -- event = "msg_show", - -- any = { - -- { find = "%d+L, %d+B" }, - -- { find = "; after #%d+" }, - -- { find = "; before #%d+" }, - -- }, - -- }, - -- view = "mini", - -- }, - -- }, - -- presets = { - -- bottom_search = true, - -- command_palette = true, - -- long_message_to_split = true, - -- inc_rename = true, - -- }, - -- }, - -- -- stylua: ignore - -- keys = { - -- { "", function() require("noice").redirect(vim.fn.getcmdline()) end, mode = "c", desc = "Redirect Cmdline" }, - -- { "snl", function() require("noice").cmd("last") end, desc = "Noice Last Message" }, - -- { "snh", function() require("noice").cmd("history") end, desc = "Noice History" }, - -- { "sna", function() require("noice").cmd("all") end, desc = "Noice All" }, - -- { "snd", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" }, - -- { "", function() if not require("noice.lsp").scroll(4) then return "" end end, silent = true, expr = true, desc = "Scroll forward", mode = {"i", "n", "s"} }, - -- { "", function() if not require("noice.lsp").scroll(-4) then return "" end end, silent = true, expr = true, desc = "Scroll backward", mode = {"i", "n", "s"}}, - -- }, - -- }, - - -- { - -- "stevearc/dressing.nvim", - -- lazy = true, - -- init = function() - -- ---@diagnostic disable-next-line: duplicate-set-field - -- vim.ui.select = function(...) - -- require("lazy").load({ plugins = { "dressing.nvim" } }) - -- return vim.ui.select(...) - -- end - -- ---@diagnostic disable-next-line: duplicate-set-field - -- vim.ui.input = function(...) - -- require("lazy").load({ plugins = { "dressing.nvim" } }) - -- return vim.ui.input(...) - -- end - -- end, - -- }, { "lukas-reineke/indent-blankline.nvim", @@ -400,9 +406,6 @@ return { -- icons { "nvim-tree/nvim-web-devicons", lazy = true }, - -- ui components - { "MunifTanjim/nui.nvim", lazy = true }, - ------------------------------ -- LSP Configuration ------------------------------ @@ -443,7 +446,16 @@ return { "hrsh7th/nvim-cmp", event = "InsertEnter", dependencies = { - { "L3MON4D3/LuaSnip", build = "make install_jsregexp" }, + { + "L3MON4D3/LuaSnip", + build = "make install_jsregexp", + -- event = "InsertEnter", + config = function() + local luasnip = require("luasnip") + require("luasnip.loaders.from_vscode").lazy_load() + luasnip.config.setup({}) + end, + }, { "rafamadriz/friendly-snippets" }, { "hrsh7th/nvim-cmp" }, { "hrsh7th/cmp-buffer" }, @@ -483,7 +495,8 @@ return { sorting, snippet = { expand = function(args) - require("luasnip").lsp_expand(args.body) + local luasnip = require("luasnip") + luasnip.lsp_expand(args.body) end, }, }) @@ -499,9 +512,13 @@ return { { "hrsh7th/cmp-nvim-lsp" }, { "williamboman/mason-lspconfig.nvim" }, { "williamboman/mason.nvim" }, - { "folke/neoconf.nvim", cmd = "Neoconf", config = false, dependencies = { "nvim-lspconfig" } }, { "folke/neodev.nvim", opts = {} }, + { + "kevinhwang91/nvim-ufo", + dependencies = { "kevinhwang91/promise-async" }, + opts = {}, + }, }, config = function() local lsp = require("lsp-zero") @@ -581,6 +598,17 @@ return { }, }) + lsp.set_server_config({ + capabilities = { + textDocument = { + foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true, + }, + }, + }, + }) + lsp.setup() vim.diagnostic.config({ @@ -694,6 +722,37 @@ return { ------------------------------ -- Utilities ------------------------------ + + { + "nvim-focus/focus.nvim", + version = "*", + opts = {}, + cmd = { "FocusToggle", "FocusSplitNicely", "FocusSplitCycle", "FocusSplitCycleReverse" }, + keys = { + { + "wf", + "FocusToggle", + desc = "Toggle Focus", + }, + }, + }, + + { + "simrat39/symbols-outline.nvim", + opts = {}, + cmd = { "SymbolsOutline", "SymbolsOutlineOpen", "SymbolsOutlineClose" }, + keys = { + { "so", "SymbolsOutline", desc = "Symbols Outline" }, + }, + }, + + { + "kylechui/nvim-surround", + version = "*", + event = "VeryLazy", + opts = {}, + }, + { "RRethy/vim-illuminate", event = { "BufReadPost", "BufNewFile" }, @@ -1087,7 +1146,7 @@ return { "folke/zen-mode.nvim", opts = { window = { - width = 90, + width = 100, }, plugins = { tmux = { @@ -1098,11 +1157,13 @@ return { vim.wo.wrap = false vim.wo.number = false vim.wo.rnu = false + vim.wo.signcolumn = "no" end, on_close = function() vim.wo.wrap = true vim.wo.number = true vim.wo.rnu = true + vim.wo.signcolumn = "yes" end, }, keys = { @@ -1147,13 +1208,21 @@ return { -- Tmux { - "christoomey/vim-tmux-navigator", - cmd = { - "TmuxNavigateLeft", - "TmuxNavigateDown", - "TmuxNavigateUp", - "TmuxNavigateRight", + "mrjones2014/smart-splits.nvim", + dependencies = { + { + "kwkarlwang/bufresize.nvim", + opts = {}, + }, }, - keys = { "", "", "", "" }, + config = function() + require("smart-splits").setup({ + resize_mode = { + hooks = { + on_leave = require("bufresize").register, + }, + }, + }) + end, }, } diff --git a/lua/rayandrew/remap.lua b/lua/rayandrew/remap.lua index bee5ca8..d48090f 100644 --- a/lua/rayandrew/remap.lua +++ b/lua/rayandrew/remap.lua @@ -35,10 +35,10 @@ Util.map("n", "ws", "split", { desc = "[W]indow Horizontal [S]p Util.map("n", "wv", "vsplit", { desc = "[W]indow [V]ertical Split" }) -- split vertical -- move -Util.map("n", "wh", "TmuxNavigateLeft", { desc = "Go to Left [W]indow" }) -Util.map("n", "wj", "TmuxNavigateDown", { desc = "Go to [W]indow Below" }) -Util.map("n", "wk", "TmuxNavigateUp", { desc = "Go to Top [W]indow" }) -Util.map("n", "wl", "TmuxNavigateRight", { desc = "Go to Right [W]indow" }) +-- Util.map("n", "wh", "TmuxNavigateLeft", { desc = "Go to Left [W]indow" }) +-- Util.map("n", "wj", "TmuxNavigateDown", { desc = "Go to [W]indow Below" }) +-- Util.map("n", "wk", "TmuxNavigateUp", { desc = "Go to Top [W]indow" }) +-- Util.map("n", "wl", "TmuxNavigateRight", { desc = "Go to Right [W]indow" }) if Util.has("bufferline.nvim") then Util.map("n", "", "BufferLineCyclePrev", { desc = "Prev buffer" }) @@ -52,6 +52,45 @@ else Util.map("n", "]b", "bnext", { desc = "Next buffer" }) end +Util.map("n", "wh", function() + require("smart-splits").resize_left() +end, { desc = "Window Resize Left" }) +Util.map("n", "wj", function() + require("smart-splits").resize_down() +end, { desc = "Window Resize Down" }) +Util.map("n", "wk", function() + require("smart-splits").resize_up() +end, { desc = "Window Resize Up" }) +Util.map("n", "wl", function() + require("smart-splits").resize_right() +end, { desc = "Window Resize Right" }) +-- moving between splits +Util.map("n", "", function() + require("smart-splits").move_cursor_left() +end, { desc = "Focus to Left Window" }) +Util.map("n", "", function() + require("smart-splits").move_cursor_down() +end, { desc = "Focus to Lower Window" }) +Util.map("n", "", function() + require("smart-splits").move_cursor_up() +end, { desc = "Focus to Upper Window" }) +Util.map("n", "", function() + require("smart-splits").move_cursor_right() +end, { desc = "Focus to Right Window" }) +-- swapping buffers between windows +Util.map("n", "h", function() + require("smart-splits").swap_buf_left() +end, { desc = "Swap Buffer Left" }) +Util.map("n", "j", function() + require("smart-splits").swap_buf_down() +end, { desc = "Swap Buffer Down" }) +Util.map("n", "k", function() + require("smart-splits").swap_buf_up() +end, { desc = "Swap Buffer Up" }) +Util.map("n", "l", function() + require("smart-splits").swap_buf_right() +end, { desc = "Swap Buffer Right" }) + -- tabs Util.map("n", "l", "tablast", { desc = "Last Tab" }) Util.map("n", "f", "tabfirst", { desc = "First Tab" }) @@ -114,15 +153,10 @@ Util.map("n", "tT", function() Util.float_term() end, { desc = "Terminal (cwd)" }) Util.map("n", "`", lazyterm, { desc = "Terminal (root dir)" }) --- Util.map("n", "", lazyterm, { desc = "Terminal (root dir)" }) Util.map("n", "", lazyterm, { desc = "Terminal (root dir)" }) Util.map("n", "", lazyterm, { desc = "which_key_ignore" }) Util.map("t", "", "", { desc = "Enter Normal Mode" }) --- Util.map("t", "", "wincmd h", { desc = "Go to left window" }) --- Util.map("t", "", "wincmd j", { desc = "Go to lower window" }) --- Util.map("t", "", "wincmd k", { desc = "Go to upper window" }) --- Util.map("t", "", "wincmd l", { desc = "Go to right window" }) Util.map("t", "", "close", { desc = "Hide Terminal" }) Util.map("t", "", "close", { desc = "which_key_ignore" }) @@ -130,10 +164,18 @@ Util.map("t", "", "close", { desc = "which_key_ignore" }) -- Others ------------------------------ +-- ufo +Util.map("n", "zR", function() + require("ufo").openAllFolds() +end) +Util.map("n", "zM", function() + require("ufo").closeAllFolds() +end) + -- lazy Util.map("n", "l", "Lazy", { desc = "Lazy" }) -- source file -Util.map("n", "", function() +Util.map("n", "s", function() vim.cmd("so") -end) +end, { desc = "Source File" }) diff --git a/lua/rayandrew/set.lua b/lua/rayandrew/set.lua index 24ef96c..f8292a0 100644 --- a/lua/rayandrew/set.lua +++ b/lua/rayandrew/set.lua @@ -59,6 +59,13 @@ opt.wildmode = "longest:full,full" -- Command-line completion mode opt.winminwidth = 5 -- Minimum window width opt.wrap = false -- Disable line wrap +-- For UFO +vim.o.foldcolumn = "1" +vim.o.foldlevel = 99 +vim.o.foldlevelstart = 99 +vim.o.foldenable = true +vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] + if vim.fn.has("nvim-0.9.0") == 1 then opt.splitkeep = "screen" opt.shortmess:append({ C = true })