moar plugins

This commit is contained in:
Christoph J. Scherr 2024-01-20 03:03:39 +01:00
parent 84509df6a0
commit 9281537c59
Signed by: PlexSheep
GPG Key ID: 7CDD0B14851A08EF
5 changed files with 316 additions and 161 deletions

View File

@ -10,7 +10,7 @@ opt.spelllang = "en,de"
opt.clipboard = "" -- don't just use the system clipboard
opt.wrap = false
opt.breakindent = false
opt.spell = true
opt.spell = false
opt.list = true
opt.conceallevel = 2
opt.undofile = true
@ -54,7 +54,7 @@ opt.startofline = false -- Cursor in same column for f
opt.splitbelow = true -- Splits open bottom right
opt.splitright = true
opt.breakindentopt = { shift = 2, min = 20 }
opt.formatoptions = "cqanlmBjp" -- see :h fo-table & :h formatoptions
opt.formatoptions = "qnlmBjp" -- see :h fo-table & :h formatoptions
-- Diff
-- ===
@ -133,3 +133,12 @@ vim.api.nvim_create_autocmd('VimResized', {
end,
})
-- Wrap and enable spell-checker in text filetypes
vim.api.nvim_create_autocmd('FileType', {
group = augroup('spell_conceal'),
pattern = { 'gitcommit', 'markdown', 'tex', 'latex', 'norg' },
callback = function()
vim.opt_local.spell = true
vim.opt_local.conceallevel = 0
end,
})

View File

