From d9e2c81e42581eaf81c43caa4285d50019af2f39 Mon Sep 17 00:00:00 2001 From: aleidk Date: Thu, 26 Oct 2023 09:12:49 -0300 Subject: [PATCH] Cleanup nvim config --- config/nvim/LICENSE.md | 19 --- config/nvim/README.md | 130 ----------------- config/nvim/lua/aleidk/autocmds.lua | 2 +- config/nvim/lua/aleidk/keymaps.lua | 25 ++-- config/nvim/lua/aleidk/options.lua | 107 +++++--------- .../nvim/lua/aleidk/plugins/colorscheme.lua | 3 +- config/nvim/lua/aleidk/plugins/comments.lua | 11 +- config/nvim/lua/aleidk/plugins/completion.lua | 2 + config/nvim/lua/aleidk/plugins/dashboard.lua | 2 +- config/nvim/lua/aleidk/plugins/dressing.lua | 15 +- config/nvim/lua/aleidk/plugins/formatter.lua | 29 +++- config/nvim/lua/aleidk/plugins/git.lua | 134 +++++++++--------- config/nvim/lua/aleidk/plugins/key-help.lua | 21 +-- config/nvim/lua/aleidk/plugins/lsp.lua | 5 +- .../nvim/lua/kickstart/plugins/autoformat.lua | 74 ---------- config/nvim/lua/kickstart/plugins/debug.lua | 83 ----------- 16 files changed, 174 insertions(+), 488 deletions(-) delete mode 100644 config/nvim/LICENSE.md delete mode 100644 config/nvim/README.md delete mode 100644 config/nvim/lua/kickstart/plugins/autoformat.lua delete mode 100644 config/nvim/lua/kickstart/plugins/debug.lua diff --git a/config/nvim/LICENSE.md b/config/nvim/LICENSE.md deleted file mode 100644 index 9cf1062..0000000 --- a/config/nvim/LICENSE.md +++ /dev/null @@ -1,19 +0,0 @@ -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/config/nvim/README.md b/config/nvim/README.md deleted file mode 100644 index 21fcab3..0000000 --- a/config/nvim/README.md +++ /dev/null @@ -1,130 +0,0 @@ -# kickstart.nvim - -### Introduction - -A starting point for Neovim that is: - -* Small -* Single-file (with examples of moving to multi-file) -* Documented -* Modular - -This repo is meant to be used as by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss. - -Distribution Alternatives: -- [LazyVim](https://www.lazyvim.org/): A delightful distribution maintained by @folke (the author of lazy.nvim, the package manager used here) - -### Installation - -Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions. - -* Backup your previous configuration -* (Recommended) Fork this repo (so that you have your own copy that you can modify). -* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `~/AppData/Local/nvim/` (Windows) - * If you don't want to include it as a git repo, you can just clone it and then move the files to this location -* Start Neovim (`nvim`) and allow `lazy.nvim` to complete installation. -* Restart Neovim -* **You're ready to go!** - -Additional system requirements: -- Make sure to review the readmes of the plugins if you are experiencing errors. In particular: - - [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. -- See as well [Windows Installation](#Windows-Installation) - -### Configuration And Extension - -* Inside of your fork, feel free to modify any file you like! It's your fork! -* Then there are two primary configuration options available: - * Include the `lua/kickstart/plugins/*` files in your configuration. - * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` - * NOTE: To enable this, you need to uncomment `{ import = 'custom.plugins' }` in your `init.lua` - -You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration - -#### Example: Adding an autopairs plugin - -In the file: `lua/custom/plugins/autopairs.lua`, add: - -```lua --- File: lua/custom/plugins/autopairs.lua - -return { - "windwp/nvim-autopairs", - config = function() - require("nvim-autopairs").setup {} - end, -} -``` - - -This will automatically install `nvim-autopairs` and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim). - -#### Example: Adding a file tree plugin - -In the file: `lua/custom/plugins/filetree.lua`, add: - -```lua --- Unless you are still migrating, remove the deprecated commands from v1.x -vim.cmd([[ let g:neo_tree_remove_legacy_commands = 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", - }, - config = function () - require('neo-tree').setup {} - end, -} -``` - -This will install the tree plugin and add the command `:Neotree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information. - -#### Example: Adding a file to change default options - -To change default options, you can add a file in the `/after/plugin/` folder (see `:help load-plugins`) to include your own options, keymaps, autogroups, and more. The following is an example `defaults.lua` file (located at `$HOME/.config/nvim/after/plugin/defaults.lua`). - -```lua -vim.opt.relativenumber = true - -vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) -``` - -### Contribution - -Pull-requests are welcome. The goal of this repo is not to create a Neovim configuration framework, but to offer a starting template that shows, by example, available features in Neovim. Some things that will not be included: - -* Custom language server configuration (null-ls templates) -* Theming beyond a default colorscheme necessary for LSP highlight groups - -Each PR, especially those which increase the line count, should have a description as to why the PR is necessary. - -### FAQ - -* What should I do if I already have a pre-existing neovim configuration? - * You should back it up, then delete all files associated with it. - * This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/` - * You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide) -* What if I want to "uninstall" this configuration: - * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information -* Are there any cool videos about this plugin? - * Current iteration of kickstart (coming soon) - * Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). - -### Windows Installation - -Installation may require installing build tools, and updating the run command for `telescope-fzf-native` - -See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) - -This requires: - -- Install CMake, and the Microsoft C++ Build Tools on Windows - -```lua -{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } -``` - diff --git a/config/nvim/lua/aleidk/autocmds.lua b/config/nvim/lua/aleidk/autocmds.lua index 8ac6951..22c9fbd 100644 --- a/config/nvim/lua/aleidk/autocmds.lua +++ b/config/nvim/lua/aleidk/autocmds.lua @@ -1,4 +1,4 @@ --- [[ Highlight on yank ]] +-- Highlight on yank -- See `:help vim.highlight.on_yank()` local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true }) vim.api.nvim_create_autocmd("TextYankPost", { diff --git a/config/nvim/lua/aleidk/keymaps.lua b/config/nvim/lua/aleidk/keymaps.lua index 6f6e0f0..0164888 100644 --- a/config/nvim/lua/aleidk/keymaps.lua +++ b/config/nvim/lua/aleidk/keymaps.lua @@ -11,6 +11,15 @@ local function default(desc) } end +local function fixIdentation() + local indent = 2 + vim.opt.tabstop = indent + vim.opt.shiftwidth = indent + vim.opt.softtabstop = indent + + vim.cmd("retab") +end + -- Keymaps for better default experience -- See `:help vim.keymap.set()` vim.keymap.set({ "n", "v" }, "", "", { silent = true }) @@ -29,24 +38,22 @@ vim.keymap.set("n", "N", "Nzzzv", default("Keep cursor centered while searching" vim.keymap.set("n", "Q", "", {}) -vim.keymap.set("n", "lj", function() - vim.diagnostic.goto_next() -end, default("Go to next diagnostic")) -vim.keymap.set("n", "lk", function() - vim.diagnostic.goto_prev() -end, default("Go to prev diagnostic")) - vim.keymap.set( "n", - "r", + "rw", [[:%s/\<\>//gI]], default("Search and replace current word") ) -vim.keymap.set("n", "R", ":%s/", default("Search and replace in the whole file")) +vim.keymap.set("n", "rR", ":s/", default("Search and replace inline")) +vim.keymap.set("n", "rr", ":%s/", default("Search and replace globally")) vim.keymap.set("v", "r", ":s/", default("Search and replace in selection")) vim.keymap.set("v", "p", [["_dP]], default("Paste whitout lossing yanked text")) +vim.keymap.set({ "n", "v" }, "y", [["+y]], default("Yank to system clipboard")) +vim.keymap.set({ "n", "v" }, "Y", [["+Y]], default("Yank line to system clipboard")) +vim.keymap.set({ "n", "v" }, "p", [["+p]], default("Paste from system clipboard")) vim.keymap.set("v", "J", ":m '>+1gv=gv", default("Move selection down")) vim.keymap.set("v", "K", ":m '<-2gv=gv", default("Move selection up")) +vim.keymap.set("n", "uI", fixIdentation, default("Fix identation")) diff --git a/config/nvim/lua/aleidk/options.lua b/config/nvim/lua/aleidk/options.lua index c7d641a..44214d2 100644 --- a/config/nvim/lua/aleidk/options.lua +++ b/config/nvim/lua/aleidk/options.lua @@ -2,96 +2,53 @@ -- See `:help vim.o` -- Set as the leader key --- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) vim.g.mapleader = " " vim.g.maplocalleader = " " --- --- -- Set highlight on search --- vim.o.hlsearch = false --- --- -- Make line numbers default --- vim.wo.number = true --- vim.opt.relativenumber = true --- --- -- Enable mouse mode --- vim.o.mouse = "a" --- --- -- Sync clipboard between OS and Neovim. --- -- Remove this option if you want your OS clipboard to remain independent. --- -- See `:help 'clipboard'` --- vim.o.clipboard = "unnamedplus" --- --- -- Enable break indent --- vim.o.breakindent = true --- --- -- Save undo history --- vim.o.undofile = true --- --- -- Case insensitive searching UNLESS /C or capital in search --- vim.o.ignorecase = true --- vim.o.smartcase = true --- --- -- Keep signcolumn on by default --- vim.wo.signcolumn = "yes" --- --- -- Decrease update time --- vim.o.updatetime = 250 --- vim.o.timeout = true --- vim.o.timeoutlen = 300 --- --- -- Set completeopt to have a better completion experience --- vim.o.completeopt = "menuone,noselect" --- --- -- NOTE: You should make sure your terminal supports this --- vim.o.termguicolors = true --- --- vim.o.showmode = false --- vim.o.conceallevel = 3 --- LazyVim options local opt = vim.opt -opt.autowrite = true -- Enable auto write -opt.clipboard = "unnamedplus" -- Sync with system clipboard +-- stylua: ignore +opt.autowrite = true -- Enable auto write +--opt.clipboard = "unnamedplus" -- Sync with system clipboard opt.completeopt = "menu,menuone,noselect" -opt.conceallevel = 3 -- Hide * markup for bold and italic -opt.confirm = true -- Confirm to save changes before exiting modified buffer -opt.cursorline = true -- Enable highlighting of the current line -opt.expandtab = true -- Use spaces instead of tabs -opt.formatoptions = "jcroqlnt" -- tcqj +opt.conceallevel = 3 -- Hide * markup for bold and italic +opt.confirm = true -- Confirm to save changes before exiting modified buffer +opt.cursorline = true -- Enable highlighting of the current line +opt.expandtab = true -- Use spaces instead of tabs +opt.formatoptions = "jcroqlnt" -- tcqj opt.grepformat = "%f:%l:%c:%m" opt.grepprg = "rg --vimgrep" -opt.ignorecase = true -- Ignore case -opt.inccommand = "nosplit" -- preview incremental substitute +opt.ignorecase = true -- Ignore case +opt.inccommand = "nosplit" -- preview incremental substitute opt.laststatus = 0 -opt.list = true -- Show some invisible characters (tabs... -opt.mouse = "a" -- Enable mouse mode -opt.number = true -- Print line number -opt.pumblend = 10 -- Popup blend -opt.pumheight = 10 -- Maximum number of entries in a popup -opt.relativenumber = true -- Relative line numbers -opt.scrolloff = 8 -- Lines of context +opt.list = true -- Show some invisible characters (tabs... +opt.mouse = "a" -- Enable mouse mode +opt.number = true -- Print line number +opt.pumblend = 10 -- Popup blend +opt.pumheight = 10 -- Maximum number of entries in a popup +opt.relativenumber = true -- Relative line numbers +opt.scrolloff = 8 -- Lines of context opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" } -opt.shiftround = true -- Round indent -opt.shiftwidth = 2 -- Size of an indent +opt.shiftround = true -- Round indent +opt.shiftwidth = 2 -- Size of an indent opt.shortmess:append({ W = true, I = true, c = true }) -opt.showmode = false -- Dont show mode since we have a statusline -opt.sidescrolloff = 8 -- Columns of context -opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time -opt.smartcase = true -- Don't ignore case with capitals -opt.smartindent = true -- Insert indents automatically +opt.showmode = false -- Dont show mode since we have a statusline +opt.sidescrolloff = 8 -- Columns of context +opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time +opt.smartcase = true -- Don't ignore case with capitals +opt.smartindent = true -- Insert indents automatically opt.spelllang = { "en" } -opt.splitbelow = true -- Put new windows below current -opt.splitright = true -- Put new windows right of current -opt.tabstop = 2 -- Number of spaces tabs count for -opt.termguicolors = true -- True color support +opt.splitbelow = true -- Put new windows below current +opt.splitright = true -- Put new windows right of current +opt.tabstop = 2 -- Number of spaces tabs count for +opt.termguicolors = true -- True color support opt.timeoutlen = 300 opt.undofile = true opt.undolevels = 10000 -opt.updatetime = 200 -- Save swap file and trigger CursorHold -opt.wildmode = "longest:full,full" -- Command-line completion mode -opt.winminwidth = 5 -- Minimum window width -opt.wrap = false -- Disable line wrap +opt.updatetime = 200 -- Save swap file and trigger CursorHold +opt.wildmode = "longest:full,full" -- Command-line completion mode +opt.winminwidth = 5 -- Minimum window width +opt.wrap = false -- Disable line wrap vim.filetype.add({ -- Detect and assign filetype based on the extension of the filename diff --git a/config/nvim/lua/aleidk/plugins/colorscheme.lua b/config/nvim/lua/aleidk/plugins/colorscheme.lua index b992c18..1543804 100644 --- a/config/nvim/lua/aleidk/plugins/colorscheme.lua +++ b/config/nvim/lua/aleidk/plugins/colorscheme.lua @@ -9,12 +9,11 @@ return { -- Change colors.none if not using a transparent background cmp = true, indent_blankline = { enabled = true, - scope_color = "lavender", -- catppuccin color (eg. `lavender`) Default: text - colored_indent_levels = true, }, }, custom_highlights = function(colors) return { + -- Fix colors for cmp Pmenu = { bg = colors.none, blend = 0 }, FloatBorder = { bg = colors.none }, CmpItemMenu = { fg = colors.text, bg = colors.none }, diff --git a/config/nvim/lua/aleidk/plugins/comments.lua b/config/nvim/lua/aleidk/plugins/comments.lua index c995a80..f5ab339 100644 --- a/config/nvim/lua/aleidk/plugins/comments.lua +++ b/config/nvim/lua/aleidk/plugins/comments.lua @@ -3,20 +3,21 @@ return { "echasnovski/mini.comment", version = "*", event = "VeryLazy", + depends = { + { "nvim-treesitter/nvim-treesitter-context" }, + }, opts = { options = { custom_commentstring = function() return require("ts_context_commentstring.internal").calculate_commentstring() - or vim.bo.commentstring + or vim.bo.commentstring end, }, }, }, { "LudoPinelli/comment-box.nvim", - -- init = nil, event = "VeryLazy", - -- opts = {}, config = function() require("comment-box").setup({ outer_blank_lines = true, @@ -25,9 +26,9 @@ return { local cb = require("comment-box") -- left aligned fixed size box with left aligned text - MAP({ "n", "v" }, "cb", cb.lcbox, "Create a comment box") + MAP({ "n", "v" }, "gcb", cb.lcbox, "Create a comment box") -- centered adapted box with centered text - MAP({ "n", "v" }, "cl", cb.cline, "Create a comment line") + MAP({ "n", "v" }, "gcl", cb.cline, "Create a comment line") end, }, } diff --git a/config/nvim/lua/aleidk/plugins/completion.lua b/config/nvim/lua/aleidk/plugins/completion.lua index 0f5652c..658294f 100644 --- a/config/nvim/lua/aleidk/plugins/completion.lua +++ b/config/nvim/lua/aleidk/plugins/completion.lua @@ -15,6 +15,7 @@ return { local window_opts = { border = "rounded", side_padding = 1, + -- fix colors for catppuccin colorscheme winhighlight = "Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None", } return { @@ -35,6 +36,7 @@ return { [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete(), [""] = cmp.mapping.abort(), + ["
"] = cmp.mapping.abort(), [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. [""] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, diff --git a/config/nvim/lua/aleidk/plugins/dashboard.lua b/config/nvim/lua/aleidk/plugins/dashboard.lua index 08acced..94b5051 100644 --- a/config/nvim/lua/aleidk/plugins/dashboard.lua +++ b/config/nvim/lua/aleidk/plugins/dashboard.lua @@ -18,8 +18,8 @@ return { dashboard.section.buttons.val = { dashboard.button("LDR f f", " Find File ", "ff"), - dashboard.button("LDR e", "פּ File Explorer ", "fe"), dashboard.button("LDR LDR t", " Harpoon", "t"), + dashboard.button("LDR g g", " Git ", "gg"), } dashboard.section.footer.val = diff --git a/config/nvim/lua/aleidk/plugins/dressing.lua b/config/nvim/lua/aleidk/plugins/dressing.lua index 2073312..9d2a5e4 100644 --- a/config/nvim/lua/aleidk/plugins/dressing.lua +++ b/config/nvim/lua/aleidk/plugins/dressing.lua @@ -1,9 +1,10 @@ return { - "stevearc/dressing.nvim", - opts = { - input = { - -- handle by noice - enabled = false, - }, - }, + -- better imputs + "stevearc/dressing.nvim", + opts = { + input = { + -- handle by noice + enabled = false, + }, + }, } diff --git a/config/nvim/lua/aleidk/plugins/formatter.lua b/config/nvim/lua/aleidk/plugins/formatter.lua index e6a6b9c..adde68f 100644 --- a/config/nvim/lua/aleidk/plugins/formatter.lua +++ b/config/nvim/lua/aleidk/plugins/formatter.lua @@ -1,6 +1,9 @@ return { "stevearc/conform.nvim", + event = "VeryLazy", opts = { + -- See aviable formatters in: https://github.com/stevearc/conform.nvim#formatters + -- Formatters can be installed by mason formatters_by_ft = { -- Conform will run multiple formatters sequentially lua = { "stylua" }, @@ -14,9 +17,27 @@ return { -- have other formatters configured. ["_"] = { "trim_whitespace" }, }, - format_on_save = { - timeout_ms = 500, - lsp_fallback = true, - }, + format_on_save = function(bufnr) + -- Disable with a global or buffer-local variable + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + return { timeout_ms = 500, lsp_fallback = true } + end, }, + config = function(_, opts) + require("conform").setup(opts) + + local function toggleAutoFormat() + -- to make this global, change b to g + if vim.b.disable_autoformat == nil then + vim.b.disable_autoformat = true + return + end + + vim.b.disable_autoformat = not vim.b.disable_autoformat + end + + MAP("n", "uf", toggleAutoFormat, "Toggle auto format") + end, } diff --git a/config/nvim/lua/aleidk/plugins/git.lua b/config/nvim/lua/aleidk/plugins/git.lua index 6fb31e6..370e4d9 100644 --- a/config/nvim/lua/aleidk/plugins/git.lua +++ b/config/nvim/lua/aleidk/plugins/git.lua @@ -1,23 +1,23 @@ return { - { - "lewis6991/gitsigns.nvim", - event = { "BufReadPre", "BufNewFile" }, - opts = { - -- See `:help gitsigns.txt` - signs = { - add = { text = "▎" }, - change = { text = "▎" }, - delete = { text = "" }, - topdelete = { text = "" }, - changedelete = { text = "▎" }, - untracked = { text = "▎" }, - }, - on_attach = function(buffer) - local gs = package.loaded.gitsigns + { + "lewis6991/gitsigns.nvim", + event = { "BufReadPre", "BufNewFile" }, + opts = { + -- See `:help gitsigns.txt` + signs = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "" }, + topdelete = { text = "" }, + changedelete = { text = "▎" }, + untracked = { text = "▎" }, + }, + on_attach = function(buffer) + local gs = package.loaded.gitsigns - local function map(mode, l, r, desc) - vim.keymap.set(mode, "g" .. l, r, { buffer = buffer, desc = desc }) - end + local function map(mode, l, r, desc) + vim.keymap.set(mode, "g" .. l, r, { buffer = buffer, desc = desc }) + end -- stylua: ignore start map("n", "j", gs.next_hunk, "Next Hunk") @@ -27,59 +27,59 @@ return { map("n", "u", gs.undo_stage_hunk, "Undo Stage Hunk") map("n", "R", gs.reset_buffer, "Reset Buffer") map("n", "p", gs.preview_hunk, "Preview Hunk") - map("n", "l", function() gs.blame_line({ full = true }) end, "Blame Line") + map("n", "l", function() gs.blame_line() end, "Blame Line") map("n", "d", gs.diffthis, "Diff This") map("n", "D", function() gs.diffthis("~") end, "Diff This ~") - end, - }, - }, + end, + }, + }, - -- Testing main Git plugin + -- Testing main Git plugin - { - "tpope/vim-fugitive", - event = "VeryLazy", - keys = { - { "gG", ":Git", { desc = "Fugitive" } }, - }, - }, + { + "tpope/vim-fugitive", + event = "VeryLazy", + keys = { + { "gG", ":Git", desc = "Fugitive" }, + }, + }, - { - "kdheepak/lazygit.nvim", - event = "VeryLazy", - dependencies = { - "nvim-lua/plenary.nvim", - }, - keys = { - { "gL", ":LazyGit", { desc = "Lazygit" } }, - }, - }, + { + "kdheepak/lazygit.nvim", + event = "VeryLazy", + dependencies = { + "nvim-lua/plenary.nvim", + }, + keys = { + { "gL", ":LazyGit", desc = "Lazygit" }, + }, + }, - { - "NeogitOrg/neogit", - dependencies = { - "nvim-lua/plenary.nvim", -- required - "nvim-telescope/telescope.nvim", -- optional - "sindrets/diffview.nvim", -- optional - "ibhagwan/fzf-lua", -- optional - }, - config = true, - opts = { - disable_insert_on_commit = "auto", - kind = "replace", - disable_line_numbers = false, - commit_editor = { - kind = "replace", - }, - }, - keys = { - { - "gg", - function() - require("neogit").open() - end, - { desc = "Neogit" }, - }, - }, - }, + { + "NeogitOrg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", -- required + "nvim-telescope/telescope.nvim", -- optional + "sindrets/diffview.nvim", -- optional + "ibhagwan/fzf-lua", -- optional + }, + config = true, + opts = { + disable_insert_on_commit = "auto", + kind = "replace", + disable_line_numbers = false, + commit_editor = { + kind = "replace", + }, + }, + keys = { + { + "gg", + function() + require("neogit").open() + end, + desc = "Neogit", + }, + }, + }, } diff --git a/config/nvim/lua/aleidk/plugins/key-help.lua b/config/nvim/lua/aleidk/plugins/key-help.lua index 4680090..dcf749b 100644 --- a/config/nvim/lua/aleidk/plugins/key-help.lua +++ b/config/nvim/lua/aleidk/plugins/key-help.lua @@ -46,17 +46,18 @@ return { miniclue.gen_clues.windows(), miniclue.gen_clues.z(), - { mode = "n", keys = "b", desc = "+Buffers" }, - { mode = "n", keys = "c", desc = "+Comments" }, - { mode = "n", keys = "bh", postkeys = "b" }, - { mode = "n", keys = "bl", postkeys = "b" }, - { mode = "n", keys = "l", desc = "+LSP" }, - { mode = "n", keys = "f", desc = "+Find" }, - { mode = "n", keys = "g", desc = "+Git" }, - { mode = "n", keys = "w", desc = "+Workspace" }, - { mode = "n", keys = "u", desc = "+UI" }, - { mode = "n", keys = "un", desc = "+Noice" }, { mode = "n", keys = "", desc = "+Harpoon" }, + { mode = "n", keys = "b", desc = "+Buffers" }, + { mode = "n", keys = "bh", postkeys = "b" }, + { mode = "n", keys = "bl", postkeys = "b" }, + { mode = "n", keys = "c", desc = "+Comments" }, + { mode = "n", keys = "f", desc = "+Find" }, + { mode = "n", keys = "g", desc = "+Git" }, + { mode = "n", keys = "l", desc = "+LSP" }, + { mode = "n", keys = "r", desc = "+Replace" }, + { mode = "n", keys = "u", desc = "+UI & Config" }, + { mode = "n", keys = "un", desc = "+Noice" }, + { mode = "n", keys = "w", desc = "+Workspace" }, }, -- Clue window settings diff --git a/config/nvim/lua/aleidk/plugins/lsp.lua b/config/nvim/lua/aleidk/plugins/lsp.lua index c7e5b19..e9b0585 100644 --- a/config/nvim/lua/aleidk/plugins/lsp.lua +++ b/config/nvim/lua/aleidk/plugins/lsp.lua @@ -7,7 +7,7 @@ return { "williamboman/mason-lspconfig.nvim", -- Additional lua configuration, makes nvim stuff amazing! - { "folke/neodev.nvim", opts = {} }, + { "folke/neodev.nvim", opts = {} }, }, config = function() @@ -43,6 +43,9 @@ return { print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, "Workspace List Folders") + nmap("lj", vim.diagnostic.goto_next, "Go to next diagnostic") + nmap("lk", vim.diagnostic.goto_prev, "Go to prev diagnostic") + -- Create a command `:Format` local to the LSP buffer vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_) vim.lsp.buf.format() diff --git a/config/nvim/lua/kickstart/plugins/autoformat.lua b/config/nvim/lua/kickstart/plugins/autoformat.lua deleted file mode 100644 index bc56b15..0000000 --- a/config/nvim/lua/kickstart/plugins/autoformat.lua +++ /dev/null @@ -1,74 +0,0 @@ --- autoformat.lua --- --- Use your language server to automatically format your code on save. --- Adds additional commands as well to manage the behavior - -return { - 'neovim/nvim-lspconfig', - config = function() - -- Switch for controlling whether you want autoformatting. - -- Use :KickstartFormatToggle to toggle autoformatting on or off - local format_is_enabled = true - vim.api.nvim_create_user_command('KickstartFormatToggle', function() - format_is_enabled = not format_is_enabled - print('Setting autoformatting to: ' .. tostring(format_is_enabled)) - end, {}) - - -- Create an augroup that is used for managing our formatting autocmds. - -- We need one augroup per client to make sure that multiple clients - -- can attach to the same buffer without interfering with each other. - local _augroups = {} - local get_augroup = function(client) - if not _augroups[client.id] then - local group_name = 'kickstart-lsp-format-' .. client.name - local id = vim.api.nvim_create_augroup(group_name, { clear = true }) - _augroups[client.id] = id - end - - return _augroups[client.id] - end - - -- Whenever an LSP attaches to a buffer, we will run this function. - -- - -- See `:help LspAttach` for more information about this autocmd event. - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }), - -- This is where we attach the autoformatting for reasonable clients - callback = function(args) - local client_id = args.data.client_id - local client = vim.lsp.get_client_by_id(client_id) - local bufnr = args.buf - - -- Only attach to clients that support document formatting - if not client.server_capabilities.documentFormattingProvider then - return - end - - -- Tsserver usually works poorly. Sorry you work with bad languages - -- You can remove this line if you know what you're doing :) - if client.name == 'tsserver' then - return - end - - -- Create an autocmd that will run *before* we save the buffer. - -- Run the formatting command for the LSP that has just attached. - vim.api.nvim_create_autocmd('BufWritePre', { - group = get_augroup(client), - buffer = bufnr, - callback = function() - if not format_is_enabled then - return - end - - vim.lsp.buf.format { - async = false, - filter = function(c) - return c.id == client.id - end, - } - end, - }) - end, - }) - end, -} diff --git a/config/nvim/lua/kickstart/plugins/debug.lua b/config/nvim/lua/kickstart/plugins/debug.lua deleted file mode 100644 index 000bcb8..0000000 --- a/config/nvim/lua/kickstart/plugins/debug.lua +++ /dev/null @@ -1,83 +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 { - -- NOTE: Yes, you can install new plugins here! - 'mfussenegger/nvim-dap', - -- NOTE: And you can specify dependencies as well - dependencies = { - -- Creates a beautiful debugger UI - 'rcarriga/nvim-dap-ui', - - -- Installs the debug adapters for you - 'williamboman/mason.nvim', - 'jay-babu/mason-nvim-dap.nvim', - - -- Add your own debuggers here - 'leoluz/nvim-dap-go', - }, - 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_setup = 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', - }, - } - - -- Basic debugging keymaps, feel free to change to your liking! - vim.keymap.set('n', '', dap.continue) - vim.keymap.set('n', '', dap.step_into) - vim.keymap.set('n', '', dap.step_over) - vim.keymap.set('n', '', dap.step_out) - vim.keymap.set('n', 'b', dap.toggle_breakpoint) - vim.keymap.set('n', 'B', function() - dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') - end) - - -- 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 = '⏹', - }, - }, - } - - 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() - end, -}