nixvim-config/plugins/telescope.nix

191 lines
6 KiB
Nix
Raw Normal View History

{ ... }:
{
programs.nixvim = {
keymaps = [
## Lists files in your current working directory, respects .gitignore
{
mode = [ "n" ];
key = "<leader>ff";
action = "<cmd>Telescope find_files<cr>";
options = { noremap = true; };
}
## Finds files by filename
{
mode = [ "n" ];
key = "<c-p>";
action = "<cmd>Telescope find_files<cr>";
# action = "<cmd>FzfLua files<cr>";
options = { noremap = true; };
}
# Search for a string in your current working directory and get results live as you type, respects .gitignore. (Requires ripgrep)
{
mode = [ "n" ];
key = "<leader>fg";
action = "<cmd>Telescope live_grep<cr>";
# action = "<cmd>FzfLua live_grep<cr>";
options = { noremap = true; };
}
# Search file contents
{
mode = [ "n" ];
key = "<c-s>";
action = "<cmd>Telescope live_grep<cr>";
# action = "<cmd>FzfLua live_grep<cr>";
options = { noremap = true; };
}
# Lists open buffers in current neovim instance
{
mode = [ "n" ];
key = "<leader>db";
action = "<cmd>Telescope buffers<cr>";
# action = "<cmd>FzfLua buffers<cr>";
options = { noremap = true; };
}
# Lists available help tags and opens a new window with the relevant help info on <cr>
{
mode = [ "n" ];
key = "<leader>fh";
action = "<cmd>Telescope help_tags<cr>";
# action = "<cmd>FzfLua helptags<cr>";
options = { noremap = true; };
}
# Lists manpage entries, opens them in a help window on <cr>
{
mode = [ "n" ];
key = "<leader>fm";
action = "<cmd>Telescope man_pages<cr>";
# action = "<cmd>FzfLua manpages<cr>";
options = { noremap = true; };
}
# Lists previously open files
{
mode = [ "n" ];
key = "<leader>fp";
action = "<cmd>Telescope oldfiles<cr>";
# action = "<cmd>FzfLua oldfiles<cr>";
options = { noremap = true; };
}
# Lists previously open files, Maps to ctrl-/
{
mode = [ "n" ];
key = "<c-_>";
action = "<cmd>Telescope oldfiles<cr>";
# action = "<cmd>FzfLua oldfiles<cr>";
options = { noremap = true; };
}
## Binding currently used by nvim-tree
## Lists spelling suggestions for the current word under the cursor, replaces word with selected suggestion on <cr>
# {
# mode = [ "n" ];
# key = "<leader>fs";
# action = "<cmd>Telescope spell_suggest<cr>";
# # action = "<cmd>FzfLua spell_suggest<cr>";
# options = { noremap = true; };
# }
# Lists LSP references for iword under the cursor
{
mode = [ "n" ];
key = "<leader>fr";
action = "<cmd>Telescope lsp_references<cr>";
# action = "<cmd>FzfLua lsp_references<cr>";
options = { noremap = true; };
}
# Lists LSP incoming calls for word under the cursor
{
mode = [ "n" ];
key = "<leader>fi";
action = "<cmd>Telescope lsp_incoming_calls<cr>";
# action = "<cmd>FzfLua lsp_incoming_calls<cr>";
options = { noremap = true; };
}
# Lists LSP outgoing calls for word under the cursor
{
mode = [ "n" ];
key = "<leader>fo";
action = "<cmd>Telescope lsp_outgoing_calls<cr>";
# action = "<cmd>FzfLua lsp_outgoing_calls<cr>";
options = { noremap = true; };
}
# Dynamically Lists LSP for all workspace symbols
{
mode = [ "n" ];
key = "<leader>fw";
action = "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>";
# action = "<cmd>FzfLua lsp_workspace_symbols<cr>";
options = { noremap = true; };
}
# Goto the definition of the word under the cursor, if there's only one, otherwise show all options in Telescope
{
mode = [ "n" ];
key = "<leader>fd";
action = "<cmd>Telescope lsp_definitions<cr>";
options = { noremap = true; };
}
# Got to previous error
{
mode = [ "n" ];
key = "[d";
action = "<cmd>lua vim.diagnostic.goto_prev()<CR>";
options = { noremap = true; silent = true; };
}
{
mode = [ "n" ];
key = ",k";
action = "<cmd>lua vim.diagnostic.goto_prev()<CR>";
options = { noremap = true; silent = true; };
}
# Got to next error
{
mode = [ "n" ];
key = "]d";
action = "<cmd>lua vim.diagnostic.goto_next()<CR>";
options = { noremap = true; silent = true; };
}
{
mode = [ "n" ];
key = ",j";
action = "<cmd>lua vim.diagnostic.goto_next()<CR>";
options = { noremap = true; silent = true; };
}
## Other Telescope options:
## git_files search only files in git, respects .gitignore
## oldfiles previously opened files
## command_history
## search_history
## man_pages
## resume lists the results including multi-selections of the previous
## picker
];
plugins.telescope = {
enable = true;
extensions.ui-select.enable = true;
settings = {
defaults = {
mappings = {
i = {
# One instead of two esc taps to exit telescope
"<esc>" = {
__raw = "require('telescope.actions').close";
};
# Ctrl-space is used by Tmux, so remap to Ctrl-e
"<c-e>" = {
__raw = "require('telescope.actions').to_fuzzy_refine";
};
"<c-o>" = {
__raw = "require('trouble.sources.telescope').open";
};
};
n = {
"<c-o>" = {
__raw = "require('trouble.sources.telescope').open";
};
};
};
};
};
};
};
}