@ -1,41 +1,44 @@
---@type MappingsTable
local M = {}
-- NOTE: The mappings here are case sensitive!!! Removing a specific default
-- mapping requires the same case here!
M.disabled = {
n = {
["<C-a>"] = "",
["<C-s>"] = "",
["<C-c>"] = "",
["<LEADER>n"] = "",
["<LEADER>rn"] = "",
["<UP>"] = "",
["<DOWN>"] = "",
["<LEADER>x"] = "",
["<LEADER>/"] = "",
["<LEADER>ra"] = "",
["<leader>n"] = "",
["<leader>rn"] = "",
["<Up>"] = "",
["<Down>"] = "",
["<leader>x"] = "",
["<leader>/"] = "",
["<leader>ra"] = "",
["[d"] = "",
["]d"] = "",
["[c"] = "",
["]c"] = "",
["<LEADER>h"] = "",
["<LEADER>ff"] = "",
["<LEADER>fm"] = "",
["<LEADER>fa"] = "",
["<LEADER>fw"] = "",
["<LEADER>fb"] = "",
["<LEADER>fh"] = "",
["<LEADER>fo"] = "",
["<LEADER>fz"] = "",
["<LEADER>cm"] = "",
["<LEADER>gt"] = "",
["<LEADER>pt"] = "",
["<LEADER>th"] = "",
["<LEADER>ma"] = "",
["<LEADER>v"] = "",
["<LEADER>rh"] = "",
["<LEADER>ph"] = "",
["<LEADER>gb"] = "",
["<LEADER>td"] = "",
["<leader>h"] = "",
["<leader>ff"] = "",
["<leader>fm"] = "",
["<leader>fa"] = "",
["<leader>fw"] = "",
["<leader>fb"] = "",
["<leader>fh"] = "",
["<leader>fo"] = "",
["<leader>fz"] = "",
["<leader>cm"] = "",
["<leader>gt"] = "",
["<leader>pt"] = "",
["<leader>th"] = "",
["<leader>ma"] = "",
["<leader>v"] = "",
["<leader>rh"] = "",
["<leader>ph"] = "",
["<leader>gb"] = "",
["<leader>td"] = "",
["<leader>wk"] = "",
["#"] = "",
["?"] = "",
},
@ -45,7 +48,7 @@ M.disabled = {
v = {
["#"] = "",
["?"] = "",
["<LEADER>/"] = "",
["<leader>/"] = "",
},
}
@ -54,7 +57,7 @@ M.tabufline = {
n = {
-- cycle through buffers
["<TAB>"] = {
["<Tab>"] = {
function()
require("nvchad.tabufline").tabuflineNext()
end,
@ -83,7 +86,7 @@ M.comment = {
-- toggle comment in both modes
n = {
["<LEADER>v"] = {
["<leader>v"] = {
function()
require("Comment.api").toggle.linewise.current()
end,
@ -92,8 +95,8 @@ M.comment = {
},
v = {
["<LEADER>v"] = {
"<ESC><CMD>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
["<leader>v"] = {
"<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>",
"Toggle comment",
},
},
@ -102,44 +105,44 @@ M.comment = {
M.leap = {
plugin = true,
n = {
["<LEADER>s"] = {
"<PLUG>(leap-forward)",
["<leader>s"] = {
"<plug>(leap-forward)",
"leap forward",
},
["<LEADER>S"] = {
"<PLUG>(leap-backward)",
["<leader>S"] = {
"<plug>(leap-backward)",
"leap backward",
},
["<LEADER>gs"] = {
"<PLUG>(leap-from-window)",
["<leader>gs"] = {
"<plug>(leap-from-window)",
"leap from window",
},
},
x = {
["<LEADER>s"] = {
"<PLUG>(leap-forward)",
["<leader>s"] = {
"<plug>(leap-forward)",
"leap forward",
},
["<LEADER>S"] = {
"<PLUG>(leap-backward)",
["<leader>S"] = {
"<plug>(leap-backward)",
"leap forward",
},
["<LEADER>gs"] = {
"<PLUG>(leap-from-window)",
["<leader>gs"] = {
"<plug>(leap-from-window)",
"leap from window",
},
},
o = {
["<LEADER>s"] = {
"<PLUG>(leap-forward)",
["<leader>s"] = {
"<plug>(leap-forward)",
"leap forward",
},
["<LEADER>S"] = {
"<PLUG>(leap-backward)",
["<leader>S"] = {
"<plug>(leap-backward)",
"leap forward",
},
["<LEADER>gs"] = {
"<PLUG>(leap-from-window)",
["<leader>gs"] = {
"<plug>(leap-from-window)",
"leap from window",
},
},
@ -148,21 +151,21 @@ M.leap = {
M.lazygit = {
plugin = true,
n = {
["<LEADER>gg"] = { "<CMD> LazyGit <CR>", "Open LazyGit" },
["<leader>gg"] = { "<cmd> LazyGit <cr>", "Open LazyGit" },
},
}
M.lspconfig = {
plugin = true,
n = {
["<LEADER>ck"] = {
["[d"] = {
function()
vim.diagnostic.goto_prev { float = { border = "rounded" } }
end,
"Goto prev",
},
["<LEADER>cj"] = {
["]d"] = {
function()
vim.diagnostic.goto_next { float = { border = "rounded" } }
end,
@ -174,14 +177,14 @@ M.lspconfig = {
M.clipboard = {
plugin = false,
n = {
["<LEADER>y"] = { '"+y', "yank to system" },
["<LEADER>Y"] = { '"+Y', "yank to system" },
["<LEADER>yy"] = { '"+y', "yank to system" },
["<leader>y"] = { '"+y', "yank to system" },
["<leader>Y"] = { '"+Y', "yank to system" },
["<leader>yy"] = { '"+y', "yank to system" },
},
v = {
["<LEADER>y"] = { '"+y', "yank to system" },
["<LEADER>Y"] = { '"+Y', "yank to system" },
["<LEADER>yy"] = { '"+y', "yank to system" },
["<leader>y"] = { '"+y', "yank to system" },
["<leader>Y"] = { '"+Y', "yank to system" },
["<leader>yy"] = { '"+y', "yank to system" },
},
}
@ -189,25 +192,25 @@ M.telescope = {
plugin = true,
n = {
-- find
["<LOCALLEADER>ff"] = { "<CMD> Telescope find_files <CR>", "Find files" },
["<LOCALLEADER>fa"] = { "<CMD> Telescope find_files follow=true no_ignore=true hidden=true <CR>", "Find all" },
["<LOCALLEADER>fw"] = { "<CMD> Telescope live_grep <CR>", "Live grep" },
["<LOCALLEADER>fb"] = { "<CMD> Telescope buffers <CR>", "Find buffers" },
["<LOCALLEADER>fh"] = { "<CMD> Telescope help_tags <CR>", "Help page" },
["<LOCALLEADER>fo"] = { "<CMD> Telescope oldfiles <CR>", "Find oldfiles" },
["<LOCALLEADER>fz"] = { "<CMD> Telescope current_buffer_fuzzy_find <CR>", "Find in current buffer" },
["<localleader>ff"] = { "<cmd> Telescope find_files <cr>", "Find files" },
["<localleader>fa"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <cr>", "Find all" },
["<localleader>fw"] = { "<cmd> Telescope live_grep <cr>", "Live grep" },
["<localleader>fb"] = { "<cmd> Telescope buffers <cr>", "Find buffers" },
["<localleader>fh"] = { "<cmd> Telescope help_tags <cr>", "Help page" },
["<localleader>fo"] = { "<cmd> Telescope oldfiles <cr>", "Find oldfiles" },
["<localleader>fz"] = { "<cmd> Telescope current_buffer_fuzzy_find <cr>", "Find in current buffer" },
-- git
["<LOCALLEADER>cm"] = { "<CMD> Telescope git_commits <CR>", "Git commits" },
["<LOCALLEADER>gt"] = { "<CMD> Telescope git_status <CR>", "Git status" },
["<localleader>cm"] = { "<cmd> Telescope git_commits <cr>", "Git commits" },
["<localleader>gt"] = { "<cmd> Telescope git_status <cr>", "Git status" },
-- pick a hidden term
["<LOCALLEADER>pt"] = { "<CMD> Telescope terms <CR>", "Pick hidden term" },
["<localleader>pt"] = { "<cmd> Telescope terms <cr>", "Pick hidden term" },
-- theme switcher
["<LOCALLEADER>th"] = { "<CMD> Telescope themes <CR>", "Nvchad themes" },
["<localleader>th"] = { "<cmd> Telescope themes <cr>", "Nvchad themes" },
["<LOCALLEADER>ma"] = { "<CMD> Telescope marks <CR>", "telescope bookmarks" },
["<localleader>ma"] = { "<cmd> Telescope marks <cr>", "telescope bookmarks" },
},
}
@ -239,11 +242,11 @@ M.nvimtree = {
plugin = true,
n = {
-- toggle
["<C-n>"] = { "<CMD> NvimTreeToggle <CR>", "Toggle nvimtree" },
["<F5>"] = { "<CMD> NvimTreeToggle <CR>", "Toggle nvimtree" },
["<C-n>"] = { "<cmd> NvimTreeToggle <cr>", "Toggle nvimtree" },
["<F5>"] = { "<cmd> NvimTreeToggle <cr>", "Toggle nvimtree" },
-- focus
["<LOCALLEADER>e"] = { "<CMD> NvimTreeFocus <CR>", "Focus nvimtree" },
["<localleader>e"] = { "<cmd> NvimTreeFocus <cr>", "Focus nvimtree" },
},
}
@ -255,14 +258,14 @@ M.movements = {
["<A-j>"] = { "<C-d>", "big step down" },
-- go to beginning and end
["<C-b>"] = { "<HOME>", "Beginning of line" },
["<C-e>"] = { "<END>", "End of line" },
["<C-b>"] = { "<home>", "Beginning of line" },
["<C-e>"] = { "<end>", "End of line" },
-- navigate within insert mode
["<C-h>"] = { "<LEFT>", "Move left" },
["<C-l>"] = { "<RIGHT>", "Move right" },
["<C-j>"] = { "<DOWN>", "Move down" },
["<C-k>"] = { "<UP>", "Move up" },
["<C-h>"] = { "<left>", "Move left" },
["<C-l>"] = { "<right>", "Move right" },
["<C-j>"] = { "<down>", "Move down" },
["<C-k>"] = { "<up>", "Move up" },
},
n = {
--big move
@ -270,15 +273,15 @@ M.movements = {
["<A-j>"] = { "<C-d>", "big step down" },
-- go to beginning and end
["H"] = { "<HOME>", "Beginning of line" },
["L"] = { "<END>", "End of line" },
["H"] = { "<home>", "Beginning of line" },
["L"] = { "<end>", "End of line" },
-- go to mark with "#"
["#"] = { "'", "go to mark" },
-- spell
["zn"] = { "]s", "go to next spelling mark"},
["zN"] = { "[s", "go to last spelling mark"},
["]s"] = { "]s", "go to next spelling mark"},
["[s"] = { "[s", "go to last spelling mark"},
},
v = {
--big move
@ -286,8 +289,8 @@ M.movements = {
["<A-j>"] = { "<C-d>", "big step down" },
-- go to beginning and end
["H"] = { "<HOME>", "Beginning of line" },
["L"] = { "<END>", "End of line" },
["H"] = { "<home>", "Beginning of line" },
["L"] = { "<end>", "End of line" },
},
t = {
["<C-w>"] = {
@ -301,24 +304,24 @@ M.edit = {
plugin = false,
n = {
-- easy newline
["OO"] = { "O<ESC>", "insert a line above", opts = { nowait = false } },
["oo"] = { "o<ESC>", "insert a line below", opts = { nowait = false } },
["OO"] = { "O<esc>", "insert a line above", opts = { nowait = false } },
["oo"] = { "o<esc>", "insert a line below", opts = { nowait = false } },
-- split and join lines
-- "J" for join is defaul
["S"] = {
"i<CR><ESC>l",
"i<cr><esc>l",
"split line",
},
-- do something useful with the arrows
["<UP>"] = { "<CMD> move-2<CR>", "Move line up", opts = { expr = true } },
["<DOWN>"] = { "<CMD> move+<CR>", "Move line down", opts = { expr = true } },
["<LEFT>"] = { "<CMD> << <CR>", "Less indentation", opts = { expr = true } },
["<RIGHT>"] = { "<CMD> >> <CR>", "More indentation", opts = { expr = true } },
["<Up>"] = { "<cmd> move-2<cr>", "Move line up", opts = { expr = true } },
["<Down>"] = { "<cmd> move+<cr>", "Move line down", opts = { expr = true } },
["<Left>"] = { "<cmd> << <cr>", "Less indentation", opts = { expr = true } },
["<Right>"] = { "<cmd> >> <cr>", "More indentation", opts = { expr = true } },
-- format with conform
["<LEADER>ff"] = {
["<leader>ff"] = {
function()
require("conform").format()
end,
@ -326,7 +329,7 @@ M.edit = {
},
--
-- remove trailing whitespace
["<LEADER>fw"] = {
["<leader>fw"] = {
function()
require("mini.trailspace").trim()
end,
@ -334,12 +337,12 @@ M.edit = {
},
},
v = {
["<LEFT>"] = { "<gv", "Less indentation" },
["<RIGHT>"] = { ">gv", "More indentation" },
["<Left>"] = { "<gv", "Less indentation" },
["<Right>"] = { ">gv", "More indentation" },
},
x = {
["<UP>"] = { "move'<-2<CR>gv=gv", "Move line up", opts = { expr = true } },
["<DOWN>"] = { "move'<-2<CR>gv=gv", "Move line down", opts = { expr = true } },
["<Up>"] = { "move'<-2<cr>gv=gv", "Move line up", opts = { expr = true } },
["<Down>"] = { "move'<-2<cr>gv=gv", "Move line down", opts = { expr = true } },
},
t = {
--big move
@ -352,7 +355,7 @@ M.ui = {
plugin = false,
n = {
-- toggle wrap
["<LEADER>tw"] = {
["<leader>tw"] = {
function()
vim.opt_local.wrap = not vim.wo.wrap
vim.opt_local.breakindent = not vim.wo.breakindent
@ -367,28 +370,28 @@ M.ui = {
},
-- toggle some features
["<LEADER>tn"] = { "<CMD>setlocal nonumber!<CR>", "toggle line numbers" },
["<LEADER>trn"] = { "<CMD>setlocal nornu!<CR>", "toggle relative line numbers" },
["<LEADER>ts"] = { "<CMD>setlocal spell!<CR>", "toggle spell check" },
["<leader>tn"] = { "<cmd>setlocal nonumber!<cr>", "toggle line numbers" },
["<leader>trn"] = { "<cmd>setlocal nornu!<cr>", "toggle relative line numbers" },
["<leader>ts"] = { "<cmd>setlocal spell!<cr>", "toggle spell check" },
-- open windows
['<LEADER>"'] = { "<CMD>vsplit<CR>", "open a new window to the side" },
["<LEADER>%"] = { "<CMD>split<CR>", "open a new window on the totop" },
['<leader>"'] = { "<cmd>vsplit<cr>", "open a new window to the side" },
["<leader>%"] = { "<cmd>split<cr>", "open a new window on the totop" },
-- resize windows
["<C-Up>"] = { "<CMD>resize +1<CR>", "resize window" },
["<C-Down>"] = { "<CMD>resize -1<CR>", "resize window" },
["<C-Left>"] = { "<CMD>vertical resize +1<CR>", "resize window" },
["<C-Right>"] = { "<CMD>vertical resize -1<CR>", "resize window" },
["<C-Up>"] = { "<cmd>resize +1<cr>", "resize window" },
["<C-Down>"] = { "<cmd>resize -1<cr>", "resize window" },
["<C-Left>"] = { "<cmd>vertical resize +1<cr>", "resize window" },
["<C-Right>"] = { "<cmd>vertical resize -1<cr>", "resize window" },
-- tabs
["<LEADER>wtn"] = { "<CMD>tabnew<CR>", "open a new tab" },
["<LEADER>wtc"] = { "<CMD>tabclose<CR>", "close current tab" },
["<LEADER>wtj"] = { "<CMD>tabnext<CR>", "open a new tab" },
["<LEADER>wtk"] = { "<CMD>tabprevious<CR>", "open a new tab" },
["<leader>wn"] = { "<cmd>tabnew<cr>", "open a new tab" },
["<leader>wc"] = { "<cmd>tabclose<cr>", "close current tab" },
["<leader>wk"] = { "<cmd>tabnext<cr>", "go to next tab" },
["<leader>wj"] = { "<cmd>tabprevious<cr>", "go to prev tab" },
-- folds
["<S-RETURN>"] = { "zMzv", "focus on this fold" },
["<S-Return>"] = { "zMzv", "focus on this fold" },
},
}

View File

@ -84,8 +84,150 @@ local plugins = {
{
"folke/which-key.nvim",
keys = { "<leader>", "<localleader>", "<c-r>", "<c-w>", '"', "'", "`", "c", "v", "g" },
defaults = {
mode = { "n", "v" },
[";"] = { name = "+telescope" },
[";f"] = { name = "+find" },
[";d"] = { name = "+lsp/todo" },
["g"] = { name = "+goto" },
["]"] = { name = "+next" },
["["] = { name = "+prev" },
["<leader>x"] = { name = "+diagnostics/quickfix" },
["<leader>c"] = { name = "+code" },
["<leader>g"] = { name = "+git" },
["<leader>t"] = { name = "+toggle/tools" },
["<leader>w"] = { name = "+window/which" },
["<leader>f"] = { name = "+formatting" },
},
},
{ "echasnovski/mini.trailspace", lazy = false, event = { "BufReadPost", "BufNewFile" }, opts = {} },
{
"RRethy/vim-illuminate",
lazy = false,
event = { "BufReadPost", "BufNewFile" },
opts = {
delay = 200,
under_cursor = false,
modes_allowlist = { "n", "no", "nt" },
filetypes_denylist = {
"DiffviewFileHistory",
"DiffviewFiles",
"SidebarNvim",
"fugitive",
"git",
"minifiles",
"neo-tree",
},
},
keys = {
{ "]]", desc = "Next Reference" },
{ "[[", desc = "Prev Reference" },
},
config = function(_, opts)
require("illuminate").configure(opts)
local function map(key, dir, buffer)
vim.keymap.set("n", key, function()
require("illuminate")["goto_" .. dir .. "_reference"](false)
end, {
desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference",
buffer = buffer,
})
end
map("]]", "next")
map("[[", "prev")
-- also set it after loading ftplugins, since a lot overwrite [[ and ]]
vim.api.nvim_create_autocmd("FileType", {
group = vim.api.nvim_create_augroup("plex_illuminate", {}),
callback = function()
local buffer = vim.api.nvim_get_current_buf()
map("]]", "next", buffer)
map("[[", "prev", buffer)
end,
})
end,
},
{
"folke/todo-comments.nvim",
lazy = false,
dependencies = "nvim-telescope/telescope.nvim",
-- stylua: ignore
keys = {
{ ']t', function() require('todo-comments').jump_next() end, desc = 'Next todo comment' },
{ '[t', function() require('todo-comments').jump_prev() end, desc = 'Previous todo comment' },
{ '<LocalLeader>dt', '<cmd>TodoTelescope<CR>', desc = 'todo' },
{ '<leader>xt', '<cmd>TodoTrouble<CR>', desc = 'Todo (Trouble)' },
{ '<leader>xT', '<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>', desc = 'Todo/Fix/Fixme (Trouble)' },
},
opts = {
signs = true,
keywords = {
FIX = {
icon = "", -- icon used for the sign, and in search results
color = "error", -- can be a hex color, or a named color (see below)
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
-- signs = false, -- configure signs for some keywords individually
},
TODO = { icon = "", color = "info" },
HACK = { icon = "", color = "warning" },
SECURITY = { icon = "󰒃 ", color = "warning" },
WARN = { icon = "", color = "warning", alt = { "WARNING", "XXX" } },
PERF = { icon = "", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
NOTE = { icon = "", color = "hint", alt = { "INFO" } },
TEST = { icon = "", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
},
},
},
{
"folke/trouble.nvim",
cmd = { "Trouble", "TroubleToggle" },
opts = { use_diagnostic_signs = true },
-- stylua: ignore
keys = {
{
'<leader>e',
'<cmd>TroubleToggle document_diagnostics<CR>',
noremap = true,
desc =
'Document Diagnostics'
},
{
'<leader>r',
'<cmd>TroubleToggle workspace_diagnostics<CR>',
noremap = true,
desc =
'Workspace Diagnostics'
},
{ '<leader>xx', '<cmd>TroubleToggle document_diagnostics<cr>', desc = 'Document Diagnostics (Trouble)' },
{ '<leader>xX', '<cmd>TroubleToggle workspace_diagnostics<cr>', desc = 'Workspace Diagnostics (Trouble)' },
{ '<leader>xQ', '<cmd>TroubleToggle quickfix<cr>', desc = 'Quickfix List (Trouble)' },
{ '<leader>xL', '<cmd>TroubleToggle loclist<cr>', desc = 'Location List (Trouble)' },
{
'[q',
function()
if require('trouble').is_open() then
require('trouble').previous({ skip_groups = true, jump = true })
else
vim.cmd.cprev()
end
end,
desc = 'Previous trouble/quickfix item',
},
{
']q',
function()
if require('trouble').is_open() then
require('trouble').next({ skip_groups = true, jump = true })
else
vim.cmd.cnext()
end
end,
desc = 'Next trouble/quickfix item',
},
},
},
}
return plugins

View File

@ -235,3 +235,4 @@ IDEs
hypervisors
QEMU
virt
filetypes

Binary file not shown.