From 913df8f0e9874a014920fcc41bcd8ca54aa59c06 Mon Sep 17 00:00:00 2001 From: Solomon Laing Date: Tue, 7 Jan 2025 12:56:43 +1030 Subject: [PATCH] many updates --- .config/alacritty/alacritty.toml | 123 ++++++++++ .config/nvim/lazy-lock.json | 58 +++++ .config/nvim/lua/lazyvim/config/autocmds.lua | 81 +++++++ .config/nvim/lua/lazyvim/config/keymaps.lua | 1 + .config/nvim/lua/lazyvim/config/options.lua | 90 +++---- .config/nvim/lua/lazyvim/plugins/aerial.lua | 17 +- .config/nvim/lua/lazyvim/plugins/cmp.lua | 7 + .config/nvim/lua/lazyvim/plugins/color.lua | 8 + .config/nvim/lua/lazyvim/plugins/comments.lua | 4 +- .config/nvim/lua/lazyvim/plugins/core.lua | 6 +- .config/nvim/lua/lazyvim/plugins/dev.lua | 7 + .config/nvim/lua/lazyvim/plugins/dressing.lua | 31 +-- .config/nvim/lua/lazyvim/plugins/flash.lua | 1 + .config/nvim/lua/lazyvim/plugins/git.lua | 2 + .config/nvim/lua/lazyvim/plugins/go.lua | 1 + .config/nvim/lua/lazyvim/plugins/harpoon.lua | 29 +-- .config/nvim/lua/lazyvim/plugins/lsp/init.lua | 3 + .config/nvim/lua/lazyvim/plugins/lsp/misc.lua | 4 +- .config/nvim/lua/lazyvim/plugins/lualine.lua | 219 +++++++++--------- .config/nvim/lua/lazyvim/plugins/neorg.lua | 71 +++--- .config/nvim/lua/lazyvim/plugins/noice.lua | 1 + .config/nvim/lua/lazyvim/plugins/oil.lua | 9 + .config/nvim/lua/lazyvim/plugins/snippets.lua | 1 + .../nvim/lua/lazyvim/plugins/telescope.lua | 49 ++-- .../nvim/lua/lazyvim/plugins/treesitter.lua | 2 +- .config/nvim/lua/lazyvim/plugins/trouble.lua | 1 + .config/nvim/lua/lazyvim/plugins/utility.lua | 49 ++-- .config/nvim/lua/lazyvim/plugins/whichkey.lua | 4 +- .config/nvim/lua/lazyvim/plugins/zen.lua | 38 +++ .config/nvim/lua/lazyvim/plugins/zk.lua | 1 + .config/nvim/lua/lazyvim/utils/init.lua | 8 +- .config/nvim/lua/lazyvim/utils/menu.lua | 37 +++ .../lua/lazyvim/utils/telescope/multigrep.lua | 52 +++++ .config/nvim/lua/lazyvim/utils/term.lua | 53 +++++ 34 files changed, 771 insertions(+), 297 deletions(-) create mode 100644 .config/alacritty/alacritty.toml create mode 100644 .config/nvim/lazy-lock.json create mode 100755 .config/nvim/lua/lazyvim/config/autocmds.lua create mode 100644 .config/nvim/lua/lazyvim/plugins/dev.lua create mode 100644 .config/nvim/lua/lazyvim/plugins/oil.lua create mode 100644 .config/nvim/lua/lazyvim/plugins/zen.lua create mode 100644 .config/nvim/lua/lazyvim/utils/menu.lua create mode 100644 .config/nvim/lua/lazyvim/utils/telescope/multigrep.lua create mode 100644 .config/nvim/lua/lazyvim/utils/term.lua diff --git a/.config/alacritty/alacritty.toml b/.config/alacritty/alacritty.toml new file mode 100644 index 0000000..721b8fb --- /dev/null +++ b/.config/alacritty/alacritty.toml @@ -0,0 +1,123 @@ +args = ["--login"] +program = "/usr/bin/zsh" + +[[keyboard.bindings]] +action = "Paste" +key = "V" +mods = "Control|Shift" + +[[keyboard.bindings]] +action = "Copy" +key = "C" +mods = "Control|Shift" + +[[keyboard.bindings]] +action = "PasteSelection" +key = "Insert" +mods = "Shift" + +[[keyboard.bindings]] +action = "ResetFontSize" +key = "Numpad0" +mods = "Control" + +[[keyboard.bindings]] +action = "IncreaseFontSize" +key = "NumpadEquals" +mods = "Control" + +[[keyboard.bindings]] +action = "DecreaseFontSize" +key = "NumpadSubtract" +mods = "Control" + +[[keyboard.bindings]] +action = "Paste" +key = "Paste" + +[[keyboard.bindings]] +action = "Copy" +key = "Copy" + +[[keyboard.bindings]] +action = "ClearLogNotice" +key = "L" +mods = "Control" + +[[keyboard.bindings]] +chars = "\f" +key = "L" +mods = "Control" + +[[keyboard.bindings]] +action = "ScrollPageUp" +key = "PageUp" +mode = "~Alt" +mods = "Shift" + +[[keyboard.bindings]] +action = "ScrollPageDown" +key = "PageDown" +mode = "~Alt" +mods = "Shift" + +[[keyboard.bindings]] +action = "ScrollToTop" +key = "Home" +mode = "~Alt" +mods = "Shift" + +[[keyboard.bindings]] +action = "ScrollToBottom" +key = "End" +mode = "~Alt" +mods = "Shift" + +[general] +import = ["/path/to/dracula.yml"] + +[env] +TERM = "xterm-256color" + +[font] +size = 10.0 + +[font.bold] +family = "FiraCode Nerd Font" +style = "Bold" + +[font.bold_italic] +family = "FiraCode Nerd Font" +style = "Bold Italic" + +[font.italic] +family = "FiraCode Nerd Font" +style = "Italic" + +[font.normal] +family = "FiraCode Nerd Font" +style = "Regular" + +[font.offset] +x = 0 +y = 0 + +[scrolling] +history = 5000 + +[window] +opacity = 0.7 +title = "Alacritty" + +[window.class] +general = "Alacritty" +instance = "Alacritty" + +[window.padding] +x = 6 +y = 6 + +[colors] +draw_bold_text_with_bright_colors = true + +[keyboard] diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..1eb55f6 --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,58 @@ +{ + "LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" }, + "aerial.nvim": { "branch": "master", "commit": "1160fb7a15a34b03b7381d95d45560712b5f19d0" }, + "base16-vim": { "branch": "master", "commit": "3be3cd82cd31acfcab9a41bad853d9c68d30478d" }, + "blink.cmp": { "branch": "main", "commit": "5f442681df24fe705d1ee7ce5b4d435aa4b4dee4" }, + "conform.nvim": { "branch": "master", "commit": "9180320205d250429f0f80e073326c674e2a7149" }, + "dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" }, + "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, + "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, + "git-blame.nvim": { "branch": "master", "commit": "2883a7460f611c2705b23f12d58d398d5ce6ec00" }, + "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" }, + "go.nvim": { "branch": "master", "commit": "c6d5ca26377d01c4de1f7bff1cd62c8b43baa6bc" }, + "gruvbox-material": { "branch": "master", "commit": "055aefde5fd49018f3a858bca7b529bc2e08c02b" }, + "gruvbox.nvim": { "branch": "main", "commit": "68c3460a5d1d1a362318960035c9f3466d5011f5" }, + "harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" }, + "indent-blankline.nvim": { "branch": "master", "commit": "259357fa4097e232730341fa60988087d189193a" }, + "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, + "lazydev.nvim": { "branch": "main", "commit": "8620f82ee3f59ff2187647167b6b47387a13a018" }, + "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "c6c686781f9841d855bf1b926e10aa5e19430a38" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "mini.base16": { "branch": "main", "commit": "23453dacc1606e5d42238d82f0b42a2985386b62" }, + "mini.bufremove": { "branch": "main", "commit": "285bdac9596ee7375db50c0f76ed04336dcd2685" }, + "mini.comment": { "branch": "main", "commit": "a56581c40c19fa26f2b39da72504398de3173c5a" }, + "mini.icons": { "branch": "main", "commit": "6787321f70d674a481776b7cc2c781fb7002c644" }, + "mini.surround": { "branch": "main", "commit": "aa5e245829dd12d8ff0c96ef11da28681d6049aa" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, + "neogen": { "branch": "main", "commit": "dd0301bfba1f83a3bc009b5430fce7aa3cee6941" }, + "neorg": { "branch": "main", "commit": "6b945909d84b5aeadc875f9b3f529ec44b9bc60f" }, + "noice.nvim": { "branch": "main", "commit": "eaed6cc9c06aa2013b5255349e4f26a6b17ab70f" }, + "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, + "numb.nvim": { "branch": "master", "commit": "3f7d4a74bd456e747a1278ea1672b26116e0824d" }, + "nvim-cmp": { "branch": "main", "commit": "b555203ce4bd7ff6192e759af3362f9d217e8c89" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "8a65c448122fc8fac9c67b2e857b6e830a4afd0b" }, + "nvim-lspconfig": { "branch": "master", "commit": "8b15a1a597a59f4f5306fad9adfe99454feab743" }, + "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, + "nvim-treesitter": { "branch": "master", "commit": "e947d35bbf919ea88a24c21cb8afa4621e3cf547" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, + "nvim-web-devicons": { "branch": "master", "commit": "4adeeaa7a32d46cf3b5833341358c797304f950a" }, + "oil.nvim": { "branch": "master", "commit": "ba858b662599eab8ef1cba9ab745afded99cb180" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, + "rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" }, + "sonokai": { "branch": "master", "commit": "1d7ca954792dfddd9e73c53563d85adaeb8c8437" }, + "telescope.nvim": { "branch": "master", "commit": "2eca9ba22002184ac05eddbe47a7fe2d5a384dfc" }, + "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, + "tokyonight.nvim": { "branch": "main", "commit": "45d22cf0e1b93476d3b6d362d720412b3d34465c" }, + "treesitter-context": { "branch": "master", "commit": "2bcf700b59bc92850ca83a1c02e86ba832e0fae0" }, + "trouble.nvim": { "branch": "main", "commit": "46cf952fc115f4c2b98d4e208ed1e2dce08c9bf6" }, + "undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" }, + "vim": { "branch": "master", "commit": "65f4225e0526516a67d56c8ac09925a209138e53" }, + "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, + "vim-markdown": { "branch": "master", "commit": "8f6cb3a6ca4e3b6bcda0730145a0b700f3481b51" }, + "vim-slash": { "branch": "master", "commit": "31aee09b7ea8893a18fa34f65e63e364fc998444" }, + "which-key.nvim": { "branch": "main", "commit": "8ab96b38a2530eacba5be717f52e04601eb59326" }, + "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" }, + "zk-nvim": { "branch": "main", "commit": "6beea6fafe2c781cb10e80878e68d5e32937692a" } +} diff --git a/.config/nvim/lua/lazyvim/config/autocmds.lua b/.config/nvim/lua/lazyvim/config/autocmds.lua new file mode 100755 index 0000000..986375c --- /dev/null +++ b/.config/nvim/lua/lazyvim/config/autocmds.lua @@ -0,0 +1,81 @@ +-- highlight on yank +vim.api.nvim_create_autocmd('TextYankPost', { + group = vim.api.nvim_create_augroup('highlight_yank', {}), + desc = 'Hightlight selection on yank', + pattern = '*', + callback = function() + vim.highlight.on_yank { higroup = 'IncSearch', timeout = 500 } + end, +}) + +vim.api.nvim_create_autocmd({ "VimEnter" }, { + callback = function() + vim.cmd("hi link illuminatedWord LspReferenceText") + end, +}) + +-- go to last loc when opening a buffer +vim.api.nvim_create_autocmd("BufReadPost", { + callback = function() + local mark = vim.api.nvim_buf_get_mark(0, '"') + local lcount = vim.api.nvim_buf_line_count(0) + if mark[1] > 0 and mark[1] <= lcount then + pcall(vim.api.nvim_win_set_cursor, 0, mark) + end + end, +}) + +-- close some filetypes with +vim.api.nvim_create_autocmd("FileType", { + pattern = { + "qf", + "help", + "man", + "notify", + "lspinfo", + "spectre_panel", + "startuptime", + "tsplayground", + "PlenaryTestPopup", + }, + callback = function(event) + vim.bo[event.buf].buflisted = false + vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) + end, +}) + +-- add spellcheck and wrapping to some file types +vim.api.nvim_create_autocmd("FileType", { + pattern = { "gitcommit", "markdown" }, + callback = function() + vim.opt_local.wrap = true + vim.opt_local.spell = true + end, +}) + +-- Prevent auto comment on next line +vim.cmd('autocmd BufEnter * set formatoptions-=cro') +vim.cmd('autocmd BufEnter * setlocal formatoptions-=cro') + +-- Set filetype to tex for .tex files? +vim.cmd([[autocmd BufRead,BufNewFile *.tex set filetype=tex]]) + +-- Trim whitespace from files on save +vim.cmd([[ +autocmd BufWritePre * let currPos = getpos(".") +autocmd BufWritePre * %s/\s\+$//e +autocmd BufWritePre * %s/\n\+\%$//e +autocmd BufWritePre *.[ch] %s/\%$/\r/e +autocmd BufWritePre * cal cursor(currPos[1], currPos[2]) +]]) + +-- Run custom textclear command when exiting a .tex file (cleanup files) +vim.cmd([[autocmd VimLeave *.tex !texclear %]]) + +vim.api.nvim_create_autocmd("TermOpen", { + group = vim.api.nvim_create_augroup("custom-term-open", { clear = true }), + callback = function() + vim.opt.number = false + vim.opt.relativenumber = false + end +}) diff --git a/.config/nvim/lua/lazyvim/config/keymaps.lua b/.config/nvim/lua/lazyvim/config/keymaps.lua index fb9be97..171a66c 100755 --- a/.config/nvim/lua/lazyvim/config/keymaps.lua +++ b/.config/nvim/lua/lazyvim/config/keymaps.lua @@ -56,6 +56,7 @@ 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", "", "") +vim.keymap.set("n", "xt", "PlenaryBustedFile %") local job_id = 0 vim.keymap.set("n", "Ts", function() diff --git a/.config/nvim/lua/lazyvim/config/options.lua b/.config/nvim/lua/lazyvim/config/options.lua index 402f62b..4f06882 100644 --- a/.config/nvim/lua/lazyvim/config/options.lua +++ b/.config/nvim/lua/lazyvim/config/options.lua @@ -1,48 +1,48 @@ local options = { - backup = false, -- creates a backup file - clipboard = "unnamedplus", -- gives nvim access to clipboard - cmdheight = 1, -- more space in nvim cmd line - completeopt = { "menuone", "noselect" }, -- cmp related - conceallevel = 3, -- don't hide `` in md - fileencoding = "utf-8", - hlsearch = false, - ignorecase = true, - mouse = "a", -- allow use of mouse (bad I know but sometimes useful) - pumheight = 10, -- popup menu height - showmode = true, - smartcase = true, - smartindent = true, - splitbelow = true, - splitright = true, - swapfile = false, - termguicolors = true, - timeoutlen = 500, - ttimeoutlen = 10, - undofile = true, - updatetime = 100, - writebackup = false, - expandtab = true, -- use spaces instead of tab - shiftwidth = 4, -- insert 4 spaces for indentation - tabstop = 4, -- insert 4 spaces for tab - cursorline = false, - number = true, - laststatus = 3, - showcmd = false, - ruler = false, - relativenumber = true, - numberwidth = 2, - signcolumn = "yes", - wrap = false, - scrolloff = 8, - sidescrolloff = 8, - guifont = "monospace:h17", - title = true, - spelllang = "en_gb", - autowrite = true, - confirm = true, - formatoptions = "jcroqlnt", -- tcqj - grepformat = "%f:%l:%c:%m", - grepprg = "rg --vimgrep", + backup = false, -- creates a backup file + clipboard = "unnamedplus", -- gives nvim access to clipboard + cmdheight = 1, -- more space in nvim cmd line + completeopt = { "menuone", "noselect" }, -- cmp related + conceallevel = 0, -- don't hide ``` in markdown + fileencoding = "utf-8", + hlsearch = false, + ignorecase = true, + mouse = "a", -- allow use of mouse (bad I know but sometimes useful) + pumheight = 10, -- popup menu height + showmode = true, + smartcase = true, + smartindent = true, + splitbelow = true, + splitright = true, + swapfile = false, + termguicolors = true, + timeoutlen = 500, + ttimeoutlen = 10, + undofile = true, + updatetime = 100, + writebackup = false, + expandtab = true, -- use spaces instead of tab + shiftwidth = 4, -- insert 4 spaces for indentation + tabstop = 4, -- insert 4 spaces for tab + cursorline = false, + number = true, + laststatus = 3, + showcmd = false, + ruler = false, + relativenumber = true, + numberwidth = 2, + signcolumn = "yes:1", + wrap = false, + scrolloff = 8, + sidescrolloff = 8, + guifont = "monospace:h17", + title = true, + spelllang = "en_gb", + autowrite = true, + confirm = true, + formatoptions = "jcroqlnt", -- tcqj + grepformat = "%f:%l:%c:%m", + grepprg = "rg --vimgrep", } vim.opt.fillchars = vim.opt.fillchars + "eob: " @@ -50,7 +50,7 @@ vim.opt.fillchars = vim.opt.fillchars + "eob: " vim.opt.shortmess:append("c") for k, v in pairs(options) do - vim.opt[k] = v + vim.opt[k] = v end vim.cmd("set whichwrap+=<,>,[,],h,l") diff --git a/.config/nvim/lua/lazyvim/plugins/aerial.lua b/.config/nvim/lua/lazyvim/plugins/aerial.lua index 0bfeaa7..e36a3ad 100644 --- a/.config/nvim/lua/lazyvim/plugins/aerial.lua +++ b/.config/nvim/lua/lazyvim/plugins/aerial.lua @@ -1,10 +1,11 @@ return { - { - "stevearc/aerial.nvim", - opts = {}, - dependencies = { - "nvim-treesitter/nvim-treesitter", - "nvim-tree/nvim-web-devicons", - }, - }, + { + "stevearc/aerial.nvim", + enabled = false, + opts = {}, + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-tree/nvim-web-devicons", + }, + }, } diff --git a/.config/nvim/lua/lazyvim/plugins/cmp.lua b/.config/nvim/lua/lazyvim/plugins/cmp.lua index 7d0db55..8aef144 100644 --- a/.config/nvim/lua/lazyvim/plugins/cmp.lua +++ b/.config/nvim/lua/lazyvim/plugins/cmp.lua @@ -1,6 +1,7 @@ return { { 'saghen/blink.cmp', + enabled = true, -- optional: provides snippets for the snippet source dependencies = 'rafamadriz/friendly-snippets', @@ -14,6 +15,11 @@ return { ---@module 'blink.cmp' ---@type blink.cmp.Config opts = { + enabled = function() + -- you list filetypes where you dob't want blink blink to work here + local disabled_filetypes = { "oil_preview", "oil", "TelescopePrompt" } -- you can add extra fileypes you do not want blink enabled. + return not vim.tbl_contains(disabled_filetypes, vim.bo.filetype) + end, -- '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 @@ -34,6 +40,7 @@ return { -- elsewhere in your config, without redefining it, due to `opts_extend` sources = { default = { 'lsp', 'path', 'snippets', 'buffer' }, + cmdline = {} }, }, opts_extend = { "sources.default" } diff --git a/.config/nvim/lua/lazyvim/plugins/color.lua b/.config/nvim/lua/lazyvim/plugins/color.lua index 6b37271..1407440 100644 --- a/.config/nvim/lua/lazyvim/plugins/color.lua +++ b/.config/nvim/lua/lazyvim/plugins/color.lua @@ -1,41 +1,49 @@ return { { "sainnhe/gruvbox-material", + enabled = true, lazy = true, priority = 1000, }, { "ellisonleao/gruvbox.nvim", + enabled = true, lazy = true, priority = 1000, }, { "sainnhe/sonokai", + enabled = true, lazy = true, priority = 1000, }, { "dracula/vim", + enabled = true, lazy = true, priority = 1000, }, { "folke/tokyonight.nvim", + enabled = true, lazy = true, priority = 1000, }, { "echasnovski/mini.base16", + enabled = true, lazy = false, priority = 1000, }, { "chriskempson/base16-vim", + enabled = true, lazy = false, priority = 1000, }, { "NvChad/nvim-colorizer.lua", + enabled = true, opts = function() require("colorizer").setup({}) end, diff --git a/.config/nvim/lua/lazyvim/plugins/comments.lua b/.config/nvim/lua/lazyvim/plugins/comments.lua index 2e03471..f56a4e3 100644 --- a/.config/nvim/lua/lazyvim/plugins/comments.lua +++ b/.config/nvim/lua/lazyvim/plugins/comments.lua @@ -1,6 +1,7 @@ return { { "folke/todo-comments.nvim", + enabled = true, cmd = { "TodoTrouble", "TodoTelescope" }, event = "BufReadPost", config = true, @@ -13,9 +14,10 @@ return { { "tf", "TodoTelescope", desc = "Todo Telescope" }, }, }, - { "JoosepAlviste/nvim-ts-context-commentstring" }, + { "JoosepAlviste/nvim-ts-context-commentstring", enabled = true }, { "echasnovski/mini.comment", + enabled = true, event = "VeryLazy", opts = { hooks = { diff --git a/.config/nvim/lua/lazyvim/plugins/core.lua b/.config/nvim/lua/lazyvim/plugins/core.lua index f577f67..a9a92fa 100644 --- a/.config/nvim/lua/lazyvim/plugins/core.lua +++ b/.config/nvim/lua/lazyvim/plugins/core.lua @@ -1,5 +1,5 @@ return { - { - "folke/lazy.nvim", - }, + { + "folke/lazy.nvim", + }, } diff --git a/.config/nvim/lua/lazyvim/plugins/dev.lua b/.config/nvim/lua/lazyvim/plugins/dev.lua new file mode 100644 index 0000000..2678f38 --- /dev/null +++ b/.config/nvim/lua/lazyvim/plugins/dev.lua @@ -0,0 +1,7 @@ +return { + { + dir = "~/repos/neovim-plugins/present.nvim", + enabled = true, + lazy = false, + } +} diff --git a/.config/nvim/lua/lazyvim/plugins/dressing.lua b/.config/nvim/lua/lazyvim/plugins/dressing.lua index 2d44593..ddaeba1 100644 --- a/.config/nvim/lua/lazyvim/plugins/dressing.lua +++ b/.config/nvim/lua/lazyvim/plugins/dressing.lua @@ -1,17 +1,18 @@ return { - { - "stevearc/dressing.nvim", - 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, - }, + { + "stevearc/dressing.nvim", + enabled = false, + 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, + }, } diff --git a/.config/nvim/lua/lazyvim/plugins/flash.lua b/.config/nvim/lua/lazyvim/plugins/flash.lua index d9894e3..0317114 100644 --- a/.config/nvim/lua/lazyvim/plugins/flash.lua +++ b/.config/nvim/lua/lazyvim/plugins/flash.lua @@ -1,6 +1,7 @@ return { { "folke/flash.nvim", + enabled = false, event = "VeryLazy", opts = {}, -- stylua: ignore diff --git a/.config/nvim/lua/lazyvim/plugins/git.lua b/.config/nvim/lua/lazyvim/plugins/git.lua index ab84ce1..5e177f8 100644 --- a/.config/nvim/lua/lazyvim/plugins/git.lua +++ b/.config/nvim/lua/lazyvim/plugins/git.lua @@ -1,6 +1,7 @@ return { { "lewis6991/gitsigns.nvim", + enabled = true, event = "BufReadPre", opts = { signs = { @@ -36,6 +37,7 @@ return { }, { "f-person/git-blame.nvim", + enabled = true, event = "BufEnter", }, } diff --git a/.config/nvim/lua/lazyvim/plugins/go.lua b/.config/nvim/lua/lazyvim/plugins/go.lua index 5498952..0ffb8ee 100644 --- a/.config/nvim/lua/lazyvim/plugins/go.lua +++ b/.config/nvim/lua/lazyvim/plugins/go.lua @@ -1,6 +1,7 @@ return { { "ray-x/go.nvim", + enabled = true, requires = { "ray-x/guihua.lua", "neovim/nvim-lspconfig", diff --git a/.config/nvim/lua/lazyvim/plugins/harpoon.lua b/.config/nvim/lua/lazyvim/plugins/harpoon.lua index 43532d3..fef8102 100644 --- a/.config/nvim/lua/lazyvim/plugins/harpoon.lua +++ b/.config/nvim/lua/lazyvim/plugins/harpoon.lua @@ -1,16 +1,17 @@ return { - { - "ThePrimeagen/harpoon", - keys = { - { "]m", 'lua require("harpoon.ui").nav_next()', desc = "Harpoon Next" }, - { "[m", 'lua require("harpoon.ui").nav_prev()', desc = "Harpoon Prev" }, - { "mm", 'lua require("harpoon.mark").add_file()', desc = "Harpoon" }, - { "ms", "Telescope harpoon marks", desc = "Search Files" }, - { "mu", 'lua require("harpoon.ui").toggle_quick_menu()', desc = "Harpoon UI" }, - { "m1", ' lua require("harpoon.ui").nav_file(1)', desc = "Goto 1" }, - { "m2", ' lua require("harpoon.ui").nav_file(2)', desc = "Goto 2" }, - { "m3", ' lua require("harpoon.ui").nav_file(3)', desc = "Goto 3" }, - { "m4", ' lua require("harpoon.ui").nav_file(4)', desc = "Goto 4" }, - }, - }, + { + "ThePrimeagen/harpoon", + enabled = true, + keys = { + { "]m", 'lua require("harpoon.ui").nav_next()', desc = "Harpoon Next" }, + { "[m", 'lua require("harpoon.ui").nav_prev()', desc = "Harpoon Prev" }, + { "mm", 'lua require("harpoon.mark").add_file()', desc = "Harpoon" }, + { "ms", "Telescope harpoon marks", desc = "Search Files" }, + { "mu", 'lua require("harpoon.ui").toggle_quick_menu()', desc = "Harpoon UI" }, + { "m1", ' lua require("harpoon.ui").nav_file(1)', desc = "Goto 1" }, + { "m2", ' lua require("harpoon.ui").nav_file(2)', desc = "Goto 2" }, + { "m3", ' lua require("harpoon.ui").nav_file(3)', desc = "Goto 3" }, + { "m4", ' lua require("harpoon.ui").nav_file(4)', desc = "Goto 4" }, + }, + }, } diff --git a/.config/nvim/lua/lazyvim/plugins/lsp/init.lua b/.config/nvim/lua/lazyvim/plugins/lsp/init.lua index 347207d..70b9e1c 100644 --- a/.config/nvim/lua/lazyvim/plugins/lsp/init.lua +++ b/.config/nvim/lua/lazyvim/plugins/lsp/init.lua @@ -2,6 +2,7 @@ return { -- lspconfig { "neovim/nvim-lspconfig", + enabled = true, event = "BufReadPre", dependencies = { { @@ -192,6 +193,7 @@ return { -- cmdline tools and lsp servers { "williamboman/mason.nvim", + enabled = true, cmd = "Mason", keys = { { "lM", "Mason", desc = "Mason" } }, opts = { @@ -217,6 +219,7 @@ return { -- language specific tooling { "simrat39/rust-tools.nvim", + enabled = true, opts = { server = { on_attach = function(_, bufnr) diff --git a/.config/nvim/lua/lazyvim/plugins/lsp/misc.lua b/.config/nvim/lua/lazyvim/plugins/lsp/misc.lua index a1538be..d8b8381 100644 --- a/.config/nvim/lua/lazyvim/plugins/lsp/misc.lua +++ b/.config/nvim/lua/lazyvim/plugins/lsp/misc.lua @@ -7,7 +7,7 @@ function M.disable_deno_formatting(client) end function M.resolve_tsserver_deno(client) - local active_clients = vim.lsp.get_active_clients() + local active_clients = vim.lsp.get_clients() if client.name == "denols" then for _, client_ in pairs(active_clients) do -- stop tsserver if denols is already active @@ -26,7 +26,7 @@ function M.resolve_tsserver_deno(client) end function M.disable_others_when_zk(client) - local active_clients = vim.lsp.get_active_clients() + local active_clients = vim.lsp.get_clients() if client.name == "zk" then for _, client_ in pairs(active_clients) do -- stop ltex if zk is already active diff --git a/.config/nvim/lua/lazyvim/plugins/lualine.lua b/.config/nvim/lua/lazyvim/plugins/lualine.lua index 56d166d..9697a47 100644 --- a/.config/nvim/lua/lazyvim/plugins/lualine.lua +++ b/.config/nvim/lua/lazyvim/plugins/lualine.lua @@ -1,115 +1,116 @@ return { - "nvim-lualine/lualine.nvim", - event = "VeryLazy", - opts = function() - local colors = { - red = "#ca1243", - grey = "#a0a1a7", - black = "#383a42", - white = "#f3f3f3", - light_green = "#83a598", - orange = "#fe8019", - green = "#8ec07c", - } + "nvim-lualine/lualine.nvim", + enabled = true, + event = "VeryLazy", + opts = function() + local colors = { + red = "#ca1243", + grey = "#a0a1a7", + black = "#383a42", + white = "#f3f3f3", + light_green = "#83a598", + orange = "#fe8019", + green = "#8ec07c", + } - -- Put proper separators and gaps between components in sections - local function process_sections(sections) - for name, section in pairs(sections) do - local left = name:sub(9, 10) < "x" - for pos = 1, name ~= "lualine_z" and #section or #section - 1 do - table.insert(section, pos * 2, { color = { fg = colors.white, bg = colors.white } }) - end - for id, comp in ipairs(section) do - if type(comp) ~= "table" then - comp = { comp } - section[id] = comp - end - comp.separator = left and { right = "" } or { left = "" } - end - end - return sections - end + -- Put proper separators and gaps between components in sections + local function process_sections(sections) + for name, section in pairs(sections) do + local left = name:sub(9, 10) < "x" + for pos = 1, name ~= "lualine_z" and #section or #section - 1 do + table.insert(section, pos * 2, { color = { fg = colors.white, bg = colors.white } }) + end + for id, comp in ipairs(section) do + if type(comp) ~= "table" then + comp = { comp } + section[id] = comp + end + comp.separator = left and { right = "" } or { left = "" } + end + end + return sections + end - local function search_result() - if vim.v.hlsearch == 0 then - return "" - end - local last_search = vim.fn.getreg("/") - if not last_search or last_search == "" then - return "" - end - local searchcount = vim.fn.searchcount({ maxcount = 9999 }) - return last_search .. "(" .. searchcount.current .. "/" .. searchcount.total .. ")" - end + local function search_result() + if vim.v.hlsearch == 0 then + return "" + end + local last_search = vim.fn.getreg("/") + if not last_search or last_search == "" then + return "" + end + local searchcount = vim.fn.searchcount({ maxcount = 9999 }) + return last_search .. "(" .. searchcount.current .. "/" .. searchcount.total .. ")" + end - local function modified() - if vim.bo.modified then - return "+" - elseif vim.bo.modifiable == false or vim.bo.readonly == true then - return "-" - end - return "" - end + local function modified() + if vim.bo.modified then + return "+" + elseif vim.bo.modifiable == false or vim.bo.readonly == true then + return "-" + end + return "" + end - return { - options = { - theme = "auto", - globalstatus = true, - disabled_filetypes = { statusline = { "dashboard", "lazy", "alpha" } }, - }, - sections = process_sections({ - lualine_a = { "mode" }, - lualine_b = { - "branch", - "diff", - { - "diagnostics", - source = { "nvim" }, - sections = { "error" }, - -- diagnostics_color = { error = { bg = colors.red, fg = colors.white } }, - }, - { - "diagnostics", - source = { "nvim" }, - sections = { "warn" }, - -- diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } }, - }, - { "filename", file_status = false, path = 1 }, - { modified, color = { bg = colors.red } }, - { - "%w", - cond = function() - return vim.wo.previewwindow - end, - }, - { - "%r", - cond = function() - return vim.bo.readonly - end, - }, - { - "%q", - cond = function() - return vim.bo.buftype == "quickfix" - end, - }, - }, - lualine_c = { - { - function() - return require("nvim-navic").get_location() - end, - cond = function() - return package.loaded["nvim-navic"] and require("nvim-navic").is_available() - end, - }, - }, - lualine_x = {}, - lualine_y = { search_result, "filetype" }, - -- lualine_y = { "filetype " }, - lualine_z = { "%l:%c", "%p%%/%L" }, - }), - } - end, + return { + options = { + theme = "auto", + globalstatus = true, + disabled_filetypes = { statusline = { "dashboard", "lazy", "alpha" } }, + }, + sections = process_sections({ + lualine_a = { "mode" }, + lualine_b = { + "branch", + "diff", + { + "diagnostics", + source = { "nvim" }, + sections = { "error" }, + -- diagnostics_color = { error = { bg = colors.red, fg = colors.white } }, + }, + { + "diagnostics", + source = { "nvim" }, + sections = { "warn" }, + -- diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } }, + }, + { "filename", file_status = false, path = 1 }, + { modified, color = { bg = colors.red } }, + { + "%w", + cond = function() + return vim.wo.previewwindow + end, + }, + { + "%r", + cond = function() + return vim.bo.readonly + end, + }, + { + "%q", + cond = function() + return vim.bo.buftype == "quickfix" + end, + }, + }, + lualine_c = { + { + function() + return require("nvim-navic").get_location() + end, + cond = function() + return package.loaded["nvim-navic"] and require("nvim-navic").is_available() + end, + }, + }, + lualine_x = {}, + lualine_y = { search_result, "filetype" }, + -- lualine_y = { "filetype " }, + lualine_z = { "%l:%c", "%p%%/%L" }, + }), + } + end, } diff --git a/.config/nvim/lua/lazyvim/plugins/neorg.lua b/.config/nvim/lua/lazyvim/plugins/neorg.lua index ceb7bed..d1563ad 100644 --- a/.config/nvim/lua/lazyvim/plugins/neorg.lua +++ b/.config/nvim/lua/lazyvim/plugins/neorg.lua @@ -1,37 +1,38 @@ return { - "nvim-neorg/neorg", - ft = "norg", - cmd = "Neorg", - build = ":Neorg sync-parsers", - dependencies = { - { "nvim-lua/plenary.nvim" }, - }, - opts = { - load = { - ["core.defaults"] = {}, - ["core.concealer"] = {}, - ["core.dirman"] = { - config = { - workspaces = { - default = "~/notes/neorg", - work = "~/notes/neorg/work", - personal = "~/notes/neorg/personal", - journal = "~/notes/neorg/journal", - }, - default_workspace = "default", - }, - }, - ["core.completion"] = { - config = { - engine = "nvim-cmp", - }, - }, - ["core.presenter"] = { - config = { - zen_mode = "zen-mode", - }, - }, - ["core.ui"] = {}, - }, - }, + "nvim-neorg/neorg", + enabled = false, + ft = "norg", + cmd = "Neorg", + build = ":Neorg sync-parsers", + dependencies = { + { "nvim-lua/plenary.nvim" }, + }, + opts = { + load = { + ["core.defaults"] = {}, + ["core.concealer"] = {}, + ["core.dirman"] = { + config = { + workspaces = { + default = "~/notes/neorg", + work = "~/notes/neorg/work", + personal = "~/notes/neorg/personal", + journal = "~/notes/neorg/journal", + }, + default_workspace = "default", + }, + }, + ["core.completion"] = { + config = { + engine = "nvim-cmp", + }, + }, + ["core.presenter"] = { + config = { + zen_mode = "zen-mode", + }, + }, + ["core.ui"] = {}, + }, + }, } diff --git a/.config/nvim/lua/lazyvim/plugins/noice.lua b/.config/nvim/lua/lazyvim/plugins/noice.lua index 201831d..bcec7d0 100644 --- a/.config/nvim/lua/lazyvim/plugins/noice.lua +++ b/.config/nvim/lua/lazyvim/plugins/noice.lua @@ -1,6 +1,7 @@ return { { "folke/noice.nvim", + enabled = false, event = "VeryLazy", opts = { lsp = { diff --git a/.config/nvim/lua/lazyvim/plugins/oil.lua b/.config/nvim/lua/lazyvim/plugins/oil.lua new file mode 100644 index 0000000..f362b9b --- /dev/null +++ b/.config/nvim/lua/lazyvim/plugins/oil.lua @@ -0,0 +1,9 @@ +return { + 'stevearc/oil.nvim', + enabled = true, + lazy = false, + opts = { + default_file_explorer = true, + }, + dependencies = { { "echasnovski/mini.icons", opts = {} } }, +} diff --git a/.config/nvim/lua/lazyvim/plugins/snippets.lua b/.config/nvim/lua/lazyvim/plugins/snippets.lua index 3820038..732906e 100644 --- a/.config/nvim/lua/lazyvim/plugins/snippets.lua +++ b/.config/nvim/lua/lazyvim/plugins/snippets.lua @@ -1,6 +1,7 @@ return { { "L3MON4D3/LuaSnip", + enabled = true, dependencies = { "rafamadriz/friendly-snippets", config = function() diff --git a/.config/nvim/lua/lazyvim/plugins/telescope.lua b/.config/nvim/lua/lazyvim/plugins/telescope.lua index 91b7c3e..55b8b37 100644 --- a/.config/nvim/lua/lazyvim/plugins/telescope.lua +++ b/.config/nvim/lua/lazyvim/plugins/telescope.lua @@ -3,30 +3,31 @@ local util = require("lazyvim.utils") return { { "nvim-telescope/telescope.nvim", + enabled = true, event = "VeryLazy", keys = { - { "/", util.telescope("live_grep"), desc = "Telescope Find in Files (Grep)" }, - { "", util.telescope("find_files"), desc = "Telescope Find Files (root dir)" }, - { "ff", util.telescope("find_files"), desc = "Telescope Find Files (root dir)" }, - { "fF", util.telescope("find_files", { cwd = false }), desc = "Telescope Find Files (cwd)" }, - { "fr", "Telescope oldfiles", desc = "Telescope Recent" }, - { "gc", "Telescope git_commits", desc = "Telescope commits" }, - { "gs", "Telescope git_status", desc = "Telescope status" }, - { "gb", "Telescope git_branches", desc = "Telescope branches" }, - { "ha", "Telescope autocommands", desc = "Telescope Auto Commands" }, - { "hc", "Telescope commands", desc = "Telescope Commands" }, - { "hf", "Telescope filetypes", desc = "Telescope File Types" }, - { "hh", "Telescope help_tags", desc = "Telescope Help Pages" }, - { "hk", "Telescope keymaps", desc = "Telescope Key Maps" }, - { "hm", "Telescope man_pages", desc = "Telescope Man Pages" }, - { "ho", "Telescope vim_options", desc = "Telescope Options" }, - { "hs", "Telescope highlights", desc = "Telescope Search Highlight Groups" }, - { "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", { cwd = false }), desc = "Telescope Grep (cwd)" }, - { "sm", "Telescope marks", desc = "Telescope Jump to Mark" }, - { "so", "Telescope resume", desc = "Telescope Resume last search" }, + { "/", util.telescope("live_grep"), desc = "Telescope Find in Files (Grep)" }, + { "", util.telescope("find_files"), desc = "Telescope Find Files (root dir)" }, + { "fn", util.telescope("find_files", { dir = "~/.config/nvim/" }), desc = "Telescope Find Files (config)" }, + { "ff", util.telescope("find_files", { cwd = false }), desc = "Telescope Find Files (cwd)" }, + { "fr", "Telescope oldfiles", desc = "Telescope Recent" }, + { "gc", "Telescope git_commits", desc = "Telescope commits" }, + { "gs", "Telescope git_status", desc = "Telescope status" }, + { "gb", "Telescope git_branches", desc = "Telescope branches" }, + { "ha", "Telescope autocommands", desc = "Telescope Auto Commands" }, + { "hc", "Telescope commands", desc = "Telescope Commands" }, + { "hf", "Telescope filetypes", desc = "Telescope File Types" }, + { "hh", "Telescope help_tags", desc = "Telescope Help Pages" }, + { "hk", "Telescope keymaps", desc = "Telescope Key Maps" }, + { "hm", "Telescope man_pages", desc = "Telescope Man Pages" }, + { "ho", "Telescope vim_options", desc = "Telescope Options" }, + { "hs", "Telescope highlights", desc = "Telescope Search Highlight Groups" }, + { "ht", "Telescope builtin", desc = "Telescope" }, + { "sb", "Telescope current_buffer_fuzzy_find", desc = "Telescope in Buffer" }, + { "sc", "Telescope command_history", desc = "Telescope Command History" }, + { "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" }, { "ss", util.telescope("lsp_document_symbols", { @@ -45,8 +46,8 @@ return { }), desc = "Goto Symbol", }, - { ",", "Telescope buffers show_all_buffers=true", desc = "Switch Buffer" }, - { ":", "Telescope command_history", desc = "Command History" }, + { "fb", "Telescope buffers show_all_buffers=true", desc = "Switch Buffer" }, + { ":", "Telescope command_history", desc = "Command History" }, }, opts = { defaults = { diff --git a/.config/nvim/lua/lazyvim/plugins/treesitter.lua b/.config/nvim/lua/lazyvim/plugins/treesitter.lua index 78edb39..e02a4db 100644 --- a/.config/nvim/lua/lazyvim/plugins/treesitter.lua +++ b/.config/nvim/lua/lazyvim/plugins/treesitter.lua @@ -1,8 +1,8 @@ return { { "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", enable = true, + build = ":TSUpdate", 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)) diff --git a/.config/nvim/lua/lazyvim/plugins/trouble.lua b/.config/nvim/lua/lazyvim/plugins/trouble.lua index b13cc12..7ff026b 100644 --- a/.config/nvim/lua/lazyvim/plugins/trouble.lua +++ b/.config/nvim/lua/lazyvim/plugins/trouble.lua @@ -1,6 +1,7 @@ return { { "folke/trouble.nvim", + enabled = true, cmd = { "Trouble" }, opts = { use_diagnostic_signs = true }, keys = { diff --git a/.config/nvim/lua/lazyvim/plugins/utility.lua b/.config/nvim/lua/lazyvim/plugins/utility.lua index 8b310cb..7bf6a3f 100644 --- a/.config/nvim/lua/lazyvim/plugins/utility.lua +++ b/.config/nvim/lua/lazyvim/plugins/utility.lua @@ -3,9 +3,11 @@ local icons = require("lazyvim.config.icons") return { { "nvim-lua/plenary.nvim", + enabled = true, }, { "RRethy/vim-illuminate", + enabled = true, event = "BufReadPost", config = function() require("illuminate").configure({ delay = 200 }) @@ -18,6 +20,7 @@ return { }, { "nvim-lua/popup.nvim", + enabled = true, }, { "rcarriga/nvim-notify", @@ -51,6 +54,7 @@ return { }, { "echasnovski/mini.bufremove", + enabled = true, event = "VeryLazy", -- stylua: ignore keys = { @@ -93,16 +97,20 @@ return { }, { "mbbill/undotree", + enabled = true, cmd = { "UndotreeToggle" }, }, { "MunifTanjim/nui.nvim", + enabled = true, }, { "kyazdani42/nvim-web-devicons", + enabled = true, }, { "lukas-reineke/indent-blankline.nvim", + enabled = true, opts = {}, }, { @@ -119,9 +127,11 @@ return { }, { "preservim/vim-markdown", + enabled = true, }, { "nacro90/numb.nvim", + enabled = true, event = "BufEnter", config = function() require("numb").setup({ @@ -132,44 +142,11 @@ return { }, { "junegunn/vim-slash", - }, - { - "folke/zen-mode.nvim", - cmd = { "ZenMode" }, - config = function() - require("zen-mode").setup({ - window = { - backdrop = 1, - height = 0.9, - width = 80, - options = { - signcolumn = "no", - number = false, - relativenumber = false, - cursorline = true, - cursorcolumn = false, -- disable cursor column - }, - }, - plugins = { - gitsigns = { enabled = false }, - tmux = { enabled = false }, - twilight = { enabled = false }, - }, - on_open = function() - vim.g.cmp_active = false - vim.cmd([[LspStop]]) - vim.opt.sidescrolloff = 0 - end, - on_close = function() - vim.g.cmp_active = true - vim.cmd([[LspStart]]) - vim.opt.sidescrolloff = 8 - end, - }) - end, + enabled = true, }, { "echasnovski/mini.surround", + enabled = true, keys = { "gz" }, opts = { mappings = { @@ -189,6 +166,7 @@ return { }, { "danymat/neogen", + enabled = true, event = "BufEnter", config = function() require("neogen").setup({ @@ -199,6 +177,7 @@ return { }, { "SmiteshP/nvim-navic", + enabled = true, init = function() vim.g.navic_silence = true require("lazyvim.utils").on_attach(function(client, buffer) diff --git a/.config/nvim/lua/lazyvim/plugins/whichkey.lua b/.config/nvim/lua/lazyvim/plugins/whichkey.lua index 6adbb1a..550be5f 100644 --- a/.config/nvim/lua/lazyvim/plugins/whichkey.lua +++ b/.config/nvim/lua/lazyvim/plugins/whichkey.lua @@ -1,5 +1,6 @@ return { "folke/which-key.nvim", + enabled = true, dependencies = { "echasnovski/mini.icons" }, event = "VeryLazy", opts = { @@ -267,8 +268,7 @@ return { { "oc", function() - local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3 - utils.toggle("conceallevel", false, { 0, conceallevel }) + utils.toggle("conceallevel", false, { 0, 3 }) end, desc = "Toggle conceal" }, diff --git a/.config/nvim/lua/lazyvim/plugins/zen.lua b/.config/nvim/lua/lazyvim/plugins/zen.lua new file mode 100644 index 0000000..0a3348a --- /dev/null +++ b/.config/nvim/lua/lazyvim/plugins/zen.lua @@ -0,0 +1,38 @@ +return { + { + "folke/zen-mode.nvim", + enabled = false, + cmd = { "ZenMode" }, + config = function() + require("zen-mode").setup({ + window = { + backdrop = 1, + height = 0.9, + width = 80, + options = { + signcolumn = "no", + number = false, + relativenumber = false, + cursorline = true, + cursorcolumn = false, -- disable cursor column + }, + }, + plugins = { + gitsigns = { enabled = false }, + tmux = { enabled = false }, + twilight = { enabled = false }, + }, + on_open = function() + vim.g.cmp_active = false + vim.cmd([[LspStop]]) + vim.opt.sidescrolloff = 0 + end, + on_close = function() + vim.g.cmp_active = true + vim.cmd([[LspStart]]) + vim.opt.sidescrolloff = 8 + end, + }) + end, + }, +} diff --git a/.config/nvim/lua/lazyvim/plugins/zk.lua b/.config/nvim/lua/lazyvim/plugins/zk.lua index 3c85c4a..4114381 100644 --- a/.config/nvim/lua/lazyvim/plugins/zk.lua +++ b/.config/nvim/lua/lazyvim/plugins/zk.lua @@ -1,6 +1,7 @@ return { { "mickael-menu/zk-nvim", + enabled = true, event = "VeryLazy", opts = { picker = "telescope", diff --git a/.config/nvim/lua/lazyvim/utils/init.lua b/.config/nvim/lua/lazyvim/utils/init.lua index 6e705ae..152ea40 100644 --- a/.config/nvim/lua/lazyvim/utils/init.lua +++ b/.config/nvim/lua/lazyvim/utils/init.lua @@ -30,7 +30,7 @@ function M.get_root() ---@type string[] local roots = {} if path then - for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do + for _, client in pairs(vim.lsp.get_clients({ bufnr = 0 })) do local workspace = client.config.workspace_folders local paths = workspace and vim.tbl_map(function(ws) @@ -128,8 +128,10 @@ function M.get_buf_option(opt) end function M.telescope(builtin, opts) + opts = opts or {} + opts.dir = opts.dir or M.get_root() return function() - require("telescope.builtin")[builtin](vim.tbl_deep_extend("force", { cwd = M.get_root() }, opts or {})) + require("telescope.builtin")[builtin](vim.tbl_deep_extend("force", { cwd = opts.dir }, opts)) end end @@ -141,7 +143,7 @@ function M.setColorscheme(scheme) if not okay then vim.notify("Colorscheme " .. colorscheme .. " not found!") - vim.cmd("colorsheme habamax") + vim.cmd("colorscheme habamax") end end diff --git a/.config/nvim/lua/lazyvim/utils/menu.lua b/.config/nvim/lua/lazyvim/utils/menu.lua new file mode 100644 index 0000000..3834599 --- /dev/null +++ b/.config/nvim/lua/lazyvim/utils/menu.lua @@ -0,0 +1,37 @@ +vim.cmd [[ + aunmenu PopUp + anoremenu PopUp.Inspect Inspect + amenu PopUp.-1- + anoremenu PopUp.Definition lua vim.lsp.buf.definition() + anoremenu PopUp.References Telescope lsp_references + nnoremenu PopUp.Back + amenu PopUp.-2- + amenu PopUp.URL gx +]] + +local group = vim.api.nvim_create_augroup("nvim_popupmenu", { clear = true }) +vim.api.nvim_create_autocmd("MenuPopup", { + pattern = "*", + group = group, + desc = "Custom PopUp Setup", + callback = function() + vim.cmd [[ + amenu disable PopUp.Definition + amenu disable PopUp.References + amenu disable PopUp.URL + ]] + + if vim.lsp.get_clients({ bufnr = 0 })[1] then + vim.cmd [[ + amenu enable PopUp.Definition + amenu enable PopUp.References + ]] + end + + local urls = require("vim.ui")._get_urls() + if vim.startswith(urls[1], "http") then + vim.cmd [[amenu enable PopUp.URL]] + end + end, +}) +-- TODO: Add autocoommand diff --git a/.config/nvim/lua/lazyvim/utils/telescope/multigrep.lua b/.config/nvim/lua/lazyvim/utils/telescope/multigrep.lua new file mode 100644 index 0000000..34aa60f --- /dev/null +++ b/.config/nvim/lua/lazyvim/utils/telescope/multigrep.lua @@ -0,0 +1,52 @@ +local pickers = require "telescope.pickers" +local finders = require "telescope.finders" +local make_entry = require "telescope.make_entry" +local conf = require "telescope.config".values + +local M = {} + +local live_multigrep = function(opts) + opts = opts or {} + opts.cwd = opts.cwd or vim.uv.cwd() + + local finder = finders.new_async_job({ + command_generator = function(prompt) + if not prompt or prompt == "" then + return nil + end + + local pieces = vim.split(prompt, " ") + local args = { "rg" } + if pieces[1] then + table.insert(args, "-e") + table.insert(args, pieces[1]) + end + + if pieces[2] then + table.insert(args, "-g") + table.insert(args, pieces[2]) + end + + ---@diagnostic disable-next-line: deprecated + return vim.tbl_flatten({ args, + { "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case" } + }) + end, + entry_maker = make_entry.gen_from_vimgrep(opts), + cwd = opts.cwd, + }) + + pickers.new(opts, { + debounce = 100, + prompt_title = "Multi Grep", + finder = finder, + previewer = conf.grep_previewer(opts), + sorter = require("telescope.sorters").empty() + }):find() +end + +M.setup = function() + vim.keymap.set("n", "sG", live_multigrep, { desc = "Live Multigrep" }) +end + +return M diff --git a/.config/nvim/lua/lazyvim/utils/term.lua b/.config/nvim/lua/lazyvim/utils/term.lua new file mode 100644 index 0000000..8a5695c --- /dev/null +++ b/.config/nvim/lua/lazyvim/utils/term.lua @@ -0,0 +1,53 @@ +local state = { + floating = { + buf = -1, + win = -1 + } +} + +function create_floating_window(opts) + -- Set default options if not provided + opts = opts or {} + opts.width = opts.width or math.floor(vim.o.columns * 0.8) -- Default 80% of screen width + opts.height = opts.height or math.floor(vim.o.lines * 0.8) -- Default 80% of screen height + + -- Create buffer + local buf = nil + if vim.api.nvim_buf_is_valid(opts.buf) then + buf = opts.buf + else + buf = vim.api.nvim_create_buf(false, true) -- no file, scratch buffer + end + + -- Calculate center position + local row = math.floor((vim.o.lines - opts.height) / 2) + local col = math.floor((vim.o.columns - opts.width) / 2) + + -- Floating window options + local win_opts = { + relative = "editor", + width = opts.width, + height = opts.height, + col = col, + row = row, + style = "minimal", + border = "rounded", -- You can use "none", "single", "double", or "rounded" + } + + -- Create the floating window + local win = vim.api.nvim_open_win(buf, true, win_opts) + + return { buf = buf, win = win } +end + +-- Emable usage: +vim.api.nvim_create_user_command("FloatTerminal", function() + if not vim.api.nvim_win_is_valid(state.floating.win) then + state.floating = create_floating_window({ buf = state.floating.buf }) + if vim.bo[state.floating.buf].buftype ~= "terminal" then + vim.cmd.term() + end + else + vim.api.nvim_win_hide(state.floating.win) + end +end, {})