79 lines
1.8 KiB
Nix
79 lines
1.8 KiB
Nix
{ ... }:
|
|
{
|
|
programs.nixvim = {
|
|
|
|
extraFiles = {
|
|
"lua/treeutils.lua" = {
|
|
source = ./treeutils.lua;
|
|
};
|
|
};
|
|
|
|
extraConfigLua = ''
|
|
function _G.launch_find_files_wrapped()
|
|
-- Try custom function first
|
|
local handled = require('treeutils').launch_find_files()
|
|
|
|
if handled == "default" then
|
|
-- If custom function didn't handle it, execute default behavior
|
|
local default_key = vim.api.nvim_replace_termcodes('<c-f>', true, true, true)
|
|
vim.api.nvim_feedkeys(default_key, 'n', false)
|
|
end
|
|
end
|
|
'';
|
|
|
|
keymaps = [
|
|
## Go to current buffer's file in nvim-tree
|
|
{
|
|
mode = [ "n" ];
|
|
key = ",n";
|
|
action = ":NvimTreeFindFile<CR>";
|
|
}
|
|
## Toggle nvim-tree visibility
|
|
{
|
|
mode = [ "n" ];
|
|
key = ",m";
|
|
action = ":NvimTreeToggle<CR>";
|
|
}
|
|
## Search current path
|
|
{
|
|
mode = [ "n" ];
|
|
key = "<c-f>";
|
|
action = "<cmd>lua launch_find_files_wrapped()<CR>";
|
|
options = { noremap = true; };
|
|
}
|
|
{
|
|
mode = [ "n" ];
|
|
key = "<c-g>";
|
|
action = "<cmd>lua require('treeutils').launch_live_grep()<CR>";
|
|
options = { noremap = true; };
|
|
}
|
|
];
|
|
|
|
plugins.nvim-tree = {
|
|
enable = true;
|
|
actions = {
|
|
removeFile = {
|
|
closeWindow = false;
|
|
};
|
|
};
|
|
## Keep tree open if already open when opening a tab
|
|
tab = {
|
|
sync = {
|
|
open = true;
|
|
close = true;
|
|
};
|
|
};
|
|
view = {
|
|
width = 30;
|
|
};
|
|
renderer = {
|
|
groupEmpty = true;
|
|
};
|
|
git = {
|
|
enable = true;
|
|
ignore = false;
|
|
timeout = 500;
|
|
};
|
|
};
|
|
};
|
|
}
|