234 lines
5.4 KiB
Nix
234 lines
5.4 KiB
Nix
{ pkgs, ... }:
|
|
{
|
|
programs.nixvim = {
|
|
extraPackages = with pkgs; [
|
|
ripgrep
|
|
fd
|
|
plocate
|
|
glow
|
|
];
|
|
plugins = {
|
|
aerial.enable = true;
|
|
neoclip.enable = true;
|
|
telescope = {
|
|
enable = true;
|
|
extensions = {
|
|
fzf-native.enable = true;
|
|
file-browser = {
|
|
enable = true;
|
|
settings = {
|
|
hijack_netrw = false;
|
|
grouped = true;
|
|
hidden = true;
|
|
};
|
|
};
|
|
project = {
|
|
enable = true;
|
|
settings = {
|
|
base_dirs = [
|
|
{
|
|
path = "~/Projects";
|
|
max_depth = 3;
|
|
}
|
|
{
|
|
path = "/etc/nixos";
|
|
max_depth = 1;
|
|
}
|
|
];
|
|
};
|
|
};
|
|
};
|
|
settings = {
|
|
defaults = {
|
|
prompt_prefix = "🔍";
|
|
layout_config = {
|
|
prompt_position = "bottom";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
# https://github.com/nvim-telescope/telescope.nvim/issues/2806#issuecomment-1904877188
|
|
autoGroups.find_files_hijack_netrw.clear = true;
|
|
autoCmd = [
|
|
{
|
|
event = "VimEnter";
|
|
pattern = "*";
|
|
once = true;
|
|
callback.__raw = # lua
|
|
''
|
|
function()
|
|
pcall(vim.api.nvim_clear_autocmds, { group = "FileExplorer" })
|
|
end
|
|
'';
|
|
}
|
|
{
|
|
event = "BufEnter";
|
|
group = "find_files_hijack_netrw";
|
|
pattern = "*";
|
|
callback.__raw = # lua
|
|
''
|
|
function()
|
|
vim.schedule(function()
|
|
-- Early return if netrw or not a directory
|
|
if vim.bo[0].filetype == "netrw" or vim.fn.isdirectory(vim.fn.expand("%:p")) == 0 then
|
|
return
|
|
end
|
|
|
|
vim.api.nvim_buf_set_option(0, "bufhidden", "wipe")
|
|
|
|
require("telescope.builtin").find_files({
|
|
cwd = vim.fn.expand("%:p:h"),
|
|
find_command = {
|
|
"rg",
|
|
"--ignore",
|
|
"--hidden",
|
|
"--files",
|
|
"--glob=!.git/",
|
|
},
|
|
})
|
|
end)
|
|
end
|
|
'';
|
|
}
|
|
];
|
|
keymaps = [
|
|
{
|
|
mode = "n";
|
|
key = "<leader>tf";
|
|
action = "<CMD>Telescope find_files find_command=rg,--ignore,--hidden,--files,--glob=!.git/<CR>";
|
|
options = {
|
|
desc = "Find Files";
|
|
silent = true;
|
|
};
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<leader>te";
|
|
action = "<CMD>Telescope file_browser path=%:p:h select_buffer=true<CR>";
|
|
options = {
|
|
desc = "File Explorer";
|
|
silent = true;
|
|
};
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<leader>tr";
|
|
action = "<CMD>Telescope live_grep<CR>";
|
|
options = {
|
|
desc = "Live Grep";
|
|
silent = true;
|
|
};
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<leader>ta";
|
|
action = "<CMD>Telescope aerial<CR>";
|
|
options = {
|
|
desc = "Aerial";
|
|
silent = true;
|
|
};
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<leader>tb";
|
|
action = "<CMD>Telescope buffers<CR>";
|
|
options = {
|
|
desc = "Buffers";
|
|
silent = true;
|
|
};
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<leader>tt";
|
|
action = "<CMD>Telescope colorscheme<CR>";
|
|
options = {
|
|
desc = "Color Schemes";
|
|
silent = true;
|
|
};
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<leader>tk";
|
|
action = "<CMD>Telescope keymaps<CR>";
|
|
options = {
|
|
desc = "Keymaps";
|
|
silent = true;
|
|
};
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<leader>tp";
|
|
action = "<CMD>Telescope project display_type=full hide_workspace=true<CR>";
|
|
options = {
|
|
desc = "Projects";
|
|
silent = true;
|
|
};
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<leader>tc";
|
|
action = "<CMD>Telescope commands<CR>";
|
|
options = {
|
|
desc = "Commands";
|
|
silent = true;
|
|
};
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<leader>tm";
|
|
action = "<CMD>Telescope man_pages<CR>";
|
|
options = {
|
|
desc = "Man Pages";
|
|
silent = true;
|
|
};
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<leader>tn";
|
|
action = "<CMD>Telescope vim_options<CR>";
|
|
options = {
|
|
desc = "Vim Options";
|
|
silent = true;
|
|
};
|
|
}
|
|
# Git
|
|
{
|
|
mode = "n";
|
|
key = "<leader>tgc";
|
|
action = "<CMD>Telescope git_commits<CR>";
|
|
options = {
|
|
desc = "Git Commits";
|
|
silent = true;
|
|
};
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<leader>tgb";
|
|
action = "<CMD>Telescope git_branches<CR>";
|
|
options = {
|
|
desc = "Git Branches";
|
|
silent = true;
|
|
};
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<leader>tgs";
|
|
action = "<CMD>Telescope git_status<CR>";
|
|
options = {
|
|
desc = "Git Status";
|
|
silent = true;
|
|
};
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<leader>tgS";
|
|
action = "<CMD>Telescope git_stash<CR>";
|
|
options = {
|
|
desc = "Git Stash";
|
|
silent = true;
|
|
};
|
|
}
|
|
];
|
|
};
|
|
}
|