feat(plugins, keymaps): Add plugins, move plugins to nix, update keymaps

Added:
  - [aerial.nvim](https://github.com/stevearc/aerial.nvim)
  - [better-escape.nvim](https://github.com/max397574/better-escape.nvim)
  - [dressing.nvim](https://github.com/stevearc/dressing.nvim)
  - [ident-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim)
  - [nvim-notify](https://github.com/rcarriga/nvim-notify)
  - [todo-comments.nvim](https://github.com/folke/todo-comments.nvim)

Moved plugin source from Github to Nix:
  - [Comment.nvim](https://github.com/numToStr/Comment.nvim)
  - [neo-tree.nvim](https://github.com/numToStr/Comment.nvim)

Mapped windown switching to `<C-h`... instead of `<M-h`...
Moved some coliding lsp keymaps under the `<leader>l` group
  - Eg. `<leader>ls` for signature help
This commit is contained in:
Jiří Štefka 2024-09-23 17:38:17 +02:00
parent 1ac92922ee
commit 65dea4ed80
Signed by: jiriks74
GPG Key ID: 1D5E30D3DB2264DE
9 changed files with 70 additions and 52 deletions

34
flake.lock generated

@ -1,21 +1,5 @@
{
"nodes": {
"comment-nvim": {
"flake": false,
"locked": {
"lastModified": 1717957420,
"narHash": "sha256-h0kPue5Eqd5aeu4VoLH45pF0DmWWo1d8SnLICSQ63zc=",
"owner": "numToStr",
"repo": "Comment.nvim",
"rev": "e30b7f2008e52442154b66f7c519bfd2f1e32acb",
"type": "github"
},
"original": {
"owner": "numToStr",
"repo": "Comment.nvim",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
@ -151,22 +135,6 @@
"type": "github"
}
},
"neotree": {
"flake": false,
"locked": {
"lastModified": 1726542367,
"narHash": "sha256-Lqt0KJNT9HmpJwZoWChYeVBrDWhscRe8COqVCwgcTwk=",
"owner": "nvim-neo-tree",
"repo": "neo-tree.nvim",
"rev": "a77af2e764c5ed4038d27d1c463fa49cd4794e07",
"type": "github"
},
"original": {
"owner": "nvim-neo-tree",
"repo": "neo-tree.nvim",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1718714799,
@ -245,10 +213,8 @@
},
"root": {
"inputs": {
"comment-nvim": "comment-nvim",
"flake-utils": "flake-utils",
"gen-luarc": "gen-luarc",
"neotree": "neotree",
"nixpkgs": "nixpkgs_2",
"presence-nvim": "presence-nvim"
}

@ -12,14 +12,6 @@
url = "github:jiriks74/presence.nvim";
flake = false;
};
comment-nvim = {
url = "github:numToStr/Comment.nvim";
flake = false;
};
neotree = {
url = "github:nvim-neo-tree/neo-tree.nvim";
flake = false;
};
# wf-nvim = {
# url = "github:Cassin01/wf.nvim";
# flake = false;

@ -66,9 +66,12 @@ with final.pkgs.lib; let
# UI
lualine-nvim # Status line | https://github.com/nvim-lualine/lualine.nvim/
dressing-nvim # Improve the default vim.ui interfaces | https://github.com/stevearc/dressing.nvim
nvim-navic # Add LSP location to lualine | https://github.com/SmiteshP/nvim-navic
statuscol-nvim # Status column | https://github.com/luukvbaal/statuscol.nvim/
nvim-treesitter-context # nvim-treesitter-context
indent-blankline-nvim # Indent guides for Neovim | https://github.com/lukas-reineke/indent-blankline.nvim
nvim-notify # A fancy, configurable, notification manager for NeoVim | https://github.com/rcarriga/nvim-notify
# ^ UI
# language support
@ -80,12 +83,15 @@ with final.pkgs.lib; let
nvim-surround # https://github.com/kylechui/nvim-surround/
nvim-treesitter-textobjects # https://github.com/nvim-treesitter/nvim-treesitter-textobjects/
nvim-ts-context-commentstring # https://github.com/joosepalviste/nvim-ts-context-commentstring/
(mkNvimPlugin inputs.comment-nvim "Comment.nvim") # https://github.com/numToStr/Comment.nvim
(mkNvimPlugin inputs.neotree "neo-tree.nvim") # https://github.com/numToStr/Comment.nvim
comment-nvim # https://github.com/numToStr/Comment.nvim
neo-tree-nvim # https://github.com/numToStr/Comment.nvim
aerial-nvim # Plugin for a code outline window | https://github.com/stevearc/aerial.nvim
# ^ navigation/editing enhancement plugins
# Useful utilities
todo-comments-nvim # Highlight, list and search todo comments in your projects | https://github.com/folke/todo-comments.nvim
nvim-unception # Prevent nested neovim sessions | nvim-unception
better-escape-nvim # Map keys without delay when typing | https://github.com/max397574/better-escape.nvim
# ^ Useful utilities
# libraries that other plugins depend on

17
nvim/plugin/aerial.lua Normal file

@ -0,0 +1,17 @@
if vim.g.did_load_aerial_plugin then
return
end
vim.g.did_load_aerial_plugin = true
require("aerial").setup({
-- optionally use on_attach to set keymaps when aerial has attached to a buffer
on_attach = function(bufnr)
-- Jump forwards/backwards with '{' and '}'
vim.keymap.set("n", "{", "<cmd>AerialPrev<CR>", { buffer = bufnr })
vim.keymap.set("n", "}", "<cmd>AerialNext<CR>", { buffer = bufnr })
end,
})
-- You probably also want to set a keymap to toggle aerial
vim.keymap.set("n", "<leader>a", "<cmd>AerialToggle!<CR>")

@ -80,9 +80,9 @@ vim.api.nvim_create_autocmd('LspAttach', {
keymap.set('n', 'gd', vim.lsp.buf.definition, { desc = 'lsp [g]o to [d]efinition' })
keymap.set('n', 'K', vim.lsp.buf.hover, { desc = '[lsp] hover' })
keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = 'lsp [g]o to [i]mplementation' })
keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, { desc = '[lsp] signature help' })
keymap.set('n', '<leader>ls', vim.lsp.buf.signature_help, { desc = '[l]sp [s]ignature help' })
keymap.set('n', '<M-CR>', vim.lsp.buf.code_action, { desc = '[lsp] code action' })
keymap.set('n', '<M-l>', vim.lsp.codelens.run, { desc = '[lsp] run code lens' })
keymap.set('n', '<leader>ll', vim.lsp.codelens.run, { desc = '[l]sp run code [l]ens' })
keymap.set('n', 'gr', vim.lsp.buf.references, { desc = 'lsp [g]et [r]eferences' })
wk.add({

@ -0,0 +1,33 @@
if vim.g.did_load_ibl_plugin then
return
end
vim.g.did_load_ibl_plugin = true
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
}
}

@ -189,10 +189,12 @@ keymap.set('n', '<C-u>', '<C-u>zz', { desc = 'move [u]p half-page and center' })
keymap.set('n', '<C-f>', '<C-f>zz', { desc = 'move DOWN [f]ull-page and center' })
keymap.set('n', '<C-b>', '<C-b>zz', { desc = 'move UP full-page and center' })
keymap.set('n', '<M-h>', '<Cmd>wincmd h<CR>', { desc = 'focus left window' })
keymap.set('n', '<M-j>', '<Cmd>wincmd j<CR>', { desc = 'focus bottom window' })
keymap.set('n', '<M-k>', '<Cmd>wincmd k<CR>', { desc = 'focus top window' })
keymap.set('n', '<M-l>', '<Cmd>wincmd l<CR>', { desc = 'focus right window' })
keymap.set('n', '<C-h>', '<Cmd>wincmd h<CR>', { desc = 'focus left window' })
keymap.set('n', '<C-j>', '<Cmd>wincmd j<CR>', { desc = 'focus bottom window' })
keymap.set('n', '<C-k>', '<Cmd>wincmd k<CR>', { desc = 'focus top window' })
keymap.set('n', '<C-l>', '<Cmd>wincmd l<CR>', { desc = 'focus right window' })
keymap.set('n', '<leader>tt', '<Cmd>TodoTelescope<Cr>', { desc = '[t]elescope [t]odo comments'})
--- Disabled keymaps [enable at your own risk]

@ -12,3 +12,5 @@ require("dapui").setup()
require('nvim-surround').setup()
require('which-key').setup()
require('Comment').setup()
require("better_escape").setup()
require("todo-comments").setup()

@ -50,10 +50,10 @@ configs.setup {
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
['<leader>sa'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
['<leader>sA'] = '@parameter.inner',
},
},
move = {