neovim-confs/lua/custom/plugins/ui.lua

226 lines
6.6 KiB
Lua
Raw Normal View History

2024-07-04 10:55:27 +02:00
return {
{
'nvim-tree/nvim-tree.lua',
--opts = overrides.nvimtree,
},
{
'ggandor/leap.nvim',
lazy = false,
config = function()
require('core.utils').load_mappings 'leap'
end,
},
{
'ggandor/flit.nvim',
lazy = false,
config = function()
require('flit').setup {
keys = { f = 'f', F = 'F', t = 't', T = 'T' },
-- A string like "nv", "nvo", "o", etc.
labeled_modes = 'v',
multiline = true,
-- Like `leap`s similar argument (call-specific overrides).
-- E.g.: opts = { equivalence_classes = {} }
opts = {},
}
end,
},
{
'kdheepak/lazygit.nvim',
lazy = false,
keys = { '<leader>gg' },
cmd = 'LazyGit',
-- optional for floating window border decoration
dependencies = {
'nvim-lua/plenary.nvim',
},
init = function()
require('core.utils').load_mappings 'lazygit'
end,
},
{
'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>d'] = { name = '+debug' },
['<leader>c'] = { name = '+code' },
['<leader>g'] = { name = '+git' },
['<leader>t'] = { name = '+toggle/tools' },
['<leader>w'] = { name = '+window/which' },
['<leader>f'] = { name = '+formatting' },
},
opts = {
triggers_nowait = {
-- marks
'`',
"'",
'g`',
"g'",
-- registers
'"',
'<c-r>',
-- spelling
'z=',
},
triggers_blacklist = {
-- list of mode / prefixes that should never be hooked by WhichKey
-- this is mostly relevant for keymaps that start with a native binding
i = { 'j', 'k' },
v = { 'j', 'k' },
n = { 'o', 'O' },
},
},
},
{
'echasnovski/mini.trailspace',
lazy = false,
event = { 'BufReadPost', 'BufNewFile' },
opts = {},
},
{
'itchyny/vim-cursorword',
event = 'FileType',
init = function()
vim.g.cursorword = 0
end,
config = function()
local augroup = vim.api.nvim_create_augroup('plex_cursorword', {})
vim.api.nvim_create_autocmd('FileType', {
group = augroup,
pattern = {
'conf',
'dosini',
'json',
'markdown',
'nginx',
'text',
'yaml',
},
callback = function()
if vim.wo.diff or vim.wo.previewwindow then
vim.b.cursorword = 0
else
vim.b.cursorword = 1
end
end,
})
vim.api.nvim_create_autocmd('InsertEnter', {
group = augroup,
callback = function()
if vim.b['cursorword'] == 1 then
vim.b['cursorword'] = 0
end
end,
})
vim.api.nvim_create_autocmd('InsertLeave', {
group = augroup,
callback = function()
if vim.b['cursorword'] == 0 then
vim.b['cursorword'] = 1
end
end,
})
end,
},
{
'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
},
TODO = { icon = '', color = 'todo' },
HACK = { icon = '', color = 'hack' },
SECURITY = { icon = '󰒃 ', color = 'security' },
WARN = { icon = '', color = 'warning', alt = { 'WARNING', 'XXX' } },
PERF = { icon = '', color = 'perf', alt = { 'OPTIM', 'PERFORMANCE', 'OPTIMIZE' } },
NOTE = { icon = '', color = 'hint', alt = { 'INFO' } },
TEST = { icon = '', color = 'test', alt = { 'TESTING', 'PASSED', 'FAILED' } },
},
colors = {
error = { 'DiagnosticError', 'ErrorMsg', '#DC2626' },
warning = { 'DiagnosticWarn', 'WarningMsg', '#FBBF24' },
todo = { 'DiagnosticTodo', '#80e64d' },
hint = { 'DiagnosticHint', '#10B981' },
hack = { 'DiagnosticHack', '#FF33FF' },
security = { 'DiagnosticSecurity', '#FF6600' },
default = { 'Identifier', '#7C3AED' },
test = { 'DiagnosticTest', '#E6E600' },
perf = { 'DiagnosticPerf', '#9999ff' },
},
},
},
}