nixvim-config/plugins/fzf-lua.nix

78 lines
2.8 KiB
Nix
Raw Permalink Normal View History

{ pkgs, ... }:
{
programs.nixvim = {
plugins.fzf-lua = {
enable = true;
# profile = "telescope";
settings = {
oldfiles = {
# In Telescope, when I used <leader>fr, it would load old buffers.
# fzf lua does the same, but by default buffers visited in the current
# session are not included. I use <leader>fr all the time to switch
# back to buffers I was just in. If you missed this from Telescope,
# give it a try.
include_current_session = true;
};
preview = {
vertical = "down:90%";
horizontal = "right:90%";
};
previewers = {
builtin = {
# fzf-lua is very fast, but it really struggled to preview a couple files
# in a repo. Those files were very big JavaScript files (1MB, minified, all on a single line).
# It turns out it was Treesitter having trouble parsing the files.
# With this change, the previewer will not add syntax highlighting to files larger than 100KB
# (Yes, I know you shouldn't have 100KB minified files in source control.)
syntax_limit_b = 1024 * 100; # 100KB
};
};
grep = {
# One thing I missed from Telescope was the ability to live_grep and the
# run a filter on the filenames.
# Ex: Find all occurrences of "enable" but only in the "plugins" directory.
# With this change, I can sort of get the same behaviour in live_grep.
# ex: > enable --*/plugins/*
# I still find this a bit cumbersome. There's probably a better way of doing this.
rg_glob = true; # enable glob parsing
glob_flag = "--iglob"; # case insensitive globs
glob_separator = "%s%-%-"; # query separator pattern (lua): ' --'
};
};
keymaps = {
"<C-p>" = {
action = "git_files";
options = {
desc = "Fzf-Lua Git Files";
silent = true;
};
settings = {
previewers = {
cat = {
cmd = "${pkgs.coreutils-full}/bin/cat";
};
};
# winopts = {
# height = 0.5;
# };
};
};
# "<C-s>" = "live_grep";
# "<C-_>" = "oldfiles";
# "<leader>fd" = "lsp_definitions";
# "<leader>fg" = "live_grep";
# "<leader>fh" = "helptags";
# "<leader>fi" = "lsp_incoming_calls";
# "<leader>fm" = "manpages";
# "<leader>fo" = "lsp_outgoing_calls";
# "<leader>fp" = "oldfiles";
# "<leader>fr" = "lsp_references";
# "<leader>fs" = "spell_suggest";
# "<leader>fw" = "lsp_workspace_symbols";
# "<leader>db" = "buffers";
# "<leader>ch" = "command_history";
};
};
};
}