Compare commits

...

5 commits

7 changed files with 341 additions and 319 deletions

View file

@ -5,6 +5,9 @@
... ...
}: }:
{ {
imports = [
./treesitter.nix
];
programs.man.generateCaches = false; programs.man.generateCaches = false;
@ -39,35 +42,6 @@
shellcheck shellcheck
shfmt shfmt
stylua stylua
tree-sitter
tree-sitter-grammars.tree-sitter-bash
tree-sitter-grammars.tree-sitter-c
tree-sitter-grammars.tree-sitter-comment
tree-sitter-grammars.tree-sitter-css
tree-sitter-grammars.tree-sitter-cue
tree-sitter-grammars.tree-sitter-fish
tree-sitter-grammars.tree-sitter-gdscript
tree-sitter-grammars.tree-sitter-go
tree-sitter-grammars.tree-sitter-gomod
tree-sitter-grammars.tree-sitter-hcl
tree-sitter-grammars.tree-sitter-html
tree-sitter-grammars.tree-sitter-javascript
tree-sitter-grammars.tree-sitter-json
tree-sitter-grammars.tree-sitter-lua
tree-sitter-grammars.tree-sitter-markdown
tree-sitter-grammars.tree-sitter-nix
tree-sitter-grammars.tree-sitter-proto
tree-sitter-grammars.tree-sitter-rego
tree-sitter-grammars.tree-sitter-rust
tree-sitter-grammars.tree-sitter-scss
tree-sitter-grammars.tree-sitter-sql
tree-sitter-grammars.tree-sitter-svelte
tree-sitter-grammars.tree-sitter-toml
tree-sitter-grammars.tree-sitter-tsx
tree-sitter-grammars.tree-sitter-typescript
tree-sitter-grammars.tree-sitter-vim
tree-sitter-grammars.tree-sitter-yaml
tree-sitter-grammars.tree-sitter-zig
vscode-langservers-extracted vscode-langservers-extracted
]; ];
@ -77,6 +51,27 @@
targets-vim targets-vim
ts-comments-nvim ts-comments-nvim
{
plugin = blink-cmp;
type = "lua";
config = ''
require'blink-cmp'.setup({
keymap = 'super-tab',
windows = {
autocomplete = {
border = 'none',
},
documentation = {
border = 'rounded',
},
signature_help = {
border = 'rounded',
},
},
})
'';
}
{ {
plugin = codeium-nvim; plugin = codeium-nvim;
type = "lua"; type = "lua";
@ -141,67 +136,6 @@
''; '';
} }
{
plugin = nvim-treesitter-context;
type = "lua";
config = ''
require'treesitter-context'.setup{
enable = false,
}
vim.keymap.set('n', '<space>ut', "<cmd>TSContextToggle<cr>", {noremap = true, silent = true, desc = "TS Context"})
'';
}
{
plugin = nvim-treesitter.withAllGrammars;
type = "lua";
config = ''
require'nvim-treesitter.configs'.setup {
highlight = { enable = true, },
indent = { enable = true },
textobjects = {
select = {
enable = true,
lookahead = true,
},
},
}
'';
}
{
plugin = pkgs.vimUtils.buildVimPlugin {
name = "nvim-tree-pairs"; # make % match in TS
src = pkgs.fetchFromGitHub {
owner = "yorickpeterse";
repo = "nvim-tree-pairs";
rev = "e7f7b6cc28dda6f3fa271ce63b0d371d5b7641da";
hash = "sha256-fb4EsrWAbm8+dWAhiirCPuR44MEg+KYb9hZOIuEuT24=";
};
};
type = "lua";
config = "require('tree-pairs').setup()";
}
{
plugin = nvim-treesitter-textobjects;
type = "lua";
config = ''
require'nvim-treesitter.configs'.setup {
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<M-o>",
scope_incremental = "<M-O>",
node_incremental = "<M-o>",
node_decremental = "<M-i>",
},
},
}
'';
}
{ {
plugin = mini-nvim; plugin = mini-nvim;
type = "lua"; type = "lua";

View file

@ -1,82 +1,92 @@
local hsl = require("dieter.hsl").hslToHex local hsl = require("dieter.hsl").hslToHex
local colors = { local colors = {
light = { light = {
background = hsl(240, 100, 100), background = hsl(240, 100, 100),
foreground = hsl(0, 0, 13), foreground = hsl(0, 0, 13),
accent1 = hsl(12, 100, 50), accent1 = hsl(12, 100, 50),
dimmed = hsl(0, 0, 80), dimmed = hsl(0, 0, 80),
dimmed_subtle = hsl(0, 0, 20), dimmed_subtle = hsl(0, 0, 20),
string = hsl(96, 50, 33), string = hsl(96, 50, 33),
comment = hsl(230, 66, 40), comment = hsl(230, 66, 40),
comment_error = hsl(2, 85, 40), comment_error = hsl(2, 85, 40),
diagnostic_error = hsl(347, 80, 45), diagnostic_error = hsl(347, 80, 45),
diagnostic_warning = hsl(30, 100, 50), diagnostic_warning = hsl(30, 100, 50),
diagnostic_info = hsl(145, 80, 30), diagnostic_info = hsl(145, 80, 30),
diagnostic_hint = hsl(145, 80, 30), diagnostic_hint = hsl(145, 80, 30),
popup_error_bg = hsl(0, 90, 99), popup_error_bg = hsl(0, 90, 99),
popup_warning_bg = hsl(27, 90, 99), popup_warning_bg = hsl(27, 90, 99),
popup_info_bg = hsl(112, 90, 99), popup_info_bg = hsl(112, 90, 99),
popup_hint_bg = hsl(112, 90, 99), popup_hint_bg = hsl(112, 90, 99),
add = hsl(84, 50, 80), add = hsl(84, 50, 80),
add_quarter = hsl(84, 80, 95), add_quarter = hsl(84, 80, 95),
change = hsl(41, 80, 80), change = hsl(41, 80, 80),
change_quarter = hsl(224, 100, 85), change_quarter = hsl(224, 100, 85),
delete = hsl(350, 100, 40), delete = hsl(350, 100, 40),
delete_quarter = hsl(350, 100, 85), delete_quarter = hsl(350, 100, 85),
dialog_bg = hsl(224, 5, 92), dialog_bg = hsl(224, 5, 92),
selection = hsl(270, 75, 92), selection = hsl(270, 75, 92),
highlight_subtle = hsl(0, 0, 94), highlight_subtle = hsl(0, 0, 94),
highlight_intense = hsl(42, 100, 30), highlight_intense = hsl(42, 100, 30),
}, },
dark = { dark = {
background = hsl(216, 28, 7), background = hsl(216, 28, 7),
foreground = hsl(0, 0, 80), foreground = hsl(0, 0, 80),
accent1 = hsl(12, 100, 50), accent1 = hsl(12, 100, 50),
dimmed = hsl(0, 0, 25), dimmed = hsl(0, 0, 25),
dimmed_subtle = hsl(0, 0, 50), dimmed_subtle = hsl(0, 0, 50),
highlight_subtle = hsl(0, 0, 6), highlight_subtle = hsl(0, 0, 6),
highlight_intense = hsl(58, 100, 60), highlight_intense = hsl(58, 100, 60),
string = hsl(96, 50, 70), string = hsl(96, 50, 70),
comment = hsl(220, 50, 60), comment = hsl(220, 50, 60),
comment_error = hsl(2, 85, 50), comment_error = hsl(2, 85, 50),
diagnostic_error = hsl(353, 100, 45), diagnostic_error = hsl(353, 100, 45),
diagnostic_warning = hsl(30, 100, 50), diagnostic_warning = hsl(30, 100, 50),
diagnostic_info = hsl(176, 80, 60), diagnostic_info = hsl(176, 80, 60),
diagnostic_hint = hsl(176, 80, 60), diagnostic_hint = hsl(176, 80, 60),
popup_error_bg = hsl(0, 95, 7), popup_error_bg = hsl(0, 95, 7),
popup_warning_bg = hsl(27, 95, 7), popup_warning_bg = hsl(27, 95, 7),
popup_info_bg = hsl(112, 95, 7), popup_info_bg = hsl(112, 95, 7),
popup_hint_bg = hsl(112, 95, 7), popup_hint_bg = hsl(112, 95, 7),
add = hsl(100, 100, 12), add = hsl(100, 100, 12),
add_quarter = hsl(84, 80, 15), add_quarter = hsl(84, 80, 15),
change = hsl(41, 100, 15), change = hsl(41, 100, 15),
change_quarter = hsl(224, 100, 15), change_quarter = hsl(224, 100, 15),
delete = hsl(350, 100, 40), delete = hsl(350, 100, 40),
delete_quarter = hsl(350, 100, 15), delete_quarter = hsl(350, 100, 15),
-- dialog_bg = background, -- dialog_bg = background,
-- dialog_fg = hsl(216, 70, 80), -- dialog_fg = hsl(216, 70, 80),
-- dialog_bg = hsl(216, 25, 20), -- dialog_bg = hsl(216, 25, 20),
-- selection = hsl(216, 25, 33), -- selection = hsl(216, 25, 33),
selection = hsl(213, 60, 40), selection = hsl(213, 60, 40),
},
cmp_bg = hsl(218, 30, 13),
cmp_fg = hsl(218, 30, 60),
cmp_selected_bg = hsl(218, 30, 25),
cmp_selected_fg = hsl(218, 50, 80),
doc_bg = hsl(220, 80, 10),
doc_fg = hsl(200, 30, 60),
suggestion = hsl(180, 55, 40),
},
} }
@ -85,99 +95,113 @@ c.dialog_fg = c.foreground
c.dialog_bg = c.background c.dialog_bg = c.background
local theme = { local theme = {
Normal = { fg = c.foreground, bg = c.background }, Normal = { fg = c.foreground, bg = c.background },
Constant = { link = "NormalNC" }, Constant = { link = "NormalNC" },
Delimiter = { link = "NormalNC" }, Delimiter = { link = "NormalNC" },
Identifier = { link = "NormalNC" }, Identifier = { link = "NormalNC" },
Keyword = { fg = c.foreground, bold = true }, Keyword = { fg = c.foreground, bold = true },
Operator = { link = "NormalNC" }, Operator = { link = "NormalNC" },
Special = { link = "NormalNC" }, Special = { link = "NormalNC" },
Type = { link = "NormalNC" }, Type = { link = "NormalNC" },
String = { fg = c.string }, String = { fg = c.string },
Comment = { fg = c.comment, italic = true, bold = true }, Comment = { fg = c.comment, italic = true, bold = true },
CommentError = { fg = c.comment_error, italic = true, bold = true }, CommentError = { fg = c.comment_error, italic = true, bold = true },
["@comment.note"] = { link = "Comment" }, ["@comment.note"] = { link = "Comment" },
["@comment.todo"] = { link = "CommentError" }, ["@comment.todo"] = { link = "CommentError" },
["@comment.error"] = { link = "CommentError" }, ["@comment.error"] = { link = "CommentError" },
["@comment.warning"] = { link = "CommentError" }, ["@comment.warning"] = { link = "CommentError" },
DiffAdd = { fg = c.add, bg = c.add_quarter }, DiffAdd = { fg = c.add, bg = c.add_quarter },
GitSignsAdd = { fg = c.add, bg = c.background }, GitSignsAdd = { fg = c.add, bg = c.background },
GitSignsAddNr = { link = "DiffAdd" }, GitSignsAddNr = { link = "DiffAdd" },
DiffChange = { fg = c.change, bg = c.change_quarter }, DiffChange = { fg = c.change, bg = c.change_quarter },
GitSignsChange = { fg = c.change, bg = c.background }, GitSignsChange = { fg = c.change, bg = c.background },
GitSignsChangeNr = { link = "DiffChange" }, GitSignsChangeNr = { link = "DiffChange" },
DiffDelete = { fg = c.delete, bg = c.delete_quarter }, DiffDelete = { fg = c.delete, bg = c.delete_quarter },
GitSignsDelete = { fg = c.delete, bg = c.background }, GitSignsDelete = { fg = c.delete, bg = c.background },
GitSignsDeleteNr = { link = "DiffDelete" }, GitSignsDeleteNr = { link = "DiffDelete" },
-- Treesitter -- Treesitter
["@function"] = { link = "NormalNC" }, ["@function"] = { link = "NormalNC" },
["@special"] = { link = "NormalNC" }, ["@special"] = { link = "NormalNC" },
["@variable"] = { link = "NormalNC" }, ["@variable"] = { link = "NormalNC" },
["@lsp.type.variable"] = { fg = c.dimmed_subtle }, ["@lsp.type.variable"] = { fg = c.dimmed_subtle },
-- UI Elements -- UI Elements
CursorLine = { bg = c.highlight_subtle }, CursorLine = { bg = c.highlight_subtle },
DiagnosticError = { fg = c.diagnostic_error, italic = true }, DiagnosticError = { fg = c.diagnostic_error, italic = true },
DiagnosticFloatingError = { fg = c.diagnostic_error, bg = c.popup_error_bg }, DiagnosticFloatingError = { fg = c.diagnostic_error, bg = c.popup_error_bg },
DiagnosticFloatingWarn = { fg = c.diagnostic_warning, bg = c.popup_warning_bg }, DiagnosticFloatingWarn = { fg = c.diagnostic_warning, bg = c.popup_warning_bg },
DiagnosticFloatingInfo = { fg = c.diagnostic_info, bg = c.popup_info_bg }, DiagnosticFloatingInfo = { fg = c.diagnostic_info, bg = c.popup_info_bg },
DiagnosticFloatingHint = { fg = c.diagnostic_hint, bg = c.popup_hint_bg }, DiagnosticFloatingHint = { fg = c.diagnostic_hint, bg = c.popup_hint_bg },
DiagnosticUnderlineError = { fg = c.diagnostic_error, undercurl = true }, DiagnosticUnderlineError = { fg = c.diagnostic_error, undercurl = true },
DiagnosticUnderlineWarn = { fg = c.diagnostic_warn, undercurl = true }, DiagnosticUnderlineWarn = { fg = c.diagnostic_warn, undercurl = true },
DiagnosticUnderlineInfo = { fg = c.diagnostic_info, undercurl = true }, DiagnosticUnderlineInfo = { fg = c.diagnostic_info, undercurl = true },
DiagnosticUnderlinehint = { fg = c.diagnostic_hint, undercurl = true }, DiagnosticUnderlinehint = { fg = c.diagnostic_hint, undercurl = true },
DiagnosticSignError = { fg = c.diagnostic_error }, DiagnosticSignError = { fg = c.diagnostic_error },
DiagnosticSignHint = { fg = c.diagnostic_hint }, DiagnosticSignHint = { fg = c.diagnostic_hint },
DiagnosticSignInfo = { fg = c.diagnostic_info }, DiagnosticSignInfo = { fg = c.diagnostic_info },
DiagnosticSignWarn = { fg = c.diagnostic_warning }, DiagnosticSignWarn = { fg = c.diagnostic_warning },
LineNr = { fg = c.dimmed, italic = true }, LineNr = { fg = c.dimmed, italic = true },
IndentLine = { fg = c.background }, IndentLine = { fg = c.background },
IndentLineCurrent = { fg = c.dimmed }, IndentLineCurrent = { fg = c.dimmed },
TreesitterContext = { reverse = true }, TreesitterContext = { reverse = true },
TreesitterContextLineNumber = { bg = c.dimmed, reverse = true, italic = true }, TreesitterContextLineNumber = { bg = c.dimmed, reverse = true, italic = true },
InclineNormal = { bg = c.background }, InclineNormal = { bg = c.background },
InclineNormalNC = { bg = c.background }, InclineNormalNC = { bg = c.background },
WinSeparator = { bg = c.dialog_bg, fg = c.dialog_fg }, WinSeparator = { bg = c.dialog_bg, fg = c.dialog_fg },
NormalFloat = { bg = c.dialog_bg, fg = c.dialog_fg }, NormalFloat = { bg = c.dialog_bg, fg = c.dialog_fg },
Title = { fg = c.foreground, bold = true }, Title = { fg = c.foreground, bold = true },
FloatBorder = { fg = c.dialog_fg }, FloatBorder = { fg = c.dialog_fg },
FloatTitle = { fg = c.dialog_fg, bold = true }, FloatTitle = { fg = c.dialog_fg, bold = true },
MiniPickMatchCurrent = { bg = c.background, fg = c.foreground, reverse = true }, MiniPickMatchCurrent = { bg = c.background, fg = c.foreground, reverse = true },
MiniStarterCurrent = { link = "MiniPickMatchCurrent" }, MiniStarterCurrent = { link = "MiniPickMatchCurrent" },
MiniClueNextKey = { bg = c.dialog_bg, fg = c.dialog_fg, bold = true }, MiniClueNextKey = { bg = c.dialog_bg, fg = c.dialog_fg, bold = true },
MiniClueDescGroup = { bg = c.background, fg = c.foreground, italic = true }, MiniClueDescGroup = { bg = c.background, fg = c.foreground, italic = true },
MiniClueSeparator = { link = "NormalFloat" }, MiniClueSeparator = { link = "NormalFloat" },
NoiceMini = { fg = c.foreground, italic = true }, BlinkCmpMenu = { bg = c.cmp_bg, fg = c.cmp_fg },
BlinkCmpMenuSelection = { bg = c.cmp_selected_bg, fg = c.cmp_selected_fg, reverse = false },
BlinkCmpMenuBorder = { bg = c.cmp_bg, fg = c.cmp_fg },
BlinkCmpLabel = { link = 'BlinkCmpMenu' },
BlinkCmpLabelMatch = { link = 'BlinkCmpMenu', underline = true },
TelescopeNormal = { fg = c.foreground, bg = c.background }, BlinkCmpDoc = { bg = c.doc_bg, fg = c.foreground },
TelescopeBorder = { bold = true }, BlinkCmpDocBorder = { bg = c.doc_bg, fg = c.doc_fg },
TelescopeSelection = { bg = c.selection }, BlinkCmpDocDetail = { link = 'BlinkCmpDoc' },
TelescopeResultsNormal = { fg = c.foreground, bold = true }, BlinkCmpSignatureHelp = { link = 'BlinkCmpDoc' },
TelescopeResultsComment = { fg = c.dimmed_subtle, italic = true, bold = false }, BlinkCmpSignatureHelpBorder = { link = 'BlinkCmpDocBorder' },
Visual = { bg = c.selection }, NeoCodeiumSuggestion = { fg = c.suggestion , bold = true, italic = true },
LspReferenceText = { fg = c.highlight_intense, undercurl = true },
NoiceMini = { fg = c.foreground, italic = true },
TelescopeNormal = { fg = c.foreground, bg = c.background },
TelescopeBorder = { bold = true },
TelescopeSelection = { bg = c.selection },
TelescopeResultsNormal = { fg = c.foreground, bold = true },
TelescopeResultsComment = { fg = c.dimmed_subtle, italic = true, bold = false },
Visual = { bg = c.selection },
LspReferenceText = { fg = c.highlight_intense, undercurl = true },
} }
vim.cmd("hi clear") vim.cmd("hi clear")
if vim.fn.exists("syntax_on") == 1 then if vim.fn.exists("syntax_on") == 1 then
vim.cmd("syntax reset") vim.cmd("syntax reset")
end end
for group, hl in pairs(theme) do for group, hl in pairs(theme) do
vim.api.nvim_set_hl(0, group, hl) vim.api.nvim_set_hl(0, group, hl)
end end
vim.g.colors_name = "dieter" vim.g.colors_name = "dieter"

View file

@ -1,4 +1,4 @@
vim.g.mapleader = "<space>" vim.g.mapleader = ' '
vim.g.maplocalleader = "," vim.g.maplocalleader = ","
-- UI -- UI
@ -14,13 +14,14 @@ vim.opt.termguicolors = true
-- Ruler -- Ruler
function GetIndicators() function GetIndicators()
local bufnr = vim.api.nvim_get_current_buf() local bufnr = vim.api.nvim_get_current_buf()
local counts = vim.diagnostic.count(bufnr) local counts = vim.diagnostic.count(bufnr)
local errors = counts[vim.diagnostic.severity.ERROR] or 0 local errors = counts[vim.diagnostic.severity.ERROR] or 0
local warnings = counts[vim.diagnostic.severity.WARN] or 0 local warnings = counts[vim.diagnostic.severity.WARN] or 0
local warn_string = warnings > 0 and "%#DiagnosticWarn# " .. warnings .. " " or " " local warn_string = warnings > 0 and "%#DiagnosticWarn# " .. warnings .. " " or " "
local error_string = errors > 0 and "%#DiagnosticError# " .. errors .. " " or " " local error_string = errors > 0 and "%#DiagnosticError# " .. errors .. " " or " "
return warn_string .. error_string return warn_string .. error_string
end end
vim.opt.rulerformat = "%40(%=%{%v:lua.GetIndicators()%}%#Label#│ %t %)" vim.opt.rulerformat = "%40(%=%{%v:lua.GetIndicators()%}%#Label#│ %t %)"
-- Search -- Search
@ -52,17 +53,16 @@ vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
-- --
vim.o.autochdir = true vim.o.autochdir = true
vim.o.cia = 'kind,abbr,menu'
vim.o.fillchars = "stl: ,stlnc: ,eob:░,vert:│" vim.o.fillchars = "stl: ,stlnc: ,eob:░,vert:│"
vim.o.icm = "split"
vim.o.list = false vim.o.list = false
vim.o.scrolloff = 7 vim.o.scrolloff = 7
vim.o.splitkeep = "screen"
vim.o.updatetime = 50
vim.o.timeout = true
vim.o.timeoutlen = 10
vim.o.icm = "split"
vim.o.cia = 'kind,abbr,menu'
vim.o.showmode = false vim.o.showmode = false
vim.o.splitkeep = "screen"
vim.o.timeoutlen = 10
vim.o.timeout = true
vim.o.updatetime = 50
-- Use rg -- Use rg
@ -95,8 +95,44 @@ vim.keymap.set({ "i", "s" }, "<Tab>", function()
end end
end, { expr = true }) end, { expr = true })
vim.keymap.set({ "n" }, "<c-/>", "gcc", { remap = true })
vim.keymap.set({ "v" }, "<c-/>", "gc", { remap = true }) -- Keymap
vim.keymap.set({ "n" }, "<c-_>", "gcc", { remap = true }) local opts = function(label)
vim.keymap.set({ "v" }, "<c-_>", "gc", { remap = true }) return { noremap = true, silent = true, desc = label }
end
-- Comments
vim.keymap.set("n", "<c-/>", "gcc", { remap = true })
vim.keymap.set("v", "<c-/>", "gc", { remap = true })
vim.keymap.set("n", "<c-_>", "gcc", { remap = true })
vim.keymap.set("v", "<c-_>", "gc", { remap = true })
vim.keymap.set({ "n", "v" }, "<Leader>a", vim.lsp.buf.code_action, { remap = true, desc = "Code action" })
vim.keymap.set("n", "<Leader>af", function()
vim.lsp.buf.format({ async = true })
end, opts("Format Buffer"))
vim.keymap.set('n', '<Leader>b', "<cmd>Pick buffers<cr>", opts("Open buffer picker"))
vim.keymap.set('n', '<Leader>/', "<cmd>Pick grep_live_root<cr>", opts("Search workspace files"))
vim.keymap.set('n', '<Leader>d', "<cmd>Pick diagnostic<cr>", opts("Open diagnostics picker"))
vim.keymap.set("n", "<Leader>D", vim.diagnostic.setloclist, { desc = "Diagnostics to location list" })
vim.keymap.set("n", "<Leader>r", vim.lsp.buf.rename, opts("Rename Symbol"))
vim.keymap.set('n', '<Leader>F', "<cmd>Pick files<cr>", opts("Open file picker CWD"))
vim.keymap.set('n', '<Leader>f', "<cmd>Pick files_root<cr>", opts("Open file picker"))
vim.keymap.set('n', '<Leader>g', "<cmd>Pick oldfiles<cr>", opts("Open file picker history"))
vim.keymap.set("n", '<Leader>k', vim.lsp.buf.hover, opts("Show docs for item under cursor"))
vim.keymap.set('n', '<Leader>q', require('mini.bufremove').delete, opts("Delete buffer"))
vim.keymap.set('n', '<Leader>s', "<cmd>Pick lsp scope='document_symbol'<cr>", opts("Open symbol picker"))
vim.keymap.set('n', '<Leader>S', "<cmd>Pick lsp scope='workspace_symbol'<cr>", opts("Open workspace symbol picker"))
vim.keymap.set("n", "<Leader>ws", "<C-w>s", opts("Horizontal split"))
vim.keymap.set("n", "<Leader>wv", "<C-w>v", opts("Vertical split"))
vim.keymap.set('n', '<tab>', "<cmd>Pick buffers include_current=false<cr>", opts("Buffers"))
vim.keymap.set("n", "zz", "zt", { remap = true }) vim.keymap.set("n", "zz", "zt", { remap = true })
vim.keymap.set({ "n", "v" }, "<Leader>y", '"+y', opts("Yank to clipboard"))
vim.keymap.set("n", "K", vim.lsp.buf.hover, {})
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts("Declaration"))
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts("Definition"))
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts("Implementation"))
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts("Buffer References"))
vim.keymap.set("n", "gt", vim.lsp.buf.type_definition, opts("Type Definition"))
vim.keymap.set({"n", "i"}, "<M-k>", vim.lsp.buf.signature_help, opts("Signature Help"))
vim.keymap.set({ "n", "v" }, "<Leader>aa", vim.lsp.buf.code_action, opts("Code Action"))

