Compare commits

...

4 commits

8 changed files with 329 additions and 67 deletions

View file

@ -55,6 +55,41 @@ with final.pkgs.lib; let
flash-nvim
which-key-nvim
gitsigns-nvim
# Treesitter
nvim-treesitter-textobjects
nvim-ts-autotag
(nvim-treesitter.withPlugins (
plugins:
with plugins; [
bash
diff
html
gitignore
javascript
jsdoc
json
jsonc
just
lua
luadoc
markdown
markdown_inline
nix
just
printf
python
query
regex
toml
tsx
typescript
vim
vimdoc
xml
yaml
]
))
];
extraPackages = with pkgs; [

View file

@ -1,13 +1,22 @@
---@type {[string]:"azure" | "blue" | "cyan" | "green" | "grey" | "orange" | "purple" | "red" | "yellow"}
return {
buffers = 'cyan',
change = 'cyan',
delete = 'red',
diagnostics = 'green',
explorer = 'yellow',
fold = 'purple',
format = 'purple',
git = 'orange',
go_to = 'cyan',
notifications = 'orange',
replace = 'blue',
search = 'green',
sessions = 'azure',
spell = 'red',
surround = 'purple',
ui = 'green',
visual = 'purple',
window = 'blue',
search = 'green',
git = 'orange',
notifications = 'orange',
sessions = 'azure',
explorer = 'yellow',
yank = 'yellow',
}

View file

@ -1,15 +1,25 @@
return {
bottom = '',
center = '󰘢',
change = '',
char = '󰾹',
comment = '',
dashboard = {
quit = '',
mru = '',
project = '',
},
delete = '󰆴',
diagnostics = {
Error = '',
Warn = '',
Hint = '',
Info = '',
},
dashboard = {
quit = '',
mru = '',
project = '',
},
explorer = '󰙅',
first = '󰘀',
fold = '',
format = '󰉼',
git = {
added = '',
modified = '',
@ -18,11 +28,29 @@ return {
staged = '󰱒',
diff = '󰫙',
},
left = '',
prev = '',
right = '',
next = '',
first = '󰘀',
go_to = '',
indent = {
left = '󰉵',
decrease = '󰉵',
right = '󰉶',
increase = '󰉶',
},
last = '󰘁',
lazygit = '',
left = '',
next = '',
notifications = '󰈸',
prev = '',
registers = '󰅍',
replace = '',
right = '',
sessions = '',
spell = '',
search = '',
top = '',
ui = '󰙵',
undo = '',
visual = '',
word = '',
yank = '',
}

View file

@ -21,41 +21,20 @@ return {
require('lz.n').trigger_load('mini.icons')
end,
after = function()
local icons = require('icons')
local colors = require('colors')
local i = require('icons')
local c = require('colors')
require('which-key').setup({
preset = 'modern',
spec = {
{
mode = { 'n', 'v' },
{
'<LEADER>',
group = 'leader',
icon = { icon = '', color = 'green' },
},
{ '<LEADER><TAB>', group = 'tabs' },
{ '<LEADER>c', group = 'code' },
{ '<LEADER>f', group = 'file/find' },
{ '<LEADER>g', group = 'git' },
{ '<LEADER>gh', group = 'hunks' },
{ '<LEADER>n', group = 'notifications' },
{ '<LEADER>q', group = 'quit/session' },
{ '<LEADER>s', group = 'search' },
{
'<LEADER>u',
group = 'ui',
icon = { icon = '󰙵 ', color = colors.ui },
},
{
'<LEADER>x',
group = 'diagnostics/quickfix',
icon = { icon = '󱖫 ', color = colors.diagnostics },
},
{ '[', group = 'previous' },
{ ']', group = 'next' },
{ 'g', group = 'goto' },
{
'gs',
group = 'surround',
icon = { icon = '󰅲', color = colors.surround },
},
{ 'z', group = 'fold' },
{
'<LEADER>b',
group = 'buffer',
@ -63,6 +42,15 @@ return {
return require('which-key.extras').expand.buf()
end,
},
{ '<LEADER>c', group = 'code' },
{ '<LEADER>f', group = 'file/find' },
{ '<LEADER>g', group = 'git' },
{ '<LEADER>gh', group = 'hunks' },
{ '<LEADER>n', group = 'notifications' },
{ '<LEADER>q', group = 'quit/session' },
{ '<LEADER>s', group = 'search' },
{ '<LEADER>u', group = 'ui', icon = { icon = i.ui, color = c.ui } },
{ '<LEADER>ur', icon = { icon = '', color = c.ui } },
{
'<LEADER>w',
group = 'windows',
@ -70,10 +58,114 @@ return {
return require('which-key.extras').expand.win()
end,
},
{ 'gx', desc = 'open with system app' },
{ '<LEADER>ur', icon = { icon = '', color = colors.ui } },
{ '<LEADER>|', icon = { icon = '' } },
{ '<LEADER>-', icon = { icon = '' } },
{
'<LEADER>x',
group = 'diagnostics/quickfix',
icon = { icon = '󱖫 ', color = c.diagnostics },
},
{ '<LEADER>|', icon = '' },
{ '<LEADER>-', icon = '' },
{ '0', desc = 'start of line', icon = i.first },
{ 'b', desc = 'previous word', icon = i.word },
{ 'B', desc = 'previous WORD', icon = i.word },
{ 'c', desc = 'change' },
{ 'd', desc = 'delete' },
{ 'e', desc = 'next end of word', icon = i.word },
{ 'E', desc = 'next end of WORD', icon = i.word },
{ 'f', desc = 'find next char' },
{ 'F', desc = 'find previous char' },
{ 'g', group = 'goto', icon = { icon = i.go_to, color = c.go_to } },
{ 'gc', group = 'toggle comment' },
{ 'ge', desc = 'previous end of word', icon = i.word },
{ 'gf', desc = 'file under cursor' },
{ 'gg', desc = 'first line', icon = i.first },
{ 'gi', desc = 'last insert' },
{ 'gn', desc = 'search forward & select' },
{ 'gN', desc = 'search backward & select' },
{ 'gO', desc = 'document symbols', icon = '󰊕' },
{ 'gt', desc = 'next tab page' },
{ 'gT', desc = 'previous tab page' },
{ 'gu', desc = 'make lowercase', icon = '󰬵' },
{ 'gU', desc = 'make uppercase', icon = '󰬶' },
{ 'gv', desc = 'last visual selection' },
{ 'w', desc = 'format' },
{
'gs',
group = 'surround',
icon = { icon = '󰅲', color = c.surround },
},
{ 'gx', desc = 'open with system app', icon = '󰏋' },
{ 'g%', desc = 'cycle backward through results' },
{ 'g~', desc = 'toggle case' },
{ 'G', desc = 'last line', icon = i.last },
{ 'M', desc = 'middle line of window', icon = i.center },
{ 'r', desc = 'replace' },
{ 't', desc = 'find before next char' },
{ 'T', desc = 'find before previous char' },
{ 'v', desc = 'visual' },
{ 'V', desc = 'visual line' },
{ 'w', desc = 'next word', icon = i.word },
{ 'W', desc = 'next WORD', icon = i.word },
{ 'y', desc = 'yank' },
{ 'Y', desc = 'yank to end of line' },
{ 'z', group = 'fold/scroll/spell', icon = '' },
{ 'za', desc = 'toggle fold under cursor' },
{ 'zA', desc = 'toggle all folds under cursor' },
{ 'zb', desc = 'bottom this line', icon = i.bottom },
{ 'zc', desc = 'close fold under cursor' },
{ 'zC', desc = 'close all fold under cursor' },
{ 'zd', desc = 'delete fold under cursor' },
{ 'zD', desc = 'delete all folds under cursor' },
{ 'ze', desc = 'right this line', icon = i.right },
{ 'zE', desc = 'delete all folds in file' },
{ 'zf', desc = 'create fold' },
{ 'zg', desc = 'mark word as correctly spelled' },
{ 'zH', desc = 'half screen to the left', icon = i.left },
{ 'zi', desc = 'toggle folding' },
{ 'zL', desc = 'half screen to the right', icon = i.right },
{ 'zm', desc = 'fold more' },
{ 'zM', desc = 'close all folds' },
{ 'zo', desc = 'open fold under cursor' },
{ 'zO', desc = 'open all folds under cursor' },
{ 'zr', desc = 'fold less' },
{ 'zR', desc = 'open all folds' },
{ 'zs', desc = 'left this line', icon = i.left },
{ 'zt', desc = 'top this line', icon = i.top },
{ 'zv', desc = 'show cursor line' },
{ 'zw', desc = 'mark word as mispelled' },
{ 'zx', desc = 'update folds' },
{ 'zz', desc = 'center this line', icon = i.center },
{ 'z<CR>', desc = 'top this line', icon = i.top },
{ 'z=', group = 'spelling suggestions' },
{ '[', group = 'previous', icon = i.prev },
{ ']', group = 'next', icon = i.next },
{ '!', desc = 'run program', icon = '' },
{ '$', desc = 'end of line', icon = i.last },
{ '%', desc = 'matching (){}[]', icon = '󰅪' },
{ '&', desc = 'repeat last subsitute' },
{ ',', desc = 'repeat last char search (backwards)' },
{ '/', desc = 'search forward' },
{ ';', desc = 'repeat last char search' },
{ '<', desc = 'indent decrease', icon = i.indent.decrease },
{ '>', desc = 'indent increase', icon = i.indent.increase },
{ '?', desc = 'search backwards' },
{ '^', desc = 'first char of line', icon = i.first },
{ '_', desc = 'first char of line', icon = i.first },
{ '{', desc = 'previous empty line', icon = i.prev },
{ '}', desc = 'next empty line', icon = i.next },
{ '~', desc = 'toggle case' },
{
'<C-L>',
desc = 'clear & redraw',
icon = { icon = '', color = 'red' },
},
},
{
mode = { 'n', 'i' },
@ -88,42 +180,59 @@ return {
hidden = true,
{ 'j' },
{ 'k' },
},
{
mode = { 'v' },
{ '<', icon = { icon = '󰉵' } },
{ '>', icon = { icon = '󰉶' } },
{ 'h' },
{ 'l' },
{ '<PLUG>' },
},
},
icons = {
rules = {
{ pattern = 'explorer', icon = '󰙅', color = colors.explorer },
{ pattern = 'lazygit', icon = '' },
{ pattern = 'comment', icon = '' },
{ pattern = 'buffer', color = colors.buffer },
{
pattern = 'notification',
icon = '󰈸',
color = colors.notifications,
},
{ pattern = 'message', icon = '󰈸', color = colors.notifications },
{ pattern = 'session', icon = '', color = colors.sessions },
{ pattern = 'hunk', color = colors.git },
{ pattern = 'fold', icon = i.fold, color = c.fold },
{ pattern = 'buffer', color = c.buffer },
{ pattern = 'change', icon = i.change, color = c.change },
{ pattern = 'comment', icon = i.comment },
{ pattern = 'delete', icon = i.delete, color = c.delete },
{
pattern = 'diagnostic',
icon = icons.diagnostics.Info,
icon = i.diagnostics.Info,
hl = 'DiagnosticInfo',
},
{
pattern = 'error',
icon = icons.diagnostics.Error,
icon = i.diagnostics.Error,
hl = 'DiagnosticError',
},
{
pattern = 'explorer',
icon = i.explorer,
color = c.explorer,
},
{ pattern = 'format', icon = i.format, color = c.format },
{ pattern = 'hunk', color = c.git },
{ pattern = 'lazygit', icon = i.git, color = c.git },
{
pattern = 'message',
icon = i.notifications,
color = c.notifications,
},
{
pattern = 'notification',
icon = i.notifications,
color = c.notifications,
},
{ pattern = 'registers', icon = i.registers, color = c.yank },
{ pattern = 'replace', icon = i.replace, colors = c.replace },
{ pattern = 'session', icon = i.sessions, color = c.sessions },
{ pattern = 'spell', icon = i.spell, color = c.spell },
{ pattern = 'subsitute', icon = i.search, color = c.search },
{ pattern = 'visual', icon = i.visual, color = c.visual },
{
pattern = ' warning',
icon = icons.diagnostics.Warning,
icon = i.diagnostics.Warning,
hl = 'DiagnosticWarn',
},
{ pattern = 'yank', icon = i.yank, color = c.yank },
},
},
})

View file

@ -0,0 +1,7 @@
local req = MarleyVim.local_require('plugins.treesitter')
return {
req('nvim-treesitter-textobjects'),
req('nvim-treesitter'),
req('nvim-ts-autotag'),
}

View file

@ -0,0 +1,7 @@
return {
'nvim-treesitter-textobjects',
event = 'DeferredUIEnter',
before = function()
require('lz.n').trigger_load('nvim-treesitter')
end,
}

View file

@ -0,0 +1,56 @@
return {
event = { 'BufReadPost', 'BufWritePost', 'BufNewFile', 'DeferredUIEnter' },
keys = {
{ '<C-space>', desc = 'increment selection' },
{ '<BS>', desc = 'decrement selection', mode = 'x' },
},
before = function()
require('lz.n').trigger_load('which-key.nvim')
end,
after = function()
---@diagnostic disable-next-line: missing-fields
require('nvim-treesitter.configs').setup({
highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<C-space>',
node_incremental = '<C-space>',
scope_incremental = false,
node_decremental = '<BS>',
},
},
textobjects = {
move = {
enable = true,
goto_next_start = {
[']f'] = '@function.outer',
[']c'] = '@class.outer',
[']a'] = '@parameter.inner',
},
goto_next_end = {
[']F'] = '@function.outer',
[']C'] = '@class.outer',
[']A'] = '@parameter.inner',
},
goto_previous_start = {
['[f'] = '@function.outer',
['[c'] = '@class.outer',
['[a'] = '@parameter.inner',
},
goto_previous_end = {
['[F'] = '@function.outer',
['[C'] = '@class.outer',
['[A'] = '@parameter.inner',
},
},
},
})
require('which-key').add({
{ '<BS>', desc = 'decrement selection', mode = 'x' },
{ '<C-space>', desc = 'increment selection', mode = { 'x', 'n' } },
})
end,
}

View file

@ -0,0 +1,11 @@
return {
'nvim-ts-autotag',
event = { 'BufReadPost', 'BufWritePost', 'BufNewFile' },
after = function()
require('nvim-ts-autotag').setup({
opts = {
enable_close_on_slash = true,
},
})
end,
}