Cleanup nvim config

This commit is contained in:
Alexander Navarro 2023-10-26 09:12:49 -03:00
parent 33cce48101
commit d9e2c81e42
16 changed files with 174 additions and 488 deletions

View file

@ -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.

View file

@ -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', '<leader>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' }
```

View file

@ -1,4 +1,4 @@
-- [[ Highlight on yank ]] -- Highlight on yank
-- See `:help vim.highlight.on_yank()` -- See `:help vim.highlight.on_yank()`
local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true }) local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true })
vim.api.nvim_create_autocmd("TextYankPost", { vim.api.nvim_create_autocmd("TextYankPost", {

View file

@ -11,6 +11,15 @@ local function default(desc)
} }
end 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 -- Keymaps for better default experience
-- See `:help vim.keymap.set()` -- See `:help vim.keymap.set()`
vim.keymap.set({ "n", "v" }, "<Space>", "<Nop>", { silent = true }) vim.keymap.set({ "n", "v" }, "<Space>", "<Nop>", { silent = true })
@ -29,24 +38,22 @@ vim.keymap.set("n", "N", "Nzzzv", default("Keep cursor centered while searching"
vim.keymap.set("n", "Q", "<nop>", {}) vim.keymap.set("n", "Q", "<nop>", {})
vim.keymap.set("n", "<leader>lj", function()
vim.diagnostic.goto_next()
end, default("Go to next diagnostic"))
vim.keymap.set("n", "<leader>lk", function()
vim.diagnostic.goto_prev()
end, default("Go to prev diagnostic"))
vim.keymap.set( vim.keymap.set(
"n", "n",
"<leader>r", "<leader>rw",
[[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]], [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]],
default("Search and replace current word") default("Search and replace current word")
) )
vim.keymap.set("n", "<leader>R", ":%s/", default("Search and replace in the whole file")) vim.keymap.set("n", "<leader>rR", ":s/", default("Search and replace inline"))
vim.keymap.set("n", "<leader>rr", ":%s/", default("Search and replace globally"))
vim.keymap.set("v", "<leader>r", ":s/", default("Search and replace in selection")) vim.keymap.set("v", "<leader>r", ":s/", default("Search and replace in selection"))
vim.keymap.set("v", "p", [["_dP]], default("Paste whitout lossing yanked text")) vim.keymap.set("v", "p", [["_dP]], default("Paste whitout lossing yanked text"))
vim.keymap.set({ "n", "v" }, "<Leader>y", [["+y]], default("Yank to system clipboard"))
vim.keymap.set({ "n", "v" }, "<Leader>Y", [["+Y]], default("Yank line to system clipboard"))
vim.keymap.set({ "n", "v" }, "<Leader>p", [["+p]], default("Paste from system clipboard"))
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv", default("Move selection down")) vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv", default("Move selection down"))
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv", default("Move selection up")) vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv", default("Move selection up"))
vim.keymap.set("n", "<Leader>uI", fixIdentation, default("Fix identation"))

View file

@ -2,96 +2,53 @@
-- See `:help vim.o` -- See `:help vim.o`
-- Set <space> as the leader key -- Set <space> as the leader key
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
vim.g.mapleader = " " vim.g.mapleader = " "
vim.g.maplocalleader = " " 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 local opt = vim.opt
opt.autowrite = true -- Enable auto write -- stylua: ignore
opt.clipboard = "unnamedplus" -- Sync with system clipboard opt.autowrite = true -- Enable auto write
--opt.clipboard = "unnamedplus" -- Sync with system clipboard
opt.completeopt = "menu,menuone,noselect" opt.completeopt = "menu,menuone,noselect"
opt.conceallevel = 3 -- Hide * markup for bold and italic opt.conceallevel = 3 -- Hide * markup for bold and italic
opt.confirm = true -- Confirm to save changes before exiting modified buffer opt.confirm = true -- Confirm to save changes before exiting modified buffer
opt.cursorline = true -- Enable highlighting of the current line opt.cursorline = true -- Enable highlighting of the current line
opt.expandtab = true -- Use spaces instead of tabs opt.expandtab = true -- Use spaces instead of tabs
opt.formatoptions = "jcroqlnt" -- tcqj opt.formatoptions = "jcroqlnt" -- tcqj
opt.grepformat = "%f:%l:%c:%m" opt.grepformat = "%f:%l:%c:%m"
opt.grepprg = "rg --vimgrep" opt.grepprg = "rg --vimgrep"
opt.ignorecase = true -- Ignore case opt.ignorecase = true -- Ignore case
opt.inccommand = "nosplit" -- preview incremental substitute opt.inccommand = "nosplit" -- preview incremental substitute
opt.laststatus = 0 opt.laststatus = 0
opt.list = true -- Show some invisible characters (tabs... opt.list = true -- Show some invisible characters (tabs...
opt.mouse = "a" -- Enable mouse mode opt.mouse = "a" -- Enable mouse mode
opt.number = true -- Print line number opt.number = true -- Print line number
opt.pumblend = 10 -- Popup blend opt.pumblend = 10 -- Popup blend
opt.pumheight = 10 -- Maximum number of entries in a popup opt.pumheight = 10 -- Maximum number of entries in a popup
opt.relativenumber = true -- Relative line numbers opt.relativenumber = true -- Relative line numbers
opt.scrolloff = 8 -- Lines of context opt.scrolloff = 8 -- Lines of context
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" } opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
opt.shiftround = true -- Round indent opt.shiftround = true -- Round indent
opt.shiftwidth = 2 -- Size of an indent opt.shiftwidth = 2 -- Size of an indent
opt.shortmess:append({ W = true, I = true, c = true }) opt.shortmess:append({ W = true, I = true, c = true })
opt.showmode = false -- Dont show mode since we have a statusline opt.showmode = false -- Dont show mode since we have a statusline
opt.sidescrolloff = 8 -- Columns of context opt.sidescrolloff = 8 -- Columns of context
opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time 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.smartcase = true -- Don't ignore case with capitals
opt.smartindent = true -- Insert indents automatically opt.smartindent = true -- Insert indents automatically
opt.spelllang = { "en" } opt.spelllang = { "en" }
opt.splitbelow = true -- Put new windows below current opt.splitbelow = true -- Put new windows below current
opt.splitright = true -- Put new windows right of current opt.splitright = true -- Put new windows right of current
opt.tabstop = 2 -- Number of spaces tabs count for opt.tabstop = 2 -- Number of spaces tabs count for
opt.termguicolors = true -- True color support opt.termguicolors = true -- True color support
opt.timeoutlen = 300 opt.timeoutlen = 300
opt.undofile = true opt.undofile = true
opt.undolevels = 10000 opt.undolevels = 10000
opt.updatetime = 200 -- Save swap file and trigger CursorHold opt.updatetime = 200 -- Save swap file and trigger CursorHold
opt.wildmode = "longest:full,full" -- Command-line completion mode opt.wildmode = "longest:full,full" -- Command-line completion mode
opt.winminwidth = 5 -- Minimum window width opt.winminwidth = 5 -- Minimum window width
opt.wrap = false -- Disable line wrap opt.wrap = false -- Disable line wrap
vim.filetype.add({ vim.filetype.add({
-- Detect and assign filetype based on the extension of the filename -- Detect and assign filetype based on the extension of the filename

View file

@ -9,12 +9,11 @@ return { -- Change colors.none if not using a transparent background
cmp = true, cmp = true,
indent_blankline = { indent_blankline = {
enabled = true, enabled = true,
scope_color = "lavender", -- catppuccin color (eg. `lavender`) Default: text
colored_indent_levels = true,
}, },
}, },
custom_highlights = function(colors) custom_highlights = function(colors)
return { return {
-- Fix colors for cmp
Pmenu = { bg = colors.none, blend = 0 }, Pmenu = { bg = colors.none, blend = 0 },
FloatBorder = { bg = colors.none }, FloatBorder = { bg = colors.none },
CmpItemMenu = { fg = colors.text, bg = colors.none }, CmpItemMenu = { fg = colors.text, bg = colors.none },

View file

@ -3,20 +3,21 @@ return {
"echasnovski/mini.comment", "echasnovski/mini.comment",
version = "*", version = "*",
event = "VeryLazy", event = "VeryLazy",
depends = {
{ "nvim-treesitter/nvim-treesitter-context" },
},
opts = { opts = {
options = { options = {
custom_commentstring = function() custom_commentstring = function()
return require("ts_context_commentstring.internal").calculate_commentstring() return require("ts_context_commentstring.internal").calculate_commentstring()
or vim.bo.commentstring or vim.bo.commentstring
end, end,
}, },
}, },
}, },
{ {
"LudoPinelli/comment-box.nvim", "LudoPinelli/comment-box.nvim",
-- init = nil,
event = "VeryLazy", event = "VeryLazy",
-- opts = {},
config = function() config = function()
require("comment-box").setup({ require("comment-box").setup({
outer_blank_lines = true, outer_blank_lines = true,
@ -25,9 +26,9 @@ return {
local cb = require("comment-box") local cb = require("comment-box")
-- left aligned fixed size box with left aligned text -- left aligned fixed size box with left aligned text
MAP({ "n", "v" }, "<Leader>cb", cb.lcbox, "Create a comment box") MAP({ "n", "v" }, "gcb", cb.lcbox, "Create a comment box")
-- centered adapted box with centered text -- centered adapted box with centered text
MAP({ "n", "v" }, "<Leader>cl", cb.cline, "Create a comment line") MAP({ "n", "v" }, "gcl", cb.cline, "Create a comment line")
end, end,
}, },
} }

View file

@ -15,6 +15,7 @@ return {
local window_opts = { local window_opts = {
border = "rounded", border = "rounded",
side_padding = 1, side_padding = 1,
-- fix colors for catppuccin colorscheme
winhighlight = "Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None", winhighlight = "Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None",
} }
return { return {
@ -35,6 +36,7 @@ return {
["<C-d>"] = cmp.mapping.scroll_docs(4), ["<C-d>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), ["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(), ["<C-e>"] = cmp.mapping.abort(),
["<BR>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. ["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<S-CR>"] = cmp.mapping.confirm({ ["<S-CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,

View file

@ -18,8 +18,8 @@ return {
dashboard.section.buttons.val = { dashboard.section.buttons.val = {
dashboard.button("LDR f f", " Find File ", "<leader>ff"), dashboard.button("LDR f f", " Find File ", "<leader>ff"),
dashboard.button("LDR e", "פּ File Explorer ", "<leader>fe"),
dashboard.button("LDR LDR t", " Harpoon", "<leader><leader>t"), dashboard.button("LDR LDR t", " Harpoon", "<leader><leader>t"),
dashboard.button("LDR g g", " Git ", "<leader>gg"),
} }
dashboard.section.footer.val = dashboard.section.footer.val =

View file

@ -1,9 +1,10 @@
return { return {
"stevearc/dressing.nvim", -- better imputs
opts = { "stevearc/dressing.nvim",
input = { opts = {
-- handle by noice input = {
enabled = false, -- handle by noice
}, enabled = false,
}, },
},
} }

View file

@ -1,6 +1,9 @@
return { return {
"stevearc/conform.nvim", "stevearc/conform.nvim",
event = "VeryLazy",
opts = { opts = {
-- See aviable formatters in: https://github.com/stevearc/conform.nvim#formatters
-- Formatters can be installed by mason
formatters_by_ft = { formatters_by_ft = {
-- Conform will run multiple formatters sequentially -- Conform will run multiple formatters sequentially
lua = { "stylua" }, lua = { "stylua" },
@ -14,9 +17,27 @@ return {
-- have other formatters configured. -- have other formatters configured.
["_"] = { "trim_whitespace" }, ["_"] = { "trim_whitespace" },
}, },
format_on_save = { format_on_save = function(bufnr)
timeout_ms = 500, -- Disable with a global or buffer-local variable
lsp_fallback = true, 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", "<leader>uf", toggleAutoFormat, "Toggle auto format")
end,
} }

View file

@ -1,23 +1,23 @@
return { return {
{ {
"lewis6991/gitsigns.nvim", "lewis6991/gitsigns.nvim",
event = { "BufReadPre", "BufNewFile" }, event = { "BufReadPre", "BufNewFile" },
opts = { opts = {
-- See `:help gitsigns.txt` -- See `:help gitsigns.txt`
signs = { signs = {
add = { text = "" }, add = { text = "" },
change = { text = "" }, change = { text = "" },
delete = { text = "" }, delete = { text = "" },
topdelete = { text = "" }, topdelete = { text = "" },
changedelete = { text = "" }, changedelete = { text = "" },
untracked = { text = "" }, untracked = { text = "" },
}, },
on_attach = function(buffer) on_attach = function(buffer)
local gs = package.loaded.gitsigns local gs = package.loaded.gitsigns
local function map(mode, l, r, desc) local function map(mode, l, r, desc)
vim.keymap.set(mode, "<leader>g" .. l, r, { buffer = buffer, desc = desc }) vim.keymap.set(mode, "<leader>g" .. l, r, { buffer = buffer, desc = desc })
end end
-- stylua: ignore start -- stylua: ignore start
map("n", "j", gs.next_hunk, "Next Hunk") 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", "u", gs.undo_stage_hunk, "Undo Stage Hunk")
map("n", "R", gs.reset_buffer, "Reset Buffer") map("n", "R", gs.reset_buffer, "Reset Buffer")
map("n", "p", gs.preview_hunk, "Preview Hunk") 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", gs.diffthis, "Diff This")
map("n", "D", function() gs.diffthis("~") end, "Diff This ~") map("n", "D", function() gs.diffthis("~") end, "Diff This ~")
end, end,
}, },
}, },
-- Testing main Git plugin -- Testing main Git plugin
{ {
"tpope/vim-fugitive", "tpope/vim-fugitive",
event = "VeryLazy", event = "VeryLazy",
keys = { keys = {
{ "<leader>gG", ":Git<CR>", { desc = "Fugitive" } }, { "<leader>gG", ":Git<CR>", desc = "Fugitive" },
}, },
}, },
{ {
"kdheepak/lazygit.nvim", "kdheepak/lazygit.nvim",
event = "VeryLazy", event = "VeryLazy",
dependencies = { dependencies = {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
}, },
keys = { keys = {
{ "<leader>gL", ":LazyGit<CR>", { desc = "Lazygit" } }, { "<leader>gL", ":LazyGit<CR>", desc = "Lazygit" },
}, },
}, },
{ {
"NeogitOrg/neogit", "NeogitOrg/neogit",
dependencies = { dependencies = {
"nvim-lua/plenary.nvim", -- required "nvim-lua/plenary.nvim", -- required
"nvim-telescope/telescope.nvim", -- optional "nvim-telescope/telescope.nvim", -- optional
"sindrets/diffview.nvim", -- optional "sindrets/diffview.nvim", -- optional
"ibhagwan/fzf-lua", -- optional "ibhagwan/fzf-lua", -- optional
}, },
config = true, config = true,
opts = { opts = {
disable_insert_on_commit = "auto", disable_insert_on_commit = "auto",
kind = "replace", kind = "replace",
disable_line_numbers = false, disable_line_numbers = false,
commit_editor = { commit_editor = {
kind = "replace", kind = "replace",
}, },
}, },
keys = { keys = {
{ {
"<leader>gg", "<leader>gg",
function() function()
require("neogit").open() require("neogit").open()
end, end,
{ desc = "Neogit" }, desc = "Neogit",
}, },
}, },
}, },
} }

View file

@ -46,17 +46,18 @@ return {
miniclue.gen_clues.windows(), miniclue.gen_clues.windows(),
miniclue.gen_clues.z(), miniclue.gen_clues.z(),
{ mode = "n", keys = "<Leader>b", desc = "+Buffers" },
{ mode = "n", keys = "<Leader>c", desc = "+Comments" },
{ mode = "n", keys = "<Leader>bh", postkeys = "<Leader>b" },
{ mode = "n", keys = "<Leader>bl", postkeys = "<Leader>b" },
{ mode = "n", keys = "<Leader>l", desc = "+LSP" },
{ mode = "n", keys = "<Leader>f", desc = "+Find" },
{ mode = "n", keys = "<Leader>g", desc = "+Git" },
{ mode = "n", keys = "<Leader>w", desc = "+Workspace" },
{ mode = "n", keys = "<Leader>u", desc = "+UI" },
{ mode = "n", keys = "<Leader>un", desc = "+Noice" },
{ mode = "n", keys = "<Leader><Leader>", desc = "+Harpoon" }, { mode = "n", keys = "<Leader><Leader>", desc = "+Harpoon" },
{ mode = "n", keys = "<Leader>b", desc = "+Buffers" },
{ mode = "n", keys = "<Leader>bh", postkeys = "<Leader>b" },
{ mode = "n", keys = "<Leader>bl", postkeys = "<Leader>b" },
{ mode = "n", keys = "<Leader>c", desc = "+Comments" },
{ mode = "n", keys = "<Leader>f", desc = "+Find" },
{ mode = "n", keys = "<Leader>g", desc = "+Git" },
{ mode = "n", keys = "<Leader>l", desc = "+LSP" },
{ mode = "n", keys = "<Leader>r", desc = "+Replace" },
{ mode = "n", keys = "<Leader>u", desc = "+UI & Config" },
{ mode = "n", keys = "<Leader>un", desc = "+Noice" },
{ mode = "n", keys = "<Leader>w", desc = "+Workspace" },
}, },
-- Clue window settings -- Clue window settings

View file

@ -7,7 +7,7 @@ return {
"williamboman/mason-lspconfig.nvim", "williamboman/mason-lspconfig.nvim",
-- Additional lua configuration, makes nvim stuff amazing! -- Additional lua configuration, makes nvim stuff amazing!
{ "folke/neodev.nvim", opts = {} }, { "folke/neodev.nvim", opts = {} },
}, },
config = function() config = function()
@ -43,6 +43,9 @@ return {
print(vim.inspect(vim.lsp.buf.list_workspace_folders())) print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, "Workspace List Folders") end, "Workspace List Folders")
nmap("<leader>lj", vim.diagnostic.goto_next, "Go to next diagnostic")
nmap("<leader>lk", vim.diagnostic.goto_prev, "Go to prev diagnostic")
-- Create a command `:Format` local to the LSP buffer -- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_) vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
vim.lsp.buf.format() vim.lsp.buf.format()

View file

@ -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,
}

View file

@ -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', '<F5>', dap.continue)
vim.keymap.set('n', '<F1>', dap.step_into)
vim.keymap.set('n', '<F2>', dap.step_over)
vim.keymap.set('n', '<F3>', dap.step_out)
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint)
vim.keymap.set('n', '<leader>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,
}