View file

@ -1,5 +1,3 @@
vim.keymap.set("n", "<space>d", vim.diagnostic.setloclist, { desc = "Add buffer diagnostics to the location list." })
vim.api.nvim_create_autocmd("LspAttach", { vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}), group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(ev) callback = function(ev)
@ -16,28 +14,6 @@ vim.api.nvim_create_autocmd("LspAttach", {
if client.server_capabilities.codeLensProvider then if client.server_capabilities.codeLensProvider then
vim.lsp.codelens.refresh({ bufnr = bufnr }) vim.lsp.codelens.refresh({ bufnr = bufnr })
end end
vim.keymap.set("n", "K", vim.lsp.buf.hover, {})
vim.keymap.set("n", "gd", vim.lsp.buf.definition, {})
vim.keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, {})
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts("Declaration"))
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts("Definition"))
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts("Implementation"))
vim.keymap.set("n", "<M-k>", vim.lsp.buf.signature_help, opts("Signature Help"))
vim.keymap.set("i", "<M-k>", vim.lsp.buf.signature_help, opts("Signature Help"))
vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts("Add Workspace Folder"))
vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts("Remove Workspace Folder"))
vim.keymap.set("n", "<space>wl", function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, opts("List Workspace Folders"))
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, opts("Type Definition"))
vim.keymap.set("n", "<space>r", vim.lsp.buf.rename, opts("Rename Symbol"))
vim.keymap.set({ "n", "v" }, "<space>a", vim.lsp.buf.code_action, opts("Code Action"))
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts("Buffer References"))
vim.keymap.set("n", "<space>cf", function()
vim.lsp.buf.format({ async = true })
end, opts("Format Buffer"))
end, end,
}) })

View file

@ -1,9 +1,7 @@
local opts = function(label)
return { noremap = true, silent = true, desc = label }
end
require('mini.ai').setup() require('mini.ai').setup()
require('mini.align').setup() require('mini.align').setup()
require('mini.bracketed').setup() require('mini.bracketed').setup()
require('mini.bufremove').setup()
require('mini.comment').setup() require('mini.comment').setup()
require('mini.diff').setup() require('mini.diff').setup()
require('mini.extra').setup() require('mini.extra').setup()
@ -13,52 +11,10 @@ require('mini.surround').setup()
require('mini.splitjoin').setup() require('mini.splitjoin').setup()
require('mini.trailspace').setup() require('mini.trailspace').setup()
local bufremove = require('mini.bufremove')
bufremove.setup()
vim.keymap.set('n', '<space>bd', bufremove.delete, opts("Delete"))
require('mini.cursorword').setup({ require('mini.cursorword').setup({
delay = 800 delay = 800
}) })
require('mini.completion').setup({
window = {
info = { height = 25, width = 80, border = 'rounded' },
signature = { height = 25, width = 80, border = 'rounded' },
},
})
local imap_expr = function(lhs, rhs)
vim.keymap.set('i', lhs, rhs, { expr = true })
end
imap_expr('<Tab>', [[pumvisible() ? "\<C-n>" : "\<Tab>"]])
imap_expr('<S-Tab>', [[pumvisible() ? "\<C-p>" : "\<S-Tab>"]])
local keycode = vim.keycode or function(x)
return vim.api.nvim_replace_termcodes(x, true, true, true)
end
local keys = {
['cr'] = keycode('<CR>'),
['ctrl-y'] = keycode('<C-y>'),
['ctrl-y_cr'] = keycode('<C-y><CR>'),
}
_G.cr_action = function()
if vim.fn.pumvisible() ~= 0 then
-- If popup is visible, confirm selected item or add new line otherwise
local item_selected = vim.fn.complete_info()['selected'] ~= -1
return item_selected and keys['ctrl-y'] or keys['ctrl-y_cr']
else
-- If popup is not visible, use plain `<CR>`. You might want to customize
-- according to other plugins. For example, to use 'mini.pairs', replace
-- next line with `return require('mini.pairs').cr()`
return keys['cr']
end
end
vim.keymap.set('i', '<CR>', 'v:lua._G.cr_action()', { expr = true })
local hipatterns = require('mini.hipatterns') local hipatterns = require('mini.hipatterns')
hipatterns.setup({ hipatterns.setup({
highlighters = { highlighters = {
@ -84,9 +40,29 @@ require('mini.jump2d').setup({
mappings = { start_jumping = 'gw' } mappings = { start_jumping = 'gw' }
}) })
local picker_win_config = function()
local height = vim.o.lines - 8
local width = 80
return {
border = 'rounded',
anchor = 'NW',
height = height,
width = width,
row = 2,
col = math.floor((vim.o.columns - width) / 2),
}
end
require('mini.pick').setup({ require('mini.pick').setup({
mappings = { move_down = '<tab>' }, mappings = {
options = { use_cache = true } move_down = '<tab>',
toggle_info = '<C-k>',
toggle_preview = '<C-p>',
},
options = { use_cache = true },
window = {
config = picker_win_config,
},
}) })
MiniPick.registry.files_root = function(local_opts) MiniPick.registry.files_root = function(local_opts)
local root_patterns = { ".jj", ".git" } local root_patterns = { ".jj", ".git" }
@ -101,13 +77,6 @@ MiniPick.registry.grep_live_root = function(local_opts)
local_opts.cwd = root_dir local_opts.cwd = root_dir
return MiniPick.builtin.grep_live(local_opts, { source = { cwd = root_dir } }) return MiniPick.builtin.grep_live(local_opts, { source = { cwd = root_dir } })
end end
vim.keymap.set('n', '<space>/', "<cmd>Pick grep_live_root<cr>", opts("Live Grep"))
vim.keymap.set('n', '<space>fF', "<cmd>Pick files<cr>", opts("FindCWD"))
vim.keymap.set('n', '<space>ff', "<cmd>Pick files_root<cr>", opts("Find"))
vim.keymap.set('n', '<space>fr', "<cmd>Pick oldfiles<cr>", opts("Recent"))
vim.keymap.set('n', '<space>bb', "<cmd>Pick buffers<cr>", opts("Switch"))
vim.keymap.set('n', '<space>d', "<cmd>Pick diagnostics<cr>", opts("Diagnostics"))
vim.keymap.set('n', '<tab>', "<cmd>Pick buffers include_current=false<cr>", opts("Buffers"))
local miniclue = require('mini.clue') local miniclue = require('mini.clue')
@ -157,7 +126,11 @@ miniclue.setup({ -- cute prompts about bindings
miniclue.gen_clues.z(), miniclue.gen_clues.z(),
}, },
window = { window = {
delay = 15, delay = 0,
config = {
border = 'rounded',
width = 'auto',
},
} }
}) })
@ -175,7 +148,7 @@ require('mini.notify').setup({
require('mini.starter').setup({ require('mini.starter').setup({
header = header =
[[ ______ _ [[ ______ _
(_____ \ _ (_) (_____ \ _ (_)
_____) )___| |_ ____ ____ _ ____ _____) )___| |_ ____ ____ _ ____
| ____/ _ | _)/ _ |/ _ | |/ _ | | ____/ _ | _)/ _ |/ _ | |/ _ |

View file

@ -0,0 +1,79 @@
{
inputs,
lib,
pkgs,
...
}:
{
programs.neovim = {
extraPackages = with pkgs; [
tree-sitter
];
plugins = with pkgs.vimPlugins; [
ts-comments-nvim
nvim-ts-context-commentstring
{
plugin = nvim-treesitter-context;
type = "lua";
config = ''
require'treesitter-context'.setup{
enable = false,
}
vim.keymap.set('n', '<space>ut', "<cmd>TSContextToggle<cr>", {noremap = true, silent = true, desc = "TS Context"})
'';
}
{
plugin = nvim-treesitter.withAllGrammars;
type = "lua";
config = ''
require'nvim-treesitter.configs'.setup {
highlight = { enable = true, },
indent = { enable = true },
rainbow = { enable = true },
textobjects = {
select = {
enable = true,
lookahead = true,
},
},
}
'';
}
{
plugin = pkgs.vimUtils.buildVimPlugin {
name = "nvim-tree-pairs"; # make % match in TS
src = pkgs.fetchFromGitHub {
owner = "yorickpeterse";
repo = "nvim-tree-pairs";
rev = "e7f7b6cc28dda6f3fa271ce63b0d371d5b7641da";
hash = "sha256-fb4EsrWAbm8+dWAhiirCPuR44MEg+KYb9hZOIuEuT24=";
};
};
type = "lua";
config = "require('tree-pairs').setup()";
}
{
plugin = nvim-treesitter-textobjects;
type = "lua";
config = ''
require'nvim-treesitter.configs'.setup {
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<M-o>",
scope_incremental = "<M-O>",
node_incremental = "<M-o>",
node_decremental = "<M-i>",
},
},
}
'';
}
];
};
}

View file

@ -6,7 +6,7 @@
clock24 = true; clock24 = true;
escapeTime = 500; escapeTime = 500;
mouse = true; mouse = true;
shortcut = "o"; shortcut = "t";
extraConfig = '' extraConfig = ''
set -g allow-passthrough on set -g allow-passthrough on
set -g default-terminal "tmux-256color" set -g default-terminal "tmux-256color"