diff --git a/.config/nvim/lua/lazyvim/config/keymaps.lua b/.config/nvim/lua/lazyvim/config/keymaps.lua index 8ee7bc9..fb9be97 100755 --- a/.config/nvim/lua/lazyvim/config/keymaps.lua +++ b/.config/nvim/lua/lazyvim/config/keymaps.lua @@ -1,64 +1,84 @@ local opts = { noremap = true, silent = true } -local map = vim.api.nvim_set_keymap - -- better up/down -map("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) -map("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 }) +vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) -- Move text up and down -map("n", "", ":m .-2==", opts) -map("n", "", ":m .+1==", opts) +vim.keymap.set("n", "", ":m .-2==", opts) +vim.keymap.set("n", "", ":m .+1==", opts) -- Move Lines -map("n", "", ":m .+1==", { desc = "Move down" }) -map("v", "", ":m '>+1gv=gv", { desc = "Move down" }) -map("i", "", ":m .+1==gi", { desc = "Move down" }) -map("n", "", ":m .-2==", { desc = "Move up" }) -map("v", "", ":m '<-2gv=gv", { desc = "Move up" }) -map("i", "", ":m .-2==gi", { desc = "Move up" }) +vim.keymap.set("n", "", ":m .+1==", { desc = "Move down" }) +vim.keymap.set("v", "", ":m '>+1gv=gv", { desc = "Move down" }) +vim.keymap.set("i", "", ":m .+1==gi", { desc = "Move down" }) +vim.keymap.set("n", "", ":m .-2==", { desc = "Move up" }) +vim.keymap.set("v", "", ":m '<-2gv=gv", { desc = "Move up" }) +vim.keymap.set("i", "", ":m .-2==gi", { desc = "Move up" }) -- Clear search with -map("n", "", "noh", opts) -map("i", "", "noh", opts) +vim.keymap.set("n", "", "noh", opts) +vim.keymap.set("i", "", "noh", opts) -- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n -map("n", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) -map("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) -map("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) -map("n", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) -map("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) -map("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) +vim.keymap.set("n", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) +vim.keymap.set("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) +vim.keymap.set("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) +vim.keymap.set("n", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) +vim.keymap.set("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) +vim.keymap.set("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) -- Save -map("n", "", ":w", opts) -map("i", "", ":w", opts) +vim.keymap.set("n", "", ":w", opts) +vim.keymap.set("i", "", ":w", opts) -- Switch between buffers -map("n", "", ":bnext", opts) -map("n", "", ":bprevious", opts) +vim.keymap.set("n", "", ":bnext", opts) +vim.keymap.set("n", "", ":bprevious", opts) -- center after up and down movements -map("n", "", "zz", opts) -map("n", "", "zz", opts) +vim.keymap.set("n", "", "zz", opts) +vim.keymap.set("n", "", "zz", opts) -- Indenting -map("v", "<", "", ">gv", opts) +vim.keymap.set("v", "<", "", ">gv", opts) -- move through quickfix list -map("n", "", ":cnextzz", { noremap = true, silent = true, desc = "Next quickfix" }) -map("n", "", ":cprevzz", { noremap = true, silent = true, desc = "Prev quickfix" }) -map("n", "]q", ":cnextzz", { noremap = true, silent = true, desc = "Next quickfix" }) -map("n", "[q", ":cprevzz", { noremap = true, silent = true, desc = "Prev quickfix" }) +vim.keymap.set("n", "", ":cnextzz", { noremap = true, silent = true, desc = "Next quickfix" }) +vim.keymap.set("n", "", ":cprevzz", { noremap = true, silent = true, desc = "Prev quickfix" }) +vim.keymap.set("n", "]q", ":cnextzz", { noremap = true, silent = true, desc = "Next quickfix" }) +vim.keymap.set("n", "[q", ":cprevzz", { noremap = true, silent = true, desc = "Prev quickfix" }) + +-- thanks teej +vim.keymap.set("n", "xx", "source %", { desc = "Source File" }) +vim.keymap.set("n", "x", ":.lua", { desc = "Source Line" }) +vim.keymap.set("v", "x", ":lua", { desc = "Source Selection" }) +vim.keymap.set("n", "-", "Oil") +vim.keymap.set("t", "", "") + +local job_id = 0 +vim.keymap.set("n", "Ts", function() + vim.cmd.vnew() + vim.cmd.term() + vim.cmd.wincmd("J") + vim.api.nvim_win_set_width(0, 5) + + job_id = vim.bo.channel +end, { desc = "Small Terminal" }) + +vim.keymap.set("n", "gotest", function() + vim.fn.chansend(job_id, { "go test\r\n" }) +end) + +vim.keymap.set("n", "Tf", "FloatTerminal") -- Thanks Prime vim.keymap.set("x", "p", [["_dP]]) vim.keymap.set({ "n", "v" }, "y", [["+y]]) vim.keymap.set("n", "Y", [["+Y]]) vim.keymap.set({ "n", "v" }, "d", [["_d]]) -vim.keymap.set("i", "", "") vim.keymap.set("n", "Q", "") -vim.keymap.set("n", "T", "silent !tmux neww tmux-sessionizer") -vim.keymap.set("n", "S", [[:%s/\<\>//gI]]) -vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) +vim.keymap.set("n", "Tt", "silent !tmux neww tmux-sessionizer") +vim.keymap.set("n", "S", [[:%s/\<\>//gI]], { desc = "search and replace" }) +vim.keymap.set("n", "X", "!chmod +x %", { silent = true, desc = "make me executable" }) diff --git a/.config/nvim/lua/lazyvim/init.lua b/.config/nvim/lua/lazyvim/init.lua index 05b3376..518df14 100644 --- a/.config/nvim/lua/lazyvim/init.lua +++ b/.config/nvim/lua/lazyvim/init.lua @@ -19,6 +19,7 @@ vim.api.nvim_set_keymap("n", "L", ":Lazy", { desc = "Lazy GUI" vim.opt.rtp:prepend(vim.env.LAZY or lazypath) require("lazyvim.config").setup() +require("lazyvim.utils").setup() require("lazy").setup({ spec = "lazyvim.plugins", diff --git a/.config/nvim/lua/lazyvim/plugins/alpha.lua b/.config/nvim/lua/lazyvim/plugins/alpha.lua index 6eb1272..ed157a1 100644 --- a/.config/nvim/lua/lazyvim/plugins/alpha.lua +++ b/.config/nvim/lua/lazyvim/plugins/alpha.lua @@ -1,48 +1,49 @@ return { - -- { - -- "goolord/alpha-nvim", - -- event = "VimEnter", - -- config = function() - -- local dashboard = require("alpha.themes.dashboard") - -- - -- local function button(sc, txt, key, key_opts) - -- local b = dashboard.button(sc, txt, key, key_opts) - -- b.opts.hl_shortcut = "Macro" - -- return b - -- end - -- - -- local icons = require("lazyvim.config.icons") - -- - -- dashboard.section.header.val = { - -- [[ , __ ___ __. _ __ ` , _ , _ ]], - -- [[ |' `. .' ` .' \ | / | |' `|' `.]], - -- [[ | | |----' | | ` / | | | |]], - -- [[ / | `.___, `._.' \/ / / ' /]], - -- } - -- - -- dashboard.section.buttons.val = { - -- button("f", icons.documents.Files .. " Find file", ":Telescope find_files "), - -- button("e", icons.ui.NewFile .. " New file", ":ene startinsert "), - -- button("r", icons.ui.History .. " Recent files", ":Telescope oldfiles "), - -- button("t", icons.ui.List .. " Find text", ":Telescope live_grep "), - -- button("c", icons.ui.Gear .. " Config", ":e ~/.config/nvim/init.lua "), - -- button("u", icons.ui.CloudDownload .. " Update", ":Lazy"), - -- button("q", icons.ui.SignOut .. " Quit", ":qa"), - -- } - -- - -- dashboard.section.footer.val = { - -- [[┬┌┐┌┬┌─┬ ┌─┐┌┬┐┌┐ ┬ ┌─┐┌┬┐┌─┐┌─┐┌┬┐]], - -- [[││││├┴┐│ ├┤ │ ├┴┐│ │ │ │ │ │ ││││]], - -- [[┴┘└┘┴ ┴┴─┘└─┘ ┴ └─┘┴─┘└─┘ ┴o└─┘└─┘┴ ┴]], - -- } - -- - -- dashboard.section.header.opts.hl = "Include" - -- dashboard.section.buttons.opts.hl = "Macro" - -- dashboard.section.footer.opts.hl = "Type" - -- - -- dashboard.opts.opts.noautocmd = true - -- - -- require("alpha").setup(dashboard.opts) - -- end, - -- }, + { + "goolord/alpha-nvim", + enabled = false, + event = "VimEnter", + config = function() + local dashboard = require("alpha.themes.dashboard") + + local function button(sc, txt, key, key_opts) + local b = dashboard.button(sc, txt, key, key_opts) + b.opts.hl_shortcut = "Macro" + return b + end + + local icons = require("lazyvim.config.icons") + + dashboard.section.header.val = { + [[ , __ ___ __. _ __ ` , _ , _ ]], + [[ |' `. .' ` .' \ | / | |' `|' `.]], + [[ | | |----' | | ` / | | | |]], + [[ / | `.___, `._.' \/ / / ' /]], + } + + dashboard.section.buttons.val = { + button("f", icons.documents.Files .. " Find file", ":Telescope find_files "), + button("e", icons.ui.NewFile .. " New file", ":ene startinsert "), + button("r", icons.ui.History .. " Recent files", ":Telescope oldfiles "), + button("t", icons.ui.List .. " Find text", ":Telescope live_grep "), + button("c", icons.ui.Gear .. " Config", ":e ~/.config/nvim/init.lua "), + button("u", icons.ui.CloudDownload .. " Update", ":Lazy"), + button("q", icons.ui.SignOut .. " Quit", ":qa"), + } + + dashboard.section.footer.val = { + [[┬┌┐┌┬┌─┬ ┌─┐┌┬┐┌┐ ┬ ┌─┐┌┬┐┌─┐┌─┐┌┬┐]], + [[││││├┴┐│ ├┤ │ ├┴┐│ │ │ │ │ │ ││││]], + [[┴┘└┘┴ ┴┴─┘└─┘ ┴ └─┘┴─┘└─┘ ┴o└─┘└─┘┴ ┴]], + } + + dashboard.section.header.opts.hl = "Include" + dashboard.section.buttons.opts.hl = "Macro" + dashboard.section.footer.opts.hl = "Type" + + dashboard.opts.opts.noautocmd = true + + require("alpha").setup(dashboard.opts) + end, + }, } diff --git a/.config/nvim/lua/lazyvim/plugins/cmp.lua b/.config/nvim/lua/lazyvim/plugins/cmp.lua index b6a010f..7d0db55 100644 --- a/.config/nvim/lua/lazyvim/plugins/cmp.lua +++ b/.config/nvim/lua/lazyvim/plugins/cmp.lua @@ -1,6 +1,46 @@ return { + { + 'saghen/blink.cmp', + -- optional: provides snippets for the snippet source + dependencies = 'rafamadriz/friendly-snippets', + + -- use a release tag to download pre-built binaries + version = '*', + -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using latest nightly rust with: + -- build = 'nix run .#build-plugin', + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' for mappings similar to built-in completion + -- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate) + -- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept + -- See the full "keymap" documentation for information on defining your own keymap. + keymap = { preset = 'enter' }, + + appearance = { + -- Sets the fallback highlight groups to nvim-cmp's highlight groups + -- Useful for when your theme doesn't support blink.cmp + -- Will be removed in a future release + use_nvim_cmp_as_default = true, + -- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = 'mono' + }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer' }, + }, + }, + opts_extend = { "sources.default" } + }, { "hrsh7th/nvim-cmp", + enabled = false, event = "InsertEnter", dependencies = { "hrsh7th/cmp-nvim-lsp", @@ -8,22 +48,6 @@ return { "hrsh7th/cmp-emoji", "hrsh7th/cmp-buffer", "saadparwaiz1/cmp_luasnip", - -- { - -- "zbirenbaum/copilot-cmp", - -- dependencies = "copilot.lua", - -- opts = {}, - -- config = function(_, opts) - -- local copilot_cmp = require("copilot_cmp") - -- copilot_cmp.setup(opts) - -- -- attach cmp source whenever copilot attaches - -- -- fixes lazy-loading issues with the copilot cmp source - -- require("lazyvim.utils").on_attach(function(client) - -- if client.name == "copilot" then - -- copilot_cmp._on_insert_enter({}) - -- end - -- end) - -- end, - -- }, }, config = function() local cmp = require("cmp") @@ -70,20 +94,4 @@ return { }) end, }, - -- { - -- "zbirenbaum/copilot-cmp", - -- dependencies = "copilot.lua", - -- opts = {}, - -- config = function(_, opts) - -- local copilot_cmp = require("copilot_cmp") - -- copilot_cmp.setup(opts) - -- -- attach cmp source whenever copilot attaches - -- -- fixes lazy-loading issues with the copilot cmp source - -- require("lazyvim.utils").on_attach(function(client) - -- if client.name == "copilot" then - -- copilot_cmp._on_insert_enter({}) - -- end - -- end) - -- end, - -- } } diff --git a/.config/nvim/lua/lazyvim/plugins/color.lua b/.config/nvim/lua/lazyvim/plugins/color.lua index 412d08f..6b37271 100644 --- a/.config/nvim/lua/lazyvim/plugins/color.lua +++ b/.config/nvim/lua/lazyvim/plugins/color.lua @@ -1,43 +1,43 @@ return { - { - "sainnhe/gruvbox-material", - lazy = true, - priority = 1000, - }, - { - "ellisonleao/gruvbox.nvim", - lazy = true, - priority = 1000, - }, - { - "sainnhe/sonokai", - lazy = true, - priority = 1000, - }, - { - "dracula/vim", - lazy = true, - priority = 1000, - }, - { - "folke/tokyonight.nvim", - lazy = true, - priority = 1000, - }, - { - "echasnovski/mini.base16", - lazy = false, - priority = 1000, - }, - { - "chriskempson/base16-vim", - lazy = false, - priority = 1000, - }, - { - "NvChad/nvim-colorizer.lua", - opts = function() - require("colorizer").setup({}) - end, - }, + { + "sainnhe/gruvbox-material", + lazy = true, + priority = 1000, + }, + { + "ellisonleao/gruvbox.nvim", + lazy = true, + priority = 1000, + }, + { + "sainnhe/sonokai", + lazy = true, + priority = 1000, + }, + { + "dracula/vim", + lazy = true, + priority = 1000, + }, + { + "folke/tokyonight.nvim", + lazy = true, + priority = 1000, + }, + { + "echasnovski/mini.base16", + lazy = false, + priority = 1000, + }, + { + "chriskempson/base16-vim", + lazy = false, + priority = 1000, + }, + { + "NvChad/nvim-colorizer.lua", + opts = function() + require("colorizer").setup({}) + end, + }, } diff --git a/.config/nvim/lua/lazyvim/plugins/copilot.lua b/.config/nvim/lua/lazyvim/plugins/copilot.lua index b37337b..9d71f55 100644 --- a/.config/nvim/lua/lazyvim/plugins/copilot.lua +++ b/.config/nvim/lua/lazyvim/plugins/copilot.lua @@ -1,24 +1,25 @@ return { - -- { - -- "zbirenbaum/copilot.lua", - -- event = "VeryLazy", - -- build = ":Copilot auth", - -- opts = { - -- suggestion = { - -- enabled = true, - -- auto_trigger = true, - -- keymap = { - -- accept = "l", - -- next = "]", - -- prev = "[", - -- dismiss = "x", - -- }, - -- }, - -- panel = { enabled = true }, - -- filetypes = { - -- markdown = true, - -- help = true, - -- }, - -- }, - -- } + { + "zbirenbaum/copilot.lua", + enabled = false, + event = "VeryLazy", + build = ":Copilot auth", + opts = { + suggestion = { + enabled = true, + auto_trigger = true, + keymap = { + accept = "l", + next = "]", + prev = "[", + dismiss = "x", + }, + }, + panel = { enabled = true }, + filetypes = { + markdown = true, + help = true, + }, + }, + } } diff --git a/.config/nvim/lua/lazyvim/plugins/git.lua b/.config/nvim/lua/lazyvim/plugins/git.lua index 8ad9ee5..ab84ce1 100644 --- a/.config/nvim/lua/lazyvim/plugins/git.lua +++ b/.config/nvim/lua/lazyvim/plugins/git.lua @@ -1,22 +1,22 @@ return { - { - "lewis6991/gitsigns.nvim", - event = "BufReadPre", - opts = { - signs = { - add = { text = "a" }, - change = { text = "c" }, - delete = { text = "d" }, - topdelete = { text = "td" }, - changedelete = { text = "cd" }, - untracked = { text = "u" }, - }, - on_attach = function(buffer) - local gs = package.loaded.gitsigns + { + "lewis6991/gitsigns.nvim", + event = "BufReadPre", + opts = { + signs = { + add = { text = "a" }, + change = { text = "c" }, + delete = { text = "d" }, + topdelete = { text = "td" }, + changedelete = { text = "cd" }, + untracked = { text = "u" }, + }, + on_attach = function(buffer) + local gs = package.loaded.gitsigns - local function map(mode, l, r, desc) - vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) - end + local function map(mode, l, r, desc) + vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) + end -- stylua: ignore start map("n", "]h", gs.prev_hunk, "Next Hunk") @@ -31,11 +31,11 @@ return { map("n", "ghd", gs.diffthis, "Diff This") map("n", "ghD", function() gs.diffthis("~") end, "Diff This ~") map({ "o", "x" }, "ih", ":Gitsigns select_hunk", "GitSigns Select Hunk") - end, - }, - }, - { - "f-person/git-blame.nvim", - event = "BufEnter", - }, + end, + }, + }, + { + "f-person/git-blame.nvim", + event = "BufEnter", + }, } diff --git a/.config/nvim/lua/lazyvim/plugins/go.lua b/.config/nvim/lua/lazyvim/plugins/go.lua index 39193ba..5498952 100644 --- a/.config/nvim/lua/lazyvim/plugins/go.lua +++ b/.config/nvim/lua/lazyvim/plugins/go.lua @@ -1,16 +1,16 @@ return { - -- { - -- "ray-x/go.nvim", - -- requires = { - -- "ray-x/guihua.lua", - -- "neovim/nvim-lspconfig", - -- "nvim-treesitter/nvim-treesitter", - -- }, - -- config = function() - -- require("go").setup() - -- end, - -- event = { "CmdlineEnter" }, - -- ft = { "go", "gomod" }, - -- build = ':lua require("go.install").update_all_sync()', - -- }, + { + "ray-x/go.nvim", + requires = { + "ray-x/guihua.lua", + "neovim/nvim-lspconfig", + "nvim-treesitter/nvim-treesitter", + }, + config = function() + require("go").setup() + end, + event = { "CmdlineEnter" }, + ft = { "go", "gomod" }, + build = ':lua require("go.install").update_all_sync()', + }, } diff --git a/.config/nvim/lua/lazyvim/plugins/lsp/format.lua b/.config/nvim/lua/lazyvim/plugins/lsp/format.lua index 13c50cf..8a5ca9b 100644 --- a/.config/nvim/lua/lazyvim/plugins/lsp/format.lua +++ b/.config/nvim/lua/lazyvim/plugins/lsp/format.lua @@ -3,37 +3,35 @@ local M = {} M.autoformat = true function M.toggle() - M.autoformat = not M.autoformat - vim.notify(M.autoformat and "Enabled format on save" or "Disabled format on save") + M.autoformat = not M.autoformat + vim.notify(M.autoformat and "Enabled format on save" or "Disabled format on save") end function M.format() - -- TODO: work out how to call conform it it has a formatter and default - -- to vim.lsp.buf.format() + -- TODO: work out how to call conform if it has a formatter and default + -- to vim.lsp.buf.format() - vim.lsp.buf.format() + vim.lsp.buf.format() - -- local ok, conform = pcall(require, "conform") - -- - -- if ok then - -- conform.format() - -- else - -- vim.lsp.buf.format() - -- end + if require("lazy.core.config").plugins["conform.nvim"]._.loaded then + require("conform.nvim").format() + else + vim.lsp.buf.format() + end end function M.on_attach(client, buf) - if client.supports_method("textDocument/formatting") then - vim.api.nvim_create_autocmd("BufWritePre", { - group = vim.api.nvim_create_augroup("LspFormat." .. buf, {}), - buffer = buf, - callback = function() - if M.autoformat then - M.format() - end - end, - }) - end + if client.supports_method("textDocument/formatting") then + vim.api.nvim_create_autocmd("BufWritePre", { + group = vim.api.nvim_create_augroup("LspFormat." .. buf, {}), + buffer = buf, + callback = function() + if M.autoformat then + M.format() + end + end, + }) + end end return M diff --git a/.config/nvim/lua/lazyvim/plugins/lsp/init.lua b/.config/nvim/lua/lazyvim/plugins/lsp/init.lua index d540873..347207d 100644 --- a/.config/nvim/lua/lazyvim/plugins/lsp/init.lua +++ b/.config/nvim/lua/lazyvim/plugins/lsp/init.lua @@ -4,10 +4,20 @@ return { "neovim/nvim-lspconfig", event = "BufReadPre", dependencies = { - { "folke/neoconf.nvim", cmd = "Neoconf", config = true }, + { + "folke/lazydev.nvim", + ft = "lua", -- only load on lua files + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + }, + }, + }, "mason.nvim", "williamboman/mason-lspconfig.nvim", - "hrsh7th/cmp-nvim-lsp", + -- "hrsh7th/cmp-nvim-lsp", }, opts = { -- options for vim.diagnostic.config() @@ -109,7 +119,8 @@ return { "force", {}, vim.lsp.protocol.make_client_capabilities(), - require("cmp_nvim_lsp").default_capabilities(), + -- require("cmp_nvim_lsp").default_capabilities(), + require("blink.cmp").get_lsp_capabilities(), opts.capabilities or {} ) diff --git a/.config/nvim/lua/lazyvim/plugins/lsp/keymaps.lua b/.config/nvim/lua/lazyvim/plugins/lsp/keymaps.lua index 388b743..92cfd8a 100644 --- a/.config/nvim/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/.config/nvim/lua/lazyvim/plugins/lsp/keymaps.lua @@ -23,7 +23,6 @@ function M.on_attach(client, buffer) local format = require("lazyvim.plugins.lsp.format").format self:map("lf", format, { desc = "Format Document", has = "documentFormatting" }) - self:map("lF", format, { desc = "Format Range", mode = "v", has = "documentRangeFormatting" }) self:map("lr", M.rename, { expr = true, desc = "Rename", has = "rename" }) if client.name == "tsserver" and pcall(require, "typescript") then diff --git a/.config/nvim/lua/lazyvim/plugins/neotree.lua b/.config/nvim/lua/lazyvim/plugins/neotree.lua index 45ff6df..fa4bee5 100644 --- a/.config/nvim/lua/lazyvim/plugins/neotree.lua +++ b/.config/nvim/lua/lazyvim/plugins/neotree.lua @@ -3,6 +3,7 @@ local util = require("lazyvim.utils") return { { "nvim-neo-tree/neo-tree.nvim", + enabled = false, branch = "v3.x", cmd = "Neotree", keys = { diff --git a/.config/nvim/lua/lazyvim/plugins/nvim-tree.lua b/.config/nvim/lua/lazyvim/plugins/nvim-tree.lua index dfcef23..765f92a 100644 --- a/.config/nvim/lua/lazyvim/plugins/nvim-tree.lua +++ b/.config/nvim/lua/lazyvim/plugins/nvim-tree.lua @@ -1,130 +1,131 @@ return { - -- { - -- "kyazdani42/nvim-tree.lua", - -- cmd = "NvimTreeToggle", - -- config = function() - -- local nvim_tree = require("nvim-tree") - -- local icons = require("lazyvim.config.icons") - -- - -- local function edit_or_open() - -- -- open as vsplit on current node - -- local action = "edit" - -- local node = lib.get_node_at_cursor() - -- - -- -- Just copy what's done normally with vsplit - -- if node.link_to and not node.nodes then - -- require("nvim-tree.actions.node.open-file").fn(action, node.link_to) - -- view.close() -- Close the tree if file was opened - -- elseif node.nodes ~= nil then - -- lib.expand_or_collapse(node) - -- else - -- require("nvim-tree.actions.node.open-file").fn(action, node.absolute_path) - -- view.close() -- Close the tree if file was opened - -- end - -- end - -- - -- nvim_tree.setup({ - -- hijack_directories = { - -- enable = false, - -- }, - -- ignore_ft_on_setup = { - -- "alpha", - -- }, - -- filters = { - -- custom = { ".git" }, - -- exclude = { ".gitignore" }, - -- }, - -- hijack_cursor = false, - -- update_cwd = true, - -- renderer = { - -- add_trailing = false, - -- group_empty = false, - -- highlight_git = false, - -- highlight_opened_files = "none", - -- root_folder_modifier = ":t", - -- indent_markers = { - -- enable = false, - -- icons = { - -- corner = "└ ", - -- edge = "│ ", - -- none = " ", - -- }, - -- }, - -- icons = { - -- webdev_colors = true, - -- git_placement = "before", - -- padding = " ", - -- symlink_arrow = " ➛ ", - -- show = { - -- file = true, - -- folder = true, - -- folder_arrow = true, - -- git = true, - -- }, - -- glyphs = { - -- default = "", - -- symlink = "", - -- folder = { - -- arrow_open = icons.ui.ArrowOpen, - -- arrow_closed = icons.ui.ArrowClosed, - -- default = "", - -- open = "", - -- empty = "", - -- empty_open = "", - -- symlink = "", - -- symlink_open = "", - -- }, - -- git = { - -- unstaged = "", - -- staged = "S", - -- unmerged = "", - -- renamed = "➜", - -- untracked = "U", - -- deleted = "", - -- ignored = "◌", - -- }, - -- }, - -- }, - -- }, - -- diagnostics = { - -- enable = true, - -- icons = { - -- hint = icons.diagnostics.Hint, - -- info = icons.diagnostics.Information, - -- warning = icons.diagnostics.Warning, - -- error = icons.diagnostics.Error, - -- }, - -- }, - -- update_focused_file = { - -- enable = true, - -- update_cwd = true, - -- ignore_list = {}, - -- }, - -- git = { - -- enable = true, - -- ignore = true, - -- timeout = 500, - -- }, - -- view = { - -- width = 30, - -- hide_root_folder = false, - -- side = "left", - -- number = false, - -- relativenumber = false, - -- mappings = { - -- custom_only = false, - -- list = { - -- { key = "l", action = "edit", action_cb = edit_or_open }, - -- { key = "h", action = "close_node" }, - -- }, - -- }, - -- }, - -- actions = { - -- open_file = { - -- quit_on_open = true, - -- }, - -- }, - -- }) - -- end, - -- }, + { + "kyazdani42/nvim-tree.lua", + enabled = false, + cmd = "NvimTreeToggle", + config = function() + local nvim_tree = require("nvim-tree") + local icons = require("lazyvim.config.icons") + + local function edit_or_open() + -- open as vsplit on current node + local action = "edit" + local node = lib.get_node_at_cursor() + + -- Just copy what's done normally with vsplit + if node.link_to and not node.nodes then + require("nvim-tree.actions.node.open-file").fn(action, node.link_to) + view.close() -- Close the tree if file was opened + elseif node.nodes ~= nil then + lib.expand_or_collapse(node) + else + require("nvim-tree.actions.node.open-file").fn(action, node.absolute_path) + view.close() -- Close the tree if file was opened + end + end + + nvim_tree.setup({ + hijack_directories = { + enable = false, + }, + ignore_ft_on_setup = { + "alpha", + }, + filters = { + custom = { ".git" }, + exclude = { ".gitignore" }, + }, + hijack_cursor = false, + update_cwd = true, + renderer = { + add_trailing = false, + group_empty = false, + highlight_git = false, + highlight_opened_files = "none", + root_folder_modifier = ":t", + indent_markers = { + enable = false, + icons = { + corner = "└ ", + edge = "│ ", + none = " ", + }, + }, + icons = { + webdev_colors = true, + git_placement = "before", + padding = " ", + symlink_arrow = " ➛ ", + show = { + file = true, + folder = true, + folder_arrow = true, + git = true, + }, + glyphs = { + default = "", + symlink = "", + folder = { + arrow_open = icons.ui.ArrowOpen, + arrow_closed = icons.ui.ArrowClosed, + default = "", + open = "", + empty = "", + empty_open = "", + symlink = "", + symlink_open = "", + }, + git = { + unstaged = "", + staged = "S", + unmerged = "", + renamed = "➜", + untracked = "U", + deleted = "", + ignored = "◌", + }, + }, + }, + }, + diagnostics = { + enable = true, + icons = { + hint = icons.diagnostics.Hint, + info = icons.diagnostics.Information, + warning = icons.diagnostics.Warning, + error = icons.diagnostics.Error, + }, + }, + update_focused_file = { + enable = true, + update_cwd = true, + ignore_list = {}, + }, + git = { + enable = true, + ignore = true, + timeout = 500, + }, + view = { + width = 30, + hide_root_folder = false, + side = "left", + number = false, + relativenumber = false, + mappings = { + custom_only = false, + list = { + { key = "l", action = "edit", action_cb = edit_or_open }, + { key = "h", action = "close_node" }, + }, + }, + }, + actions = { + open_file = { + quit_on_open = true, + }, + }, + }) + end, + }, } diff --git a/.config/nvim/lua/lazyvim/plugins/project.lua b/.config/nvim/lua/lazyvim/plugins/project.lua index 15c8bdc..7965a9e 100644 --- a/.config/nvim/lua/lazyvim/plugins/project.lua +++ b/.config/nvim/lua/lazyvim/plugins/project.lua @@ -1,12 +1,13 @@ return { - -- { - -- "ahmedkhalf/project.nvim", - -- lazy = false, - -- opts = { - -- manual_mode = true, - -- }, - -- config = function(opts) - -- require("project_nvim").setup(opts) - -- end, - -- }, + { + "ahmedkhalf/project.nvim", + enabled = false, + lazy = false, + opts = { + manual_mode = true, + }, + config = function(opts) + require("project_nvim").setup(opts) + end, + }, } diff --git a/.config/nvim/lua/lazyvim/plugins/spectre.lua b/.config/nvim/lua/lazyvim/plugins/spectre.lua index f00a021..6b7030a 100644 --- a/.config/nvim/lua/lazyvim/plugins/spectre.lua +++ b/.config/nvim/lua/lazyvim/plugins/spectre.lua @@ -1,11 +1,12 @@ return { - -- { - -- "windwp/nvim-spectre", - -- -- stylua: ignore - -- keys = { - -- { "rr", function() require("spectre").open() end, desc = "Replace in files" }, - -- { "rw", function() require("spectre").open_visual({ select_word = true }) end, desc = "Relpace Word" }, - -- { "rb", function() require("spectre").open_file_search() end, desc = "Relpace in Buffer" }, - -- }, - -- }, + { + "windwp/nvim-spectre", + enabled = false, + -- stylua: ignore + keys = { + { "rr", function() require("spectre").open() end, desc = "Replace in files" }, + { "rw", function() require("spectre").open_visual({ select_word = true }) end, desc = "Relpace Word" }, + { "rb", function() require("spectre").open_file_search() end, desc = "Relpace in Buffer" }, + }, + }, } diff --git a/.config/nvim/lua/lazyvim/plugins/telescope.lua b/.config/nvim/lua/lazyvim/plugins/telescope.lua index 3d229c4..91b7c3e 100644 --- a/.config/nvim/lua/lazyvim/plugins/telescope.lua +++ b/.config/nvim/lua/lazyvim/plugins/telescope.lua @@ -24,7 +24,6 @@ return { { "ht", "Telescope builtin", desc = "Telescope" }, { "sb", "Telescope current_buffer_fuzzy_find", desc = "Telescope Buffer" }, { "sc", "Telescope command_history", desc = "Telescope Command History" }, - { "sG", util.telescope("live_grep"), desc = "Telescope Grep (root dir)" }, { "sg", util.telescope("live_grep", { cwd = false }), desc = "Telescope Grep (cwd)" }, { "sm", "Telescope marks", desc = "Telescope Jump to Mark" }, { "so", "Telescope resume", desc = "Telescope Resume last search" }, @@ -80,5 +79,8 @@ return { }, }, }, + config = function() + require "lazyvim.utils.telescope.multigrep".setup() + end, }, } diff --git a/.config/nvim/lua/lazyvim/plugins/treesitter.lua b/.config/nvim/lua/lazyvim/plugins/treesitter.lua index bac0eec..78edb39 100644 --- a/.config/nvim/lua/lazyvim/plugins/treesitter.lua +++ b/.config/nvim/lua/lazyvim/plugins/treesitter.lua @@ -2,6 +2,14 @@ return { { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", + enable = true, + disable = function(lang, buf) + local max_filesize = 100 * 1024 -- 100 KB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + return true + end + end, dependencies = { "treesitter-context", }, diff --git a/.config/nvim/lua/lazyvim/plugins/utility.lua b/.config/nvim/lua/lazyvim/plugins/utility.lua index 559bd81..8b310cb 100644 --- a/.config/nvim/lua/lazyvim/plugins/utility.lua +++ b/.config/nvim/lua/lazyvim/plugins/utility.lua @@ -19,35 +19,36 @@ return { { "nvim-lua/popup.nvim", }, - -- { - -- "rcarriga/nvim-notify", - -- opts = { - -- -- Animation style (see below for details) - -- stages = "static", - -- - -- -- Render function for notifications. See notify-render() - -- render = "default", - -- - -- -- Default timeout for notifications - -- timeout = 2000, - -- - -- -- For stages that change opacity this is treated as the highlight behind the window - -- -- Set this to either a highlight group or an RGB hex value e.g. "#000000" - -- background_colour = "Normal", - -- - -- -- Minimum width for notification windows - -- minimum_width = 10, - -- - -- -- Icons for the different levels - -- icons = { - -- ERROR = icons.diagnostics.Error, - -- WARN = icons.diagnostics.Warning, - -- INFO = icons.diagnostics.Information, - -- DEBUG = icons.ui.Bug, - -- TRACE = icons.ui.Pencil, - -- }, - -- }, - -- }, + { + "rcarriga/nvim-notify", + enabled = false, + opts = { + -- Animation style (see below for details) + stages = "static", + + -- Render function for notifications. See notify-render() + render = "default", + + -- Default timeout for notifications + timeout = 2000, + + -- For stages that change opacity this is treated as the highlight behind the window + -- Set this to either a highlight group or an RGB hex value e.g. "#000000" + background_colour = "Normal", + + -- Minimum width for notification windows + minimum_width = 10, + + -- Icons for the different levels + icons = { + ERROR = icons.diagnostics.Error, + WARN = icons.diagnostics.Warning, + INFO = icons.diagnostics.Information, + DEBUG = icons.ui.Bug, + TRACE = icons.ui.Pencil, + }, + }, + }, { "echasnovski/mini.bufremove", event = "VeryLazy", @@ -57,38 +58,39 @@ return { { "bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" }, }, }, - -- { - -- "ghillb/cybu.nvim", - -- event = "VeryLazy", - -- keys = { - -- { "bl", "CybuNext", desc = "Next Buffer" }, - -- { "bh", "CybuPrev", desc = "Prev Buffer" }, - -- }, - -- opts = { - -- position = { - -- relative_to = "win", -- win, editor, cursor - -- anchor = "topright", -- topleft, topcenter, topright, - -- -- centerleft, center, centerright, - -- -- bottomleft, bottomcenter, bottomright - -- -- vertical_offset = 10, -- vertical offset from anchor in lines - -- -- horizontal_offset = 0, -- vertical offset from anchor in columns - -- -- max_win_height = 5, -- height of cybu window in lines - -- -- max_win_width = 0.5, -- integer for absolute in columns - -- -- float for relative to win/editor width - -- }, - -- display_time = 1750, -- time the cybu window is displayed - -- style = { - -- separator = " ", -- string used as separator - -- prefix = "…", -- string used as prefix for truncated paths - -- padding = 1, -- left & right padding in number of spaces - -- hide_buffer_id = true, - -- devicons = { - -- enabled = true, -- enable or disable web dev icons - -- colored = true, -- enable color for web dev icons - -- }, - -- }, - -- }, - -- }, + { + "ghillb/cybu.nvim", + enabled = false, + event = "VeryLazy", + keys = { + { "bl", "CybuNext", desc = "Next Buffer" }, + { "bh", "CybuPrev", desc = "Prev Buffer" }, + }, + opts = { + position = { + relative_to = "win", -- win, editor, cursor + anchor = "topright", -- topleft, topcenter, topright, + -- centerleft, center, centerright, + -- bottomleft, bottomcenter, bottomright + -- vertical_offset = 10, -- vertical offset from anchor in lines + -- horizontal_offset = 0, -- vertical offset from anchor in columns + -- max_win_height = 5, -- height of cybu window in lines + -- max_win_width = 0.5, -- integer for absolute in columns + -- float for relative to win/editor width + }, + display_time = 1750, -- time the cybu window is displayed + style = { + separator = " ", -- string used as separator + prefix = "…", -- string used as prefix for truncated paths + padding = 1, -- left & right padding in number of spaces + hide_buffer_id = true, + devicons = { + enabled = true, -- enable or disable web dev icons + colored = true, -- enable color for web dev icons + }, + }, + }, + }, { "mbbill/undotree", cmd = { "UndotreeToggle" }, @@ -103,17 +105,18 @@ return { "lukas-reineke/indent-blankline.nvim", opts = {}, }, - -- { - -- "windwp/nvim-autopairs", - -- event = "VeryLazy", - -- opts = { - -- disable_filetype = { "TelescopePrompt", "spectre_panel" }, - -- ignored_next_char = "[%w%.*]", -- don't place autopairs when cursor sits infront of any character. - -- }, - -- config = function(_, opts) - -- require("nvim-autopairs").setup(opts) - -- end, - -- }, + { + "windwp/nvim-autopairs", + enabled = false, + event = "VeryLazy", + opts = { + disable_filetype = { "TelescopePrompt", "spectre_panel" }, + ignored_next_char = "[%w%.*]", -- don't place autopairs when cursor sits infront of any character. + }, + config = function(_, opts) + require("nvim-autopairs").setup(opts) + end, + }, { "preservim/vim-markdown", }, diff --git a/.config/nvim/lua/lazyvim/plugins/whichkey.lua b/.config/nvim/lua/lazyvim/plugins/whichkey.lua index 3af3cf3..6adbb1a 100644 --- a/.config/nvim/lua/lazyvim/plugins/whichkey.lua +++ b/.config/nvim/lua/lazyvim/plugins/whichkey.lua @@ -138,9 +138,9 @@ return { whichkey.add({ mode = { "n", "v" }, { "l", group = "lsp" }, - { "ll", "lopen", desc = "Open Location List" }, - { "lq", "copen", desc = "Open Quickfix List" }, - { "lx", "cclose", desc = "Close Quickfix List" }, + { "ll", "lopen", desc = "Open Location List" }, + { "lq", "copen", desc = "Open Quickfix List" }, + { "lx", function() vim.diagnostic.setqflist() end, desc = "Open Quickfix List" }, }) -- C = { diff --git a/.config/nvim/lua/lazyvim/utils/init.lua b/.config/nvim/lua/lazyvim/utils/init.lua index 98c202f..6e705ae 100644 --- a/.config/nvim/lua/lazyvim/utils/init.lua +++ b/.config/nvim/lua/lazyvim/utils/init.lua @@ -2,6 +2,10 @@ local M = {} M.root_patterns = { ".git", "/lua" } +function M.setup() + require "lazyvim.utils.term" +end + ---@param on_attach fun(client, buffer) function M.on_attach(on_attach) vim.api.nvim_create_autocmd("LspAttach", {