From ae8de91f72aeea7305bbd844ed4e411126080a03 Mon Sep 17 00:00:00 2001 From: Matthew Roland Date: Sun, 24 Aug 2025 22:33:05 -0500 Subject: [PATCH] Recreate neovim configuration --- nvim/.stylua.toml | 6 - nvim/init.lua | 500 ++++----------------------- nvim/lazy-lock.json | 38 +- nvim/lua/config/colorful_indent.lua | 24 -- nvim/lua/config/init.lua | 2 - nvim/lua/config/keybinds.lua | 50 +++ nvim/lua/config/lsp.lua | 65 ---- nvim/lua/plugins/autopairs.lua | 16 - nvim/lua/plugins/barbar.lua | 37 -- nvim/lua/plugins/blinkcmp.lua | 45 --- nvim/lua/plugins/cmd.lua | 3 + nvim/lua/plugins/colorful_indent.lua | 38 +- nvim/lua/plugins/debug.lua | 103 ------ nvim/lua/plugins/gitsigns.lua | 65 +--- nvim/lua/plugins/lsp.lua | 188 +++++----- nvim/lua/plugins/markview.lua | 23 ++ nvim/lua/plugins/mini.lua | 34 ++ nvim/lua/plugins/neo-tree.lua | 45 --- nvim/lua/plugins/neotree.lua | 42 +++ nvim/lua/plugins/notify.lua | 7 + nvim/lua/plugins/nvimcmp.lua | 114 ------ nvim/lua/plugins/tabline.lua | 39 +++ nvim/lua/plugins/telescope.lua | 96 +++++ nvim/lua/plugins/theme.lua | 9 + nvim/lua/plugins/whichkey.lua | 53 +++ 25 files changed, 551 insertions(+), 1091 deletions(-) delete mode 100644 nvim/.stylua.toml delete mode 100644 nvim/lua/config/colorful_indent.lua delete mode 100644 nvim/lua/config/init.lua create mode 100644 nvim/lua/config/keybinds.lua delete mode 100644 nvim/lua/config/lsp.lua delete mode 100644 nvim/lua/plugins/autopairs.lua delete mode 100644 nvim/lua/plugins/barbar.lua delete mode 100644 nvim/lua/plugins/blinkcmp.lua create mode 100644 nvim/lua/plugins/cmd.lua delete mode 100644 nvim/lua/plugins/debug.lua create mode 100644 nvim/lua/plugins/markview.lua create mode 100644 nvim/lua/plugins/mini.lua delete mode 100644 nvim/lua/plugins/neo-tree.lua create mode 100644 nvim/lua/plugins/neotree.lua create mode 100644 nvim/lua/plugins/notify.lua delete mode 100644 nvim/lua/plugins/nvimcmp.lua create mode 100644 nvim/lua/plugins/tabline.lua create mode 100644 nvim/lua/plugins/telescope.lua create mode 100644 nvim/lua/plugins/theme.lua create mode 100644 nvim/lua/plugins/whichkey.lua diff --git a/nvim/.stylua.toml b/nvim/.stylua.toml deleted file mode 100644 index 139e939..0000000 --- a/nvim/.stylua.toml +++ /dev/null @@ -1,6 +0,0 @@ -column_width = 160 -line_endings = "Unix" -indent_type = "Spaces" -indent_width = 2 -quote_style = "AutoPreferSingle" -call_parentheses = "None" diff --git a/nvim/init.lua b/nvim/init.lua index f3736cf..80487fb 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -5,464 +5,80 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' vim.g.have_nerd_font = true --- Visual Things -vim.opt.cmdheight = 0 -- Currently looking for a solution for searching with / and ? +vim.opt.undofile = true +vim.opt.updatetime = 250 +vim.opt.timeoutlen = 200 + +-- Sync clipboard between nvim and host +vim.schedule(function() + vim.opt.clipboard = 'unnamedplus' +end) + +----------------------------- +-- Visual Settings +----------------------------- +vim.opt.cmdheight = 0 vim.opt.number = true vim.opt.relativenumber = true vim.opt.mouse = 'a' vim.opt.showmode = false --- Sync clipboard between OS and Neovim. --- Schedule the setting after `UiEnter` because it can increase startup-time. --- Remove this option if you want your OS clipboard to remain independent. --- See `:help 'clipboard'` --- It does get added to the @ register I believe? -vim.schedule(function() - vim.opt.clipboard = 'unnamedplus' -end) +vim.opt.cursorline = true +vim.opt.conceallevel = 2 +vim.opt.scrolloff = 5 --- Enable break indent -vim.opt.breakindent = true --- Enable word break instead of character break -vim.opt.linebreak = true - --- Save undo history -vim.opt.undofile = true - --- Case-insensitive searching UNLESS \C or one or more capital letters in the search term -vim.opt.ignorecase = true -vim.opt.smartcase = true - --- Keep signcolumn on by default -vim.opt.signcolumn = 'yes' - --- Decrease update time -vim.opt.updatetime = 250 - --- Decrease mapped sequence wait time --- Displays which-key popup sooner -vim.opt.timeoutlen = 200 - --- Configure how new splits should be opened vim.opt.splitright = true vim.opt.splitbelow = true --- Sets how neovim will display certain whitespace characters in the editor. --- See `:help 'list'` --- and `:help 'listchars'` +----------------------------- +-- Font & Text Settings +----------------------------- + +vim.opt.spell = true +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true +vim.opt.linebreak = true +vim.opt.breakindent = true + +vim.opt.ignorecase = true +vim.opt.smartcase = true + +vim.opt.signcolumn = 'yes' + +vim.opt.inccommand = 'split' + vim.opt.list = true vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } --- Preview substitutions live, as you type! -vim.opt.inccommand = 'split' +require 'config.keybinds' --- Hides special characters in markdown -vim.opt.conceallevel = 2 - --- Show which line your cursor is on -vim.opt.cursorline = true - --- Spelling Correction -vim.opt.spell = true --- vim.opt.spelllang = 'en' - --- Tabulation Stuffs -vim.opt.shiftwidth = 4 -vim.opt.expandtab = true - --- Minimal number of screen lines to keep above and below the cursor. -vim.opt.scrolloff = 7 - ------------------------------ --- Quality of Life Keybinds: ------------------------------ - -vim.keymap.set('n', '', 'w', { silent = true }) -vim.keymap.set('i', '', 'w', { silent = true }) - --------------------- --- Quit Vim -vim.keymap.set('n', 'qa', 'qa!', { desc = 'Force quit without saving'}) -vim.keymap.set('n', 'qx', 'xa!', { desc = 'Write to all then force quit'}) - - --------------------- --- Text Oriented -vim.keymap.set('n', '', 'nohlsearch') -vim.keymap.set('v', 'R', 's') - --------------------- --- Movement - --- Faster Window Navigation -vim.keymap.set('n', '', '', { silent=true, desc = 'Move focus to the left window' }) -vim.keymap.set('n', '', '', { silent=true, desc = 'Move focus to the right window' }) -vim.keymap.set('n', '', '', { silent=true, desc = 'Move focus to the lower window' }) -vim.keymap.set('n', '', '', { silent=true, desc = 'Move focus to the upper window' }) - --- Terminal --- or just use to exit terminal mode -vim.keymap.set('t', '', '', { silent=true, desc = 'Exit terminal mode' }) - --- Skipping Sections -vim.keymap.set('n', '', 'zz20kzz', { silent=true, desc = 'Skip Large Sections' }) -vim.keymap.set('n', '', 'zz20jzz', { silent=true, desc = 'Skip Large Sections' }) - -vim.keymap.set('i', '', '2k', { silent=true, desc = 'Skip Large Sections' }) -vim.keymap.set('i', '', '2j', { silent=true, desc = 'Skip Large Sections' }) - -vim.keymap.set('n', '', 'zz20kzz', { silent=true, desc = 'Skip Large Sections' }) -vim.keymap.set('n', '', 'zz20jzz', { silent=true, desc = 'Skip Large Sections' }) -vim.keymap.set('n', '', '10h', { silent=true, desc = 'Skip Large Sections' }) -vim.keymap.set('n', '', '10l', { silent=true, desc = 'Skip Large Sections' }) - -vim.keymap.set('i', '', '2k', { silent=true, desc = 'Skip Large Sections' }) -vim.keymap.set('i', '', '2j', { silent=true, desc = 'Skip Large Sections' }) -vim.keymap.set('i', '', '10l', { silent=true, desc = 'Skip Large Sections' }) -vim.keymap.set('i', '', '10h', { silent=true, desc = 'Skip Large Sections' }) - --------------------- --- Window Manipulation - -vim.keymap.set('n', '', 'q', { silent=true, desc='Close Window' }) - --------------------- --- Weird Sh*t Fixes -vim.keymap.set('n', 's', '', {desc="[S]urround"}) -- Dunno but this is needed to stop some weird substitution thing -vim.keymap.set('n', 'm', 'q', {desc="Macro"}) -vim.keymap.set('n', 'q', '') -- Record fights me so often - --- [[ Basic Autocommands ]] --- See `:help lua-guide-autocommands` - --- Highlight when yanking (copying) text --- Try it with `yap` in normal mode --- See `:help vim.highlight.on_yank()` -vim.api.nvim_create_autocmd('TextYankPost', { - desc = 'Highlight when yanking (copying) text', - group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), - callback = function() - vim.highlight.on_yank() - end, -}) - -local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = 'https://github.com/folke/lazy.nvim.git' - local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } - if vim.v.shell_error ~= 0 then - error('Error cloning lazy.nvim:\n' .. out) - end -end ---@diagnostic disable-next-line: undefined-field + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end vim.opt.rtp:prepend(lazypath) --- vim.notify = function(msg, level, opts) --- if msg:match("blink.cmp") then --- return -- Ignore messages from blink.cmp --- end --- vim.fn.notify(msg, level, opts) --- end +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, -require('lazy').setup({ - -- Was constantly fighting this. It get's it wrong istg ;-; - -- 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically - - -- See `:help gitsigns` to understand what the configuration keys do - { -- Adds git related signs to the gutter, as well as utilities for managing changes - 'lewis6991/gitsigns.nvim', - opts = { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, - }, - }, - - { -- Shows Keybinds - 'folke/which-key.nvim', - event = 'VimEnter', -- Sets the loading event to 'VimEnter' - opts = { - icons = { - mappings = vim.g.have_nerd_font, - keys = vim.g.have_nerd_font and {} or { - Up = ' ', - Down = ' ', - Left = ' ', - Right = ' ', - C = ' ', - M = ' ', - D = ' ', - S = ' ', - CR = ' ', - Esc = ' ', - ScrollWheelDown = ' ', - ScrollWheelUp = ' ', - NL = ' ', - BS = ' ', - Space = ' ', - Tab = ' ', - F1 = '', - F2 = '', - F3 = '', - F4 = '', - F5 = '', - F6 = '', - F7 = '', - F8 = '', - F9 = '', - F10 = '', - F11 = '', - F12 = '', - }, - }, - - -- Document existing key chains - spec = { - { 'c', group = '[C]ode', mode = { 'n', 'x' } }, - { 'd', group = '[D]iagnostic' }, - { 'r', group = '[R]ename' }, - { 'f', group = '[F]ind' }, - { 'w', group = '[W]orkspace' }, - { 't', group = '[T]oggle' }, - { 'q', group = 'Open quick [Q]uit menu' }, - { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, - { 's', group = '[S]urround' } - }, - }, - }, - - { -- Fuzzy Finder (files, lsp, etc) - 'nvim-telescope/telescope.nvim', - event = 'VimEnter', - branch = '0.1.x', - dependencies = { - 'nvim-lua/plenary.nvim', - { -- If encountering errors, see telescope-fzf-native README for installation instructions - 'nvim-telescope/telescope-fzf-native.nvim', - - -- `build` is used to run some command when the plugin is installed/updated. - -- This is only run then, not every time Neovim starts up. - build = 'make', - - -- `cond` is a condition used to determine whether this plugin should be - -- installed and loaded. - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, - { 'nvim-telescope/telescope-ui-select.nvim' }, - - -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, - }, - config = function() - -- The easiest way to use Telescope, is to start by doing something like: - -- :Telescope help_tags - -- - -- Two important keymaps to use while in Telescope are: - -- - Insert mode: - -- - Normal mode: ? - -- - -- [[ Configure Telescope ]] - -- See `:help telescope` and `:help telescope.setup()` - local actions = require('telescope.actions') - require('telescope').setup { - defaults = { - mappings = { - i = { - -- [''] = 'to_fuzzy_refine' - [''] = actions.close - }, - }, - find_command = { 'rg', '--files', '--follow' }, -- or 'fd' with '--follow' if you use fd as the search tool - }, - -- pickers = {} - extensions = { - ['ui-select'] = { - require('telescope.themes').get_dropdown(), - }, - }, - } - - -- Enable Telescope extensions if they are installed - pcall(require('telescope').load_extension, 'fzf') - pcall(require('telescope').load_extension, 'ui-select') - - -- See `:help telescope.builtin` - local builtin = require 'telescope.builtin' - vim.keymap.set('n', 'fh', builtin.help_tags, { desc = '[F]ind [H]elp' }) - vim.keymap.set('n', 'fk', builtin.keymaps, { desc = '[F]ind [K]eymaps' }) - vim.keymap.set('n', 'ff', builtin.find_files, { desc = '[F]ind [F]iles' }) - vim.keymap.set('n', 'fs', builtin.builtin, { desc = '[F]ind [S]elect Telescope' }) - vim.keymap.set('n', 'fw', builtin.grep_string, { desc = '[F]ind current [W]ord' }) - vim.keymap.set('n', 'fg', function() - require('telescope.builtin').live_grep { - additional_args = function() - return { "--follow" } - end, - } - end, { desc = '[F]ind by [G]rep' }) - vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' }) - vim.keymap.set('n', 'df', builtin.diagnostics, { desc = '[D]iagnostic [F]ind Via Telescope' }) - vim.keymap.set('n', 'fr', builtin.resume, { desc = '[F]ind [R]esume' }) - vim.keymap.set('n', 'f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) - vim.keymap.set('n', '', 'fg', { desc = '[ ] Find Grep' }) - - vim.keymap.set('n', '', function() - builtin.current_buffer_fuzzy_find({ - winblend = 10, - previewer = false, - }) - end, { desc = '' }) - - vim.keymap.set('n', 'fb', function() - builtin.live_grep { - grep_open_files = true, - prompt_title = 'Live Grep in Open Files', - } - end, { desc = '[F]ind in [B]uffers' }) - - -- Shortcut for searching your Neovim configuration files - vim.keymap.set('n', 'fn', function() - builtin.find_files { cwd = vim.fn.stdpath 'config' } - end, { desc = '[F]ind [N]eovim files' }) - end, - }, - - { -- You can easily change to a different colorscheme. - -- Change the name of the colorscheme plugin below, and then - -- change the command in the config to whatever the name of that colorscheme is. - -- - -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'catppuccin/nvim', - priority = 1000, -- Make sure to load this before all the other start plugins. - init = function() - -- Load the colorscheme here. - -- Like many other themes, this one has different styles, and you could load - -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'catppuccin-mocha' - - -- You can configure highlights by doing something like: - vim.cmd.hi 'Comment gui=none' - end, - }, - require 'plugins.lsp', - require 'plugins.autopairs', - require 'plugins.neo-tree', - require 'plugins.gitsigns', - require 'plugins.barbar', - require 'plugins.terminal', - require 'plugins.venn', - require 'plugins.blinkcmp', - require 'plugins.colorful_indent', - -- require 'plugins.debug', - -- Highlight todo, notes, etc in comments - { - "OXY2DEV/markview.nvim", - lazy = false, -- Recommended - -- ft = "markdown" -- If you decide to lazy-load anyway - - dependencies = { - "nvim-treesitter/nvim-treesitter", - "nvim-tree/nvim-web-devicons" - } - }, - { - 'folke/todo-comments.nvim', - event = 'VimEnter', - dependencies = { 'nvim-lua/plenary.nvim' }, - opts = { signs = false } - }, - { -- Collection of various small independent plugins/modules - 'echasnovski/mini.nvim', - config = function() - -- Better Around/Inside textobjects - -- - -- Examples: - -- - va) - [V]isually select [A]round [)]paren - -- - yinq - [Y]ank [I]nside [N]ext [Q]uote - -- - ci' - [C]hange [I]nside [']quote - require('mini.ai').setup { n_lines = 500 } - - -- Add/delete/replace surroundings (brackets, quotes, etc.) - -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren - -- - sd' - [S]urround [D]elete [']quotes - -- - sr)' - [S]urround [R]eplace [)] ['] - require('mini.surround').setup() - - -- Simple and easy statusline. - -- You could remove this setup call if you don't like it, - -- and try some other statusline plugin - local statusline = require 'mini.statusline' - -- set use_icons to true if you have a Nerd Font - statusline.setup { use_icons = vim.g.have_nerd_font } - - -- You can configure sections in the statusline by overriding their - -- default behavior. For example, here we set the section for - -- cursor location to LINE:COLUMN - ---@diagnostic disable-next-line: duplicate-set-field - statusline.section_location = function() - return '%2l:%-2v' - end - -- https://github.com/echasnovski/mini.nvim - end, - }, - { -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - main = 'nvim-treesitter.configs', - opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'query', 'vim', 'vimdoc' }, - -- Autoinstall languages that are not installed - auto_install = true, - highlight = { - enable = true, - -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. - -- If you are experiencing weird indenting issues, add the language to - -- the list of additional_vim_regex_highlighting and disabled languages for indent. - additional_vim_regex_highlighting = { 'ruby' }, - disable = { 'latex' } - }, - indent = { enable = true, disable = { 'ruby' } }, - }, - -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` - -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context - -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects - }, - { - 'VonHeikemen/fine-cmdline.nvim', - dependencies = { - {'MunifTanjim/nui.nvim'} - }, - cmdline = { - smart_history = true - }, - config = function() - vim.api.nvim_set_keymap('n', ':', 'FineCmdline', {noremap = true}) - end - }, -}, -{ - ui = { - icons = vim.g.have_nerd_font and {} or { - cmd = '⌘', - config = '🛠', - event = '📅', - ft = '📂', - init = '⚙', - keys = '🗝', - plugin = '🔌', - runtime = '💻', - require = '🌙', - source = '📄', - start = '🚀', - task = '📌', - lazy = '💤 ', - }, - }, + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "catppuccin-mocha" } }, + -- automatically check for plugin updates + checker = { enabled = true }, }) -require('config') diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 77feac8..7370023 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,31 +1,29 @@ { "FTerm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" }, "barbar.nvim": { "branch": "master", "commit": "53b5a2f34b68875898f0531032fbf090e3952ad7" }, - "blink.cmp": { "branch": "main", "commit": "485c03400608cb6534bbf84da8c1c471fc4808c0" }, - "fine-cmdline.nvim": { "branch": "main", "commit": "aec9efebf6f4606a5204d49ffa3ce2eeb7e08a3e" }, + "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "gitsigns.nvim": { "branch": "main", "commit": "43b0c856ae5f32a195d83f4a27fe21d63e6c966c" }, + "gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lspsaga.nvim": { "branch": "main", "commit": "920b1253e1a26732e53fac78412f6da7f674671d" }, - "markview.nvim": { "branch": "main", "commit": "3fd645600961781966adcfc1c77a6af8730042d7" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "d39a75bbce4b8aad5d627191ea915179c77c100f" }, - "mason.nvim": { "branch": "main", "commit": "7c7318e8bae7e3536ef6b9e86b9e38e74f2e125e" }, - "mini.nvim": { "branch": "main", "commit": "c665f30bb372c2ec8cfd61f7531098d3658b6634" }, - "neo-tree.nvim": { "branch": "main", "commit": "f481de16a0eb59c985abac8985e3f2e2f75b4875" }, - "nui.nvim": { "branch": "main", "commit": "f535005e6ad1016383f24e39559833759453564e" }, - "nvim": { "branch": "main", "commit": "1bf070129c0b6f77cc23f6a2212dcdc868308c52" }, - "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, - "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, - "nvim-lspconfig": { "branch": "master", "commit": "61e5109c8cf24807e4ae29813a3a82b31821dd45" }, - "nvim-treesitter": { "branch": "master", "commit": "28d480e0624b259095e56f353ec911f9f2a0f404" }, - "nvim-web-devicons": { "branch": "master", "commit": "f1420728f59843eb2ef084406b3d0201a0a0932d" }, - "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, - "schemastore.nvim": { "branch": "main", "commit": "df87d16fc4ea7c2c67cfc00b513861738693fe07" }, + "markview.nvim": { "branch": "main", "commit": "13746a05ea207bcbb432231eb9f0d09f71abc0a6" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "1ec4da522fa49dcecee8d190efda273464dd2192" }, + "mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" }, + "mini.icons": { "branch": "main", "commit": "b8f6fa6f5a3fd0c56936252edcd691184e5aac0c" }, + "mini.nvim": { "branch": "main", "commit": "e38547768b2e12bdd48b16b8cfdca2e3b7543e22" }, + "neo-tree.nvim": { "branch": "main", "commit": "cea666ef965884414b1b71f6b39a537f9238bdb2" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim": { "branch": "main", "commit": "30fa4d122d9b22ad8b2e0ab1b533c8c26c4dde86" }, + "nvim-lspconfig": { "branch": "master", "commit": "aaa807fb2ea8d3caf41c153a174c6b7e472a8428" }, + "nvim-notify": { "branch": "master", "commit": "397c7c1184745fca649e5104de659e6392ef5a4d" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-web-devicons": { "branch": "master", "commit": "c2599a81ecabaae07c49ff9b45dcd032a8d90f1a" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope-undo.nvim": { "branch": "main", "commit": "928d0c2dc9606e01e2cc547196f48d2eaecf58e5" }, "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "venn.nvim": { "branch": "main", "commit": "b09c2f36ddf70b498281845109bedcf08a7e0de0" }, - "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }, + "wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" } } diff --git a/nvim/lua/config/colorful_indent.lua b/nvim/lua/config/colorful_indent.lua deleted file mode 100644 index 114d6c3..0000000 --- a/nvim/lua/config/colorful_indent.lua +++ /dev/null @@ -1,24 +0,0 @@ -local highlight = { - "RainbowRed", - "RainbowYellow", - "RainbowBlue", - "RainbowOrange", - "RainbowGreen", - "RainbowViolet", - "RainbowCyan", -} - -local hooks = require "ibl.hooks" --- create the highlight groups in the highlight setup hook, so they are reset --- every time the colorscheme changes -hooks.register(hooks.type.HIGHLIGHT_SETUP, function() - vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" }) - vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" }) - vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" }) - vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" }) - vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" }) - vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" }) - vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" }) -end) - -require("ibl").setup { indent = { highlight = highlight } } diff --git a/nvim/lua/config/init.lua b/nvim/lua/config/init.lua deleted file mode 100644 index 8ab5ab1..0000000 --- a/nvim/lua/config/init.lua +++ /dev/null @@ -1,2 +0,0 @@ -require 'config.lsp' -require 'config.colorful_indent' diff --git a/nvim/lua/config/keybinds.lua b/nvim/lua/config/keybinds.lua new file mode 100644 index 0000000..d28df0f --- /dev/null +++ b/nvim/lua/config/keybinds.lua @@ -0,0 +1,50 @@ +vim.keymap.set('n', '', 'w', { silent = true }) +vim.keymap.set('i', '', 'w', { silent = true }) + +vim.keymap.set('n', 'qa', 'qa!', { desc = 'Force quit without saving'}) +vim.keymap.set('n', 'qx', 'xa!', { desc = 'Write to all then force quit'}) + +vim.keymap.set('n', '', 'nohlsearch') +vim.keymap.set('v', 'R', 's') + +-- Faster Window Navigation +vim.keymap.set('n', '', '', { silent=true, desc = 'Move focus to the left window' }) +vim.keymap.set('n', '', '', { silent=true, desc = 'Move focus to the right window' }) +vim.keymap.set('n', '', '', { silent=true, desc = 'Move focus to the lower window' }) +vim.keymap.set('n', '', '', { silent=true, desc = 'Move focus to the upper window' }) + +-- Terminal +-- or just use to exit terminal mode +vim.keymap.set('t', '', '', { silent=true, desc = 'Exit terminal mode' }) + +-- Skipping Sections +vim.keymap.set('n', '', 'zz20kzz', { silent=true, desc = 'Skip Large Sections' }) +vim.keymap.set('n', '', 'zz20jzz', { silent=true, desc = 'Skip Large Sections' }) + +vim.keymap.set('i', '', '2k', { silent=true, desc = 'Skip Large Sections' }) +vim.keymap.set('i', '', '2j', { silent=true, desc = 'Skip Large Sections' }) + +vim.keymap.set('n', '', 'zz20kzz', { silent=true, desc = 'Skip Large Sections' }) +vim.keymap.set('n', '', 'zz20jzz', { silent=true, desc = 'Skip Large Sections' }) +vim.keymap.set('n', '', '10h', { silent=true, desc = 'Skip Large Sections' }) +vim.keymap.set('n', '', '10l', { silent=true, desc = 'Skip Large Sections' }) + +vim.keymap.set('i', '', '2k', { silent=true, desc = 'Skip Large Sections' }) +vim.keymap.set('i', '', '2j', { silent=true, desc = 'Skip Large Sections' }) +vim.keymap.set('i', '', '10l', { silent=true, desc = 'Skip Large Sections' }) +vim.keymap.set('i', '', '10h', { silent=true, desc = 'Skip Large Sections' }) + +vim.keymap.set('n', '', 'q', { silent=true, desc='Close Window' }) + +vim.keymap.set('n', 's', '', {desc="[S]urround"}) -- Dunno but this is needed to stop some weird substitution thing +vim.keymap.set('n', 'm', 'q', {desc="Macro"}) +vim.keymap.set('n', 'q', '') -- Record fights me so often + +-- Highlight when yanking +vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) diff --git a/nvim/lua/config/lsp.lua b/nvim/lua/config/lsp.lua deleted file mode 100644 index 81d783c..0000000 --- a/nvim/lua/config/lsp.lua +++ /dev/null @@ -1,65 +0,0 @@ --- Disable Virtual Text Warnings and Errors -vim.diagnostic.config({ - -- virtual_text = false, - signs = true, - float = { border = "single" }, -}) - -local lsp = vim.lsp -local handlers = lsp.handlers - --- Hover doc popup -local pop_opts = { border = "rounded", max_width = 80 } -handlers["textDocument/hover"] = lsp.with(handlers.hover, pop_opts) -handlers["textDocument/signatureHelp"] = lsp.with(handlers.signature_help, pop_opts) - --- Quick Keybinds via g -vim.keymap.set('n', 'gr', "Lspsaga rename", {silent = true, noremap = true, desc = 'Lsp Saga Rename'}) -vim.keymap.set('n', 'gx', "Lspsaga code_action", {silent = true, noremap = true, desc = 'Lsp Saga Code Action'}) -vim.keymap.set('n', 'gs', "Lspsaga finder", { silent = true, noremap = true, desc = 'Lsp Saga Usage Finder' }) -vim.keymap.set('n', 'gg', "Lspsaga hover_doc", { silent = true, noremap = true, desc = 'Lsp Saga Hover Doc' }) -vim.keymap.set('n', 'go', "Lspsaga outline", { silent = true, noremap = true, desc = 'Lsp Saga Outline' }) - --- Diagnostic Specific Keybinds with Leader -vim.keymap.set('n', 'dr', "Lspsaga rename", {silent = true, noremap = true, desc = 'Lsp Saga Rename'}) -vim.keymap.set('n', 'dx', "Lspsaga code_action", {silent = true, noremap = true, desc = 'Lsp Saga Code Action'}) -vim.keymap.set('n', 'ds', "Lspsaga finder", { silent = true, noremap = true, desc = 'Lsp Saga Usage Finder' }) -vim.keymap.set('n', 'dg', "Lspsaga hover_doc", { silent = true, noremap = true, desc = 'Lsp Saga Hover Doc' }) -vim.keymap.set('n', 'do', "Lspsaga outline", { silent = true, noremap = true, desc = 'Lsp Saga Outline' }) - -vim.keymap.set('n', 'da', "Lspsaga show_workspace_diagnostics", { silent = true, noremap = true, desc = 'Lsp Saga Show Workspace Diagnostic' }) -vim.keymap.set('n', 'dd', "Lspsaga show_line_diagnostics", { silent = true, noremap = true, desc = 'Lsp Saga Show Line Diagnostic' }) - - -for _, method in ipairs({ 'textDocument/diagnostic', 'workspace/diagnostic' }) do - local default_diagnostic_handler = vim.lsp.handlers[method] - vim.lsp.handlers[method] = function(err, result, context, config) - if err ~= nil and err.code == -32802 then - return - end - return default_diagnostic_handler(err, result, context, config) - end -end - -require('lspconfig').jsonls.setup { - settings = { - json = { - schemas = require('schemastore').json.schemas(), - validate = { enable = true }, - }, - }, -} -require('lspconfig').yamlls.setup { - settings = { - yaml = { - schemaStore = { - -- You must disable built-in schemaStore support if you want to use - -- this plugin and its advanced options like `ignore`. - enable = false, - -- Avoid TypeError: Cannot read properties of undefined (reading 'length') - url = "", - }, - schemas = require('schemastore').yaml.schemas(), - }, - }, -} diff --git a/nvim/lua/plugins/autopairs.lua b/nvim/lua/plugins/autopairs.lua deleted file mode 100644 index 87a7e5f..0000000 --- a/nvim/lua/plugins/autopairs.lua +++ /dev/null @@ -1,16 +0,0 @@ --- autopairs --- https://github.com/windwp/nvim-autopairs - -return { - 'windwp/nvim-autopairs', - event = 'InsertEnter', - -- Optional dependency - dependencies = { 'hrsh7th/nvim-cmp' }, - config = function() - require('nvim-autopairs').setup {} - -- If you want to automatically add `(` after selecting a function or method - local cmp_autopairs = require 'nvim-autopairs.completion.cmp' - local cmp = require 'cmp' - cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) - end, -} diff --git a/nvim/lua/plugins/barbar.lua b/nvim/lua/plugins/barbar.lua deleted file mode 100644 index b49dd5e..0000000 --- a/nvim/lua/plugins/barbar.lua +++ /dev/null @@ -1,37 +0,0 @@ -vim.g.barbar_auto_setup = false - -return { - {'romgrk/barbar.nvim', - event = 'VimEnter', - dependencies = { - 'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status - 'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons - }, - init = function() vim.g.barbar_auto_setup = false end, - opts = { - -- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default: - -- animation = true, - insert_at_start = true, - sidebar_filetypes = { - -- Use the default values: {event = 'BufWinLeave', text = '', align = 'left'} - NvimTree = true, - -- Or, specify the text used for the offset: - undotree = { - text = 'undotree', - align = 'center', -- *optionally* specify an alignment (either 'left', 'center', or 'right') - }, - -- Or, specify the event which the sidebar executes when leaving: - ['neo-tree'] = {event = 'BufWipeout'}, - -- Or, specify all three - Outline = {event = 'BufWinLeave', text = 'symbols-outline', align = 'right'}, - }, - }, - keys = { - { 'L', 'BufferNext' }, - { 'H', 'BufferPrevious' }, - { 'Q', 'BufferClose' }, - { 'T', 'BufferRestore' } - }, - version = '^1.0.0', -- optional: only update when a new 1.x version is released - }, -} \ No newline at end of file diff --git a/nvim/lua/plugins/blinkcmp.lua b/nvim/lua/plugins/blinkcmp.lua deleted file mode 100644 index 9c4553f..0000000 --- a/nvim/lua/plugins/blinkcmp.lua +++ /dev/null @@ -1,45 +0,0 @@ -return { - 'saghen/blink.cmp', - lazy = false, -- lazy loading handled internally - -- optional: provides snippets for the snippet source - dependencies = 'rafamadriz/friendly-snippets', - -- use a release tag to download pre-built binaries - version = 'v0.*', - -- OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust - -- build = 'cargo build --release', - opts = { - keymap = { preset = 'super-tab' }, - - completion = { - menu = { - -- min_width = 30, - -- max_width = 50, - -- max_height = 20, - border = 'rounded', -- Rounded corners for a fancy look - winblend = 10, -- Slight transparency for a modern look - winhighlight = 'Normal:BlinkCmpMenu,FloatBorder:BlinkCmpMenuBorder,CursorLine:BlinkCmpMenuSelection,Search:None', - scrolloff = 2, - }, - - documentation = { - auto_show = true, - window = { - border = 'rounded', - winblend = 10, - winhighlight = 'Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,CursorLine:BlinkCmpDocCursorLine,Search:None', - }, - }, - ghost_text = { enabled = true }, - accept = { auto_brackets = { enabled = true } }, - -- signature = { - -- enabled = true, - -- } - }, - }, - -- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' - -- adjusts spacing to ensure icons are aligned - appearance = { - use_nvim_cmp_as_default = true, - nerd_font_variant = 'mono', - }, -} diff --git a/nvim/lua/plugins/cmd.lua b/nvim/lua/plugins/cmd.lua new file mode 100644 index 0000000..91c3208 --- /dev/null +++ b/nvim/lua/plugins/cmd.lua @@ -0,0 +1,3 @@ +return { + "gelguy/wilder.nvim" +} diff --git a/nvim/lua/plugins/colorful_indent.lua b/nvim/lua/plugins/colorful_indent.lua index 66796d0..a3d1652 100644 --- a/nvim/lua/plugins/colorful_indent.lua +++ b/nvim/lua/plugins/colorful_indent.lua @@ -1,19 +1,33 @@ --- return { --- "lukas-reineke/indent-blankline.nvim", --- main = "ibl", --- opts = function(_, opts) --- -- Other blankline configuration here --- return require("indent-rainbowline").make_opts(opts) --- end, --- dependencies = { --- "TheGLander/indent-rainbowline.nvim", --- }, --- } - return { "lukas-reineke/indent-blankline.nvim", main = "ibl", ---@module "ibl" ---@type ibl.config opts = {}, + config = function() + + local highlight = { + "RainbowRed", + "RainbowYellow", + "RainbowBlue", + "RainbowOrange", + "RainbowGreen", + "RainbowViolet", + "RainbowCyan", + } + local hooks = require "ibl.hooks" + -- create the highlight groups in the highlight setup hook, so they are reset + -- every time the colorscheme changes + hooks.register(hooks.type.HIGHLIGHT_SETUP, function() + vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" }) + vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" }) + vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" }) + vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" }) + vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" }) + vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" }) + vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" }) + end ) + + require("ibl").setup { indent = { highlight = highlight } } + end } diff --git a/nvim/lua/plugins/debug.lua b/nvim/lua/plugins/debug.lua deleted file mode 100644 index 06f6240..0000000 --- a/nvim/lua/plugins/debug.lua +++ /dev/null @@ -1,103 +0,0 @@ --- debug.lua --- --- Shows how to use the DAP plugin to debug your code. --- --- Primarily focused on configuring the debugger for Go, but can --- be extended to other languages as well. That's why it's called --- kickstart.nvim and not kitchen-sink.nvim ;) - -return { - 'mfussenegger/nvim-dap', - dependencies = { - -- Creates a beautiful debugger UI - 'rcarriga/nvim-dap-ui', - - -- Required dependency for nvim-dap-ui - 'nvim-neotest/nvim-nio', - - -- Installs the debug adapters for you - 'williamboman/mason.nvim', - 'jay-babu/mason-nvim-dap.nvim', - - -- Add your own debuggers here - 'leoluz/nvim-dap-go', - }, - keys = function(_, keys) - local dap = require 'dap' - local dapui = require 'dapui' - return { - -- Basic debugging keymaps, feel free to change to your liking! - { '', dap.continue, desc = 'Debug: Start/Continue' }, - { '', dap.step_into, desc = 'Debug: Step Into' }, - { '', dap.step_over, desc = 'Debug: Step Over' }, - { '', dap.step_out, desc = 'Debug: Step Out' }, - { 'b', dap.toggle_breakpoint, desc = 'Debug: Toggle Breakpoint' }, - { - 'B', - function() - dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') - end, - desc = 'Debug: Set Breakpoint', - }, - -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. - { '', dapui.toggle, desc = 'Debug: See last session result.' }, - unpack(keys), - } - end, - config = function() - local dap = require 'dap' - local dapui = require 'dapui' - - require('mason-nvim-dap').setup { - -- Makes a best effort to setup the various debuggers with - -- reasonable debug configurations - automatic_installation = true, - - -- You can provide additional configuration to the handlers, - -- see mason-nvim-dap README for more information - handlers = {}, - - -- You'll need to check that you have the required things installed - -- online, please don't ask me how to install them :) - ensure_installed = { - -- Update this to ensure that you have the debuggers for the langs you want - 'delve', - }, - } - - -- Dap UI setup - -- For more information, see |:help nvim-dap-ui| - dapui.setup { - -- Set icons to characters that are more likely to work in every terminal. - -- Feel free to remove or use ones that you like more! :) - -- Don't feel like these are good choices. - icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, - controls = { - icons = { - pause = '⏸', - play = '▶', - step_into = '⏎', - step_over = '⏭', - step_out = '⏮', - step_back = 'b', - run_last = '▶▶', - terminate = '⏹', - disconnect = '⏏', - }, - }, - } - - dap.listeners.after.event_initialized['dapui_config'] = dapui.open - dap.listeners.before.event_terminated['dapui_config'] = dapui.close - dap.listeners.before.event_exited['dapui_config'] = dapui.close - - -- Install golang specific config - require('dap-go').setup { - delve = { - -- On Windows delve must be run attached or it crashes. - -- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring - detached = vim.fn.has 'win32' == 0, - }, - } - end, -} diff --git a/nvim/lua/plugins/gitsigns.lua b/nvim/lua/plugins/gitsigns.lua index 4bcc70f..cbadd12 100644 --- a/nvim/lua/plugins/gitsigns.lua +++ b/nvim/lua/plugins/gitsigns.lua @@ -1,61 +1,12 @@ --- Adds git related signs to the gutter, as well as utilities for managing changes --- NOTE: gitsigns is already included in init.lua but contains only the base --- config. This will add also the recommended keymaps. - return { - { - 'lewis6991/gitsigns.nvim', - opts = { - on_attach = function(bufnr) - local gitsigns = require 'gitsigns' - - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end - - -- Navigation - map('n', ']c', function() - if vim.wo.diff then - vim.cmd.normal { ']c', bang = true } - else - gitsigns.nav_hunk 'next' - end - end, { desc = 'Jump to next git [c]hange' }) - - map('n', '[c', function() - if vim.wo.diff then - vim.cmd.normal { '[c', bang = true } - else - gitsigns.nav_hunk 'prev' - end - end, { desc = 'Jump to previous git [c]hange' }) - - -- Actions - -- visual mode - map('v', 'hs', function() - gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'stage git hunk' }) - map('v', 'hr', function() - gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'reset git hunk' }) - -- normal mode - map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) - map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) - map('n', 'hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) - map('n', 'hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' }) - map('n', 'hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) - map('n', 'hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) - map('n', 'hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) - map('n', 'hd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) - map('n', 'hD', function() - gitsigns.diffthis '@' - end, { desc = 'git [D]iff against last commit' }) - -- Toggles - map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) - map('n', 'tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' }) - end, + 'lewis6991/gitsigns.nvim', + opts = { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, }, }, } diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index d41526f..d5f5c31 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -1,108 +1,90 @@ -local servers = { - "rust_analyzer", - "clangd", - "basedpyright", - "lua_ls", - 'bashls', - 'yamlls', - 'gopls', - 'html', - 'cssls', -} - return { - "b0o/schemastore.nvim", - { - "williamboman/mason.nvim", - ensure_installed = servers - }, - -- { - -- "williamboman/mason-lspconfig.nvim", - -- config = function () - -- require('mason-lspconfig').setup({ - -- ensure_installed = servers - -- }) - -- - -- for _, lsp in pairs(servers) do - -- require('lspconfig')[lsp].setup { - -- on_attach = on_attach, - -- capabilities = capabilities - -- } - -- end - -- end, - -- - -- automatic_installation = true, - -- }, - { - "neovim/nvim-lspconfig", - dependencies = { - { 'williamboman/mason.nvim', config = true }, - 'williamboman/mason-lspconfig.nvim', - 'saghen/blink.cmp', + { + 'saghen/blink.cmp', + -- optional: provides snippets for the snippet source + dependencies = { 'rafamadriz/friendly-snippets' }, + + -- use a release tag to download pre-built binaries + version = '1.*', + -- 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 = { + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { preset = 'super-tab' }, + + appearance = { + nerd_font_variant = 'mono' + }, + + completion = { + menu = { + -- min_width = 30, + -- max_width = 50, + -- max_height = 20, + border = 'rounded', -- Rounded corners for a fancy look + winblend = 10, -- Slight transparency for a modern look + winhighlight = 'Normal:BlinkCmpMenu,FloatBorder:BlinkCmpMenuBorder,CursorLine:BlinkCmpMenuSelection,Search:None', + scrolloff = 2, }, - opts = { - servers = { - rust_analyzer = {}, - clangd = {}, - basedpyright = {}, - lua_ls = {}, - bashls = {}, - yamlls = {}, - gopls = { - cmd = {"gopls"}, - filetypes = {"go", "gomod", "gowork", "gotmpl"}, - }, - html = {}, - cssls = {}, - }, + + documentation = { + auto_show = true, + window = { + border = 'rounded', + winblend = 10, + winhighlight = 'Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,CursorLine:BlinkCmpDocCursorLine,Search:None', + }, }, - config = function (_, opts) - local lspconfig = require('lspconfig') - for server, config in pairs(opts.servers) do - -- passing config.capabilities to blink.cmp merges with the capabilities in your - -- `opts[server].capabilities, if you've defined it - config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities) - lspconfig[server].setup(config) - end - end, + ghost_text = { enabled = true }, + accept = { auto_brackets = { enabled = true } }, + -- signature = { + -- enabled = true, + -- } + }, + + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer' }, + }, + + fuzzy = { implementation = "prefer_rust_with_warning" } }, - { - 'nvimdev/lspsaga.nvim', - config = function() - require('lspsaga').setup({ - diagnostic = { - keys = { - quit = { 'q', '' } - } - }, - rename = { - keys = { - quit = {''} - } - }, - finder = { - keys = { - quit = '', - close = '', - toggle_or_open = '' - } - }, - outline = { - close_after_jump = true, - keys = { - quit = { 'q', '' }, - jump = { 'e', '' }, - toggle_or_jump = { 'o', '' } - } - }, - lightbulb = { - enable = false - } - }) - end, - dependencies = { - 'nvim-treesitter/nvim-treesitter', -- optional - 'nvim-tree/nvim-web-devicons', -- optional - } - } + opts_extend = { "sources.default" } + }, + { + 'neovim/nvim-lspconfig', + dependencies = { + { 'williamboman/mason.nvim', config = true }, + 'williamboman/mason-lspconfig.nvim', + }, + + opts = { + servers = { + lua_ls = {}, + clangd = {}, + rust_analyzer = {}, + yamlls = {}, + gopls = {}, + html = {} + } + }, + config = function(_, opts) + local lspconfig = require('lspconfig') + for server, config in pairs(opts.servers) do + -- passing config.capabilities to blink.cmp merges with the capabilities in your + -- `opts[server].capabilities, if you've defined it + config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities) + lspconfig[server].setup(config) + end + end + }, } diff --git a/nvim/lua/plugins/markview.lua b/nvim/lua/plugins/markview.lua new file mode 100644 index 0000000..751756d --- /dev/null +++ b/nvim/lua/plugins/markview.lua @@ -0,0 +1,23 @@ +return { + { -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + build = ':TSInstall markdown markdown_inline html latex typst yaml', + branch = 'master', + lazy = false, + }, + { + "OXY2DEV/markview.nvim", + lazy = false, + + -- For `nvim-treesitter` users. + priority = 49, + + -- For blink.cmp's completion + -- source + dependencies = { + "saghen/blink.cmp", + "echasnovski/mini.icons", + "nvim-tree/nvim-web-devicons" + } + } +}; diff --git a/nvim/lua/plugins/mini.lua b/nvim/lua/plugins/mini.lua new file mode 100644 index 0000000..8b6432c --- /dev/null +++ b/nvim/lua/plugins/mini.lua @@ -0,0 +1,34 @@ +return { -- Collection of various small independent plugins/modules + 'echasnovski/mini.nvim', + config = function() + -- Better Around/Inside textobjects + -- + -- Examples: + -- - va) - [V]isually select [A]round [)]paren + -- - yinq - [Y]ank [I]nside [N]ext [Q]uote + -- - ci' - [C]hange [I]nside [']quote + require('mini.ai').setup { n_lines = 500 } + + -- Add/delete/replace surroundings (brackets, quotes, etc.) + -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren + -- - sd' - [S]urround [D]elete [']quotes + -- - sr)' - [S]urround [R]eplace [)] ['] + require('mini.surround').setup() + + -- Simple and easy statusline. + -- You could remove this setup call if you don't like it, + -- and try some other statusline plugin + local statusline = require 'mini.statusline' + -- set use_icons to true if you have a Nerd Font + statusline.setup { use_icons = vim.g.have_nerd_font } + + -- You can configure sections in the statusline by overriding their + -- default behavior. For example, here we set the section for + -- cursor location to LINE:COLUMN + ---@diagnostic disable-next-line: duplicate-set-field + statusline.section_location = function() + return '%2l:%-2v' + end + -- https://github.com/echasnovski/mini.nvim + end, +} diff --git a/nvim/lua/plugins/neo-tree.lua b/nvim/lua/plugins/neo-tree.lua deleted file mode 100644 index 5454422..0000000 --- a/nvim/lua/plugins/neo-tree.lua +++ /dev/null @@ -1,45 +0,0 @@ --- Neo-tree is a Neovim plugin to browse the file system --- https://github.com/nvim-neo-tree/neo-tree.nvim - --- Disable netrw for neo-tree -vim.g.loaded_netrw = 1 -vim.g.loaded_netrwPlugin = 1 - -return { - 'nvim-neo-tree/neo-tree.nvim', - version = '*', - dependencies = { - 'nvim-lua/plenary.nvim', - 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended - 'MunifTanjim/nui.nvim', - }, - cmd = 'Neotree', - keys = { - { 'e', ':Neotree reveal action=focus toggle=true', silent=true } - }, - init = function() - if vim.fn.argc(-1) == 1 then - local stat = vim.loop.fs_stat(vim.fn.argv(0)) - if stat and stat.type == "directory" then - require("neo-tree") - end - end - end, - opts = { - filesystem = { - filtered_items = { - hide_dotfiles = false, - hide_gitignored = false, - hide_by_name = { - '.git', - } - }, - never_show = {}, - window = { - mappings = { - ['\\'] = 'close_window', - }, - }, - }, - }, -} diff --git a/nvim/lua/plugins/neotree.lua b/nvim/lua/plugins/neotree.lua new file mode 100644 index 0000000..6fd7265 --- /dev/null +++ b/nvim/lua/plugins/neotree.lua @@ -0,0 +1,42 @@ + +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +return { + 'nvim-neo-tree/neo-tree.nvim', + version = '*', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended + 'MunifTanjim/nui.nvim', + }, + cmd = 'Neotree', + keys = { + { 'e', ':Neotree reveal action=focus toggle=true', silent=true } + }, + init = function() + if vim.fn.argc(-1) == 1 then + local stat = vim.loop.fs_stat(vim.fn.argv(0)) + if stat and stat.type == "directory" then + require("neo-tree") + end + end + end, + opts = { + filesystem = { + filtered_items = { + hide_dotfiles = false, + hide_gitignored = false, + hide_by_name = { + '.git', + } + }, + never_show = {}, + window = { + mappings = { + ['\\'] = 'close_window', + }, + }, + }, + }, +} diff --git a/nvim/lua/plugins/notify.lua b/nvim/lua/plugins/notify.lua new file mode 100644 index 0000000..f718c28 --- /dev/null +++ b/nvim/lua/plugins/notify.lua @@ -0,0 +1,7 @@ +return { + 'rcarriga/nvim-notify', + config = function(_, opts) + vim.notify = require("notify") + vim.opt.termguicolors = true + end, +} diff --git a/nvim/lua/plugins/nvimcmp.lua b/nvim/lua/plugins/nvimcmp.lua deleted file mode 100644 index 2ff7133..0000000 --- a/nvim/lua/plugins/nvimcmp.lua +++ /dev/null @@ -1,114 +0,0 @@ -return { -- Autocompletion - 'hrsh7th/nvim-cmp', - enabled = false, - event = 'InsertEnter', - dependencies = { - -- Snippet Engine & its associated nvim-cmp source - { - 'L3MON4D3/LuaSnip', - build = (function() - -- Build Step is needed for regex support in snippets. - -- This step is not supported in many windows environments. - -- Remove the below condition to re-enable on windows. - if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then - return - end - return 'make install_jsregexp' - end)(), - dependencies = { - -- `friendly-snippets` contains a variety of premade snippets. - -- See the README about individual language/framework/plugin snippets: - -- https://github.com/rafamadriz/friendly-snippets - -- { - -- 'rafamadriz/friendly-snippets', - -- config = function() - -- require('luasnip.loaders.from_vscode').lazy_load() - -- end, - -- }, - }, - }, - 'saadparwaiz1/cmp_luasnip', - - -- Adds other completion capabilities. - -- nvim-cmp does not ship with all sources by default. They are split - -- into multiple repos for maintenance purposes. - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-path', - }, - - config = function() - -- See `:help cmp` - local cmp = require 'cmp' - local luasnip = require 'luasnip' - luasnip.config.setup {} - cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered({ - winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None", - }), - }, - }, - completion = { completeopt = 'menu,menuone,noinsert' }, - - -- For an understanding of why these mappings were - -- chosen, you will need to read `:help ins-completion` - -- - -- No, but seriously. Please read `:help ins-completion`, it is really good! - mapping = cmp.mapping.preset.insert { - -- Select the [n]ext item - [''] = cmp.mapping.select_next_item(), - -- Select the [p]revious item - [''] = cmp.mapping.select_prev_item(), - - -- Scroll the documentation window [b]ack / [f]orward - -- [''] = cmp.mapping.scroll_docs(-4), - -- [''] = cmp.mapping.scroll_docs(4), - - -- Accept ([y]es) the completion. - -- This will auto-import if your LSP supports it. - -- This will expand snippets if the LSP sent a snippet. - [''] = cmp.mapping.confirm { select = true }, - - [''] = cmp.mapping.confirm { select = true }, - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.select_prev_item(), - - -- Manually trigger a completion from nvim-cmp. - -- Generally you don't need this, because nvim-cmp will display - -- completions whenever it has completion options available. - [''] = cmp.mapping.complete {}, - - -- will move you to the right of each of the expansion locations. - -- is similar, except moving you backwards. - -- [''] = cmp.mapping(function() - -- if luasnip.expand_or_locally_jumpable() then - -- luasnip.expand_or_jump() - -- end - -- end, { 'i', 's' }), - -- [''] = cmp.mapping(function() - -- if luasnip.locally_jumpable(-1) then - -- luasnip.jump(-1) - -- end - -- end, { 'i', 's' }), - - -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: - -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps - }, - sources = { - { - name = 'lazydev', - -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it - group_index = 0, - }, - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'path' }, - }, - } - end, -} diff --git a/nvim/lua/plugins/tabline.lua b/nvim/lua/plugins/tabline.lua new file mode 100644 index 0000000..566aeb4 --- /dev/null +++ b/nvim/lua/plugins/tabline.lua @@ -0,0 +1,39 @@ +local map = vim.api.nvim_set_keymap +local opts = { noremap = true, silent = true } + +-- Move to previous/next +map('n', 'H', 'BufferPrevious', opts) +map('n', 'L', 'BufferNext', opts) +map('n', 'Q', 'BufferClose', opts) +map('n', 'T', 'BufferRestore', opts) + +return { + 'romgrk/barbar.nvim', + dependencies = { + 'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status + 'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons + }, + init = function() vim.g.barbar_auto_setup = false end, + opts = { + sidebar_filetypes = { + -- Use the default values: {event = 'BufWinLeave', text = '', align = 'left'} + NvimTree = true, + -- Or, specify the text used for the offset: + undotree = { + text = 'undotree', + align = 'center', -- *optionally* specify an alignment (either 'left', 'center', or 'right') + }, + -- Or, specify the event which the sidebar executes when leaving: + ['neo-tree'] = {event = 'BufWipeout'}, + -- Or, specify all three + Outline = {event = 'BufWinLeave', text = 'symbols-outline', align = 'right'}, + }, + keys = { + { 'L', 'BufferNext' }, + { 'H', 'BufferPrevious' }, + { 'Q', 'BufferClose' }, + { 'T', 'BufferRestore' } + } + }, + version = '^1.0.0' +} diff --git a/nvim/lua/plugins/telescope.lua b/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..7721304 --- /dev/null +++ b/nvim/lua/plugins/telescope.lua @@ -0,0 +1,96 @@ +return { -- Fuzzy Finder (files, lsp, etc) + 'nvim-telescope/telescope.nvim', + event = 'VimEnter', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim', + "debugloop/telescope-undo.nvim", + { + 'nvim-telescope/telescope-fzf-native.nvim', + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, + { 'nvim-telescope/telescope-ui-select.nvim' }, + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + }, + config = function(_, opts) + local actions = require('telescope.actions') + require('telescope').setup({ + defaults = { + mappings = { + i = { + -- [''] = 'to_fuzzy_refine' + [''] = actions.close + }, + }, + find_command = { 'rg', '--files', '--follow' }, -- or 'fd' with '--follow' if you use fd as the search tool + }, + -- pickers = {} + extensions = { + ['ui-select'] = { + require('telescope.themes').get_dropdown(), + }, + undo = { + side_by_side = true, + layout_strategy = "vertical", + layout_config = { + preview_height = 0.8, + }, + } + }, + }) + + -- Enable Telescope extensions if they are installed + pcall(require('telescope').load_extension, 'fzf') + pcall(require('telescope').load_extension, 'ui-select') + pcall(require('telescope').load_extension, 'undo') + + vim.keymap.set("n", "u", "Telescope undo") + + local builtin = require 'telescope.builtin' + vim.keymap.set('n', 'fh', builtin.help_tags, { desc = '[F]ind [H]elp' }) + vim.keymap.set('n', 'fk', builtin.keymaps, { desc = '[F]ind [K]eymaps' }) + vim.keymap.set('n', 'ff', builtin.find_files, { desc = '[F]ind [F]iles' }) + vim.keymap.set('n', 'fs', builtin.builtin, { desc = '[F]ind [S]elect Telescope' }) + vim.keymap.set('n', 'fw', builtin.grep_string, { desc = '[F]ind current [W]ord' }) + vim.keymap.set('n', 'fg', function() + builtin.live_grep { + additional_args = function() + return { "--follow" } + end, + } + end, { desc = '[F]ind by [G]rep' }) + vim.keymap.set('n', '', function() + builtin.live_grep { + additional_args = function() + return { "--follow" } + end, + } + end, { desc = '[F]ind by [G]rep' }) + vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' }) + vim.keymap.set('n', 'df', builtin.diagnostics, { desc = '[D]iagnostic [F]ind Via Telescope' }) + vim.keymap.set('n', 'fr', builtin.resume, { desc = '[F]ind [R]esume' }) + vim.keymap.set('n', 'f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) + + vim.keymap.set('n', '', function() + builtin.current_buffer_fuzzy_find({ + winblend = 10, + previewer = false, + }) + end, { desc = '' }) + + vim.keymap.set('n', 'fb', function() + builtin.live_grep { + grep_open_files = true, + prompt_title = 'Live Grep in Open Files', + } + end, { desc = '[F]ind in [B]uffers' }) + + -- Shortcut for searching your Neovim configuration files + vim.keymap.set('n', 'fn', function() + builtin.find_files { cwd = vim.fn.stdpath 'config' } + end, { desc = '[F]ind [N]eovim files' }) + end, +} diff --git a/nvim/lua/plugins/theme.lua b/nvim/lua/plugins/theme.lua new file mode 100644 index 0000000..40524e7 --- /dev/null +++ b/nvim/lua/plugins/theme.lua @@ -0,0 +1,9 @@ +return { + 'catppuccin/nvim', + priority = 1000, -- Make sure to load this before all the other start plugins. + init = function() + vim.cmd.colorscheme 'catppuccin-mocha' + + vim.cmd.hi 'Comment gui=none' + end, +} diff --git a/nvim/lua/plugins/whichkey.lua b/nvim/lua/plugins/whichkey.lua new file mode 100644 index 0000000..0762589 --- /dev/null +++ b/nvim/lua/plugins/whichkey.lua @@ -0,0 +1,53 @@ +return { -- Shows Keybinds + 'folke/which-key.nvim', + event = 'VimEnter', -- Sets the loading event to 'VimEnter' + lazy = false, + opts = { + icons = { + mappings = vim.g.have_nerd_font, + keys = vim.g.have_nerd_font and {} or { + Up = ' ', + Down = ' ', + Left = ' ', + Right = ' ', + C = ' ', + M = ' ', + D = ' ', + S = ' ', + CR = ' ', + Esc = ' ', + ScrollWheelDown = ' ', + ScrollWheelUp = ' ', + NL = ' ', + BS = ' ', + Space = ' ', + Tab = ' ', + F1 = '', + F2 = '', + F3 = '', + F4 = '', + F5 = '', + F6 = '', + F7 = '', + F8 = '', + F9 = '', + F10 = '', + F11 = '', + F12 = '', + }, + }, + + -- Document existing key chains + spec = { + { 'c', group = '[C]ode', mode = { 'n', 'x' } }, + { 'd', group = '[D]iagnostic' }, + { 'r', group = '[R]ename' }, + { 'f', group = '[F]ind' }, + { 'w', group = '[W]orkspace' }, + { 't', group = '[T]oggle' }, + { 'q', group = 'Open quick [Q]uit menu' }, + { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, + { 's', group = '[S]urround' } + }, + } +}