172 lines
4.9 KiB
Nix
172 lines
4.9 KiB
Nix
{ pkgs, ... }:
|
|
{
|
|
programs.nixvim = {
|
|
plugins.oil = {
|
|
enable = true;
|
|
settings = {
|
|
keymaps = {
|
|
"q" = "actions.close";
|
|
};
|
|
columns = [
|
|
"icon"
|
|
"permissions"
|
|
"size"
|
|
"mtime"
|
|
];
|
|
};
|
|
};
|
|
|
|
extraPlugins = [ pkgs.vimPlugins.snacks-nvim ];
|
|
extraConfigLua = /* lua */ ''
|
|
local Snacks = require("snacks");
|
|
local filter_lsp_definitions = function(item)
|
|
if item.file:match("/react/ts5.0/") or item.file:match("react.d.ts") then
|
|
return false
|
|
end
|
|
return true
|
|
end
|
|
|
|
Snacks.setup({
|
|
bigfile = { enabled = true },
|
|
bufdelete = { enabled = true },
|
|
git = { enabled = true },
|
|
indent = { enabled = true },
|
|
input = { enabled = true },
|
|
notifier = { enabled = true },
|
|
picker = {
|
|
enabled = true,
|
|
prompt = "λ ",
|
|
layout = { preset = "ivy" },
|
|
},
|
|
statuscolumn = { enabled = true },
|
|
})
|
|
'';
|
|
|
|
keymaps = [
|
|
# Git
|
|
{
|
|
key = "<leader>gb";
|
|
action.__raw = "function() Snacks.git.blame_line() end";
|
|
options.desc = "Show git blame for current line";
|
|
}
|
|
# Picker
|
|
{
|
|
key = "<leader>.";
|
|
action.__raw = "function() Snacks.picker.files({ hidden = true }) end";
|
|
options.desc = "Files";
|
|
}
|
|
{
|
|
key = "<leader><leader>";
|
|
action.__raw = "function() Snacks.picker.git_files() end";
|
|
options.desc = "Git files";
|
|
}
|
|
# Find
|
|
{
|
|
key = "<leader>fr";
|
|
action.__raw = "function() Snacks.picker.recent() end";
|
|
options.desc = "Recent";
|
|
}
|
|
{
|
|
key = "<leader>fp";
|
|
action.__raw = "function() Snacks.picker.projects() end";
|
|
options.desc = "Projects";
|
|
}
|
|
{
|
|
key = "<leader>bb";
|
|
action.__raw = "function() Snacks.picker.buffers() end";
|
|
options.desc = "List buffers";
|
|
}
|
|
{
|
|
key = "<leader>bd";
|
|
action.__raw = "function() Snacks.bufdelete() end";
|
|
options.desc = "Delete buffer";
|
|
}
|
|
{
|
|
key = "<leader>bD";
|
|
action.__raw = "function() Snacks.bufdelete.all() end";
|
|
options.desc = "Delete all buffers";
|
|
}
|
|
{
|
|
key = "<leader>bo";
|
|
action.__raw = "function() Snacks.bufdelete.other() end";
|
|
options.desc = "Delete other buffers";
|
|
}
|
|
# Search
|
|
{
|
|
key = "<leader>ss";
|
|
action.__raw = "function() Snacks.picker.grep() end";
|
|
options.desc = "Grep";
|
|
}
|
|
{
|
|
mode = [
|
|
"n"
|
|
"x"
|
|
];
|
|
key = "<leader>sw";
|
|
action.__raw = "function() Snacks.picker.grep_word() end";
|
|
options.desc = "Visual selection or word";
|
|
}
|
|
{
|
|
key = "<leader>su";
|
|
action.__raw = "function() Snacks.picker.undo() end";
|
|
options.desc = "Undo History";
|
|
}
|
|
# Diagnostics
|
|
{
|
|
key = "<leader>td";
|
|
action.__raw = "function() Snacks.picker.diagnostics_buffer() end";
|
|
options.desc = "Buffer Diagnostics";
|
|
}
|
|
{
|
|
key = "<leader>ta";
|
|
action.__raw = "function() Snacks.picker.diagnostics() end";
|
|
options.desc = "Diagnostics";
|
|
}
|
|
# LSP
|
|
{
|
|
key = "gd";
|
|
action.__raw = "function() Snacks.picker.lsp_definitions({ filter = { filter = filter_lsp_definitions } }) end";
|
|
options.desc = "Goto Definition";
|
|
}
|
|
{
|
|
key = "gD";
|
|
action.__raw = "function() Snacks.picker.lsp_declarations() end";
|
|
options.desc = "Goto Declaration";
|
|
}
|
|
{
|
|
key = "grr";
|
|
action.__raw = "function() Snacks.picker.lsp_references() end";
|
|
options = {
|
|
desc = "References";
|
|
nowait = true;
|
|
};
|
|
}
|
|
{
|
|
key = "gI";
|
|
action.__raw = "function() Snacks.picker.lsp_implementations() end";
|
|
options.desc = "Goto Implementation";
|
|
}
|
|
{
|
|
key = "gy";
|
|
action.__raw = "function() Snacks.picker.lsp_type_definitions() end";
|
|
options.desc = "Goto T[y]pe Definition";
|
|
}
|
|
# Notifications and highlights
|
|
{
|
|
key = "<leader>on";
|
|
action.__raw = "function() Snacks.notifier.show_history() end";
|
|
options.desc = "Open notification history";
|
|
}
|
|
{
|
|
key = "<leader>oh";
|
|
action.__raw = "function() Snacks.picker.highlights() end";
|
|
options.desc = "List highlights";
|
|
}
|
|
{
|
|
key = "<leader>n";
|
|
action = "<cmd>Oil<cr>";
|
|
options.desc = "Opens file explorer";
|
|
}
|
|
];
|
|
};
|
|
}
|