mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-30 00:26:45 +00:00
feat:32;2uadd telescope keybindings
This commit is contained in:
parent
1b1743dc5a
commit
eb8c841b4a
2 changed files with 55 additions and 37 deletions
|
@ -7,47 +7,45 @@
|
||||||
with lib;
|
with lib;
|
||||||
with builtins; let
|
with builtins; let
|
||||||
cfg = config.vim.telescope;
|
cfg = config.vim.telescope;
|
||||||
|
self = import ./telescope.nix {inherit lib;};
|
||||||
|
mappingDefinitions = self.options.vim.telescope.mappings;
|
||||||
|
|
||||||
|
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable) {
|
config = mkIf (cfg.enable) {
|
||||||
vim.startPlugins = [
|
vim.startPlugins = [
|
||||||
"telescope"
|
"telescope"
|
||||||
];
|
];
|
||||||
|
|
||||||
vim.maps.normal =
|
vim.maps.normal = mkMerge [
|
||||||
{
|
(mkSetBinding mappings.findFiles "<cmd> Telescope find_files<CR>")
|
||||||
"<leader>ff" = {action = "<cmd> Telescope find_files<CR>";};
|
(mkSetBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>")
|
||||||
"<leader>fg" = {action = "<cmd> Telescope live_grep<CR>";};
|
(mkSetBinding mappings.buffers "<cmd> Telescope buffers<CR>")
|
||||||
"<leader>fb" = {action = "<cmd> Telescope buffers<CR>";};
|
(mkSetBinding mappings.helpTags "<cmd> Telescope help_tags<CR>")
|
||||||
"<leader>fh" = {action = "<cmd> Telescope help_tags<CR>";};
|
(mkSetBinding mappings.open "<cmd> Telescope<CR>")
|
||||||
"<leader>ft" = {action = "<cmd> Telescope<CR>";};
|
|
||||||
|
|
||||||
"<leader>fvcw" = {action = "<cmd> Telescope git_commits<CR>";};
|
(mkSetBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>")
|
||||||
"<leader>fvcb" = {action = "<cmd> Telescope git_bcommits<CR>";};
|
(mkSetBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>")
|
||||||
"<leader>fvb" = {action = "<cmd> Telescope git_branches<CR>";};
|
(mkSetBinding mappings.gitBranches "<cmd> Telescope git_branches<CR>")
|
||||||
"<leader>fvs" = {action = "<cmd> Telescope git_status<CR>";};
|
(mkSetBinding mappings.gitStatus "<cmd> Telescope git_status<CR>")
|
||||||
"<leader>fvx" = {action = "<cmd> Telescope git_stash<CR>";};
|
(mkSetBinding mappings.gitStash "<cmd> Telescope git_stash<CR>")
|
||||||
}
|
|
||||||
// (
|
|
||||||
if config.vim.lsp.enable
|
|
||||||
then {
|
|
||||||
"<leader>flsb" = {action = "<cmd> Telescope lsp_document_symbols<CR>";};
|
|
||||||
"<leader>flsw" = {action = "<cmd> Telescope lsp_workspace_symbols<CR>";};
|
|
||||||
|
|
||||||
"<leader>flr" = {action = "<cmd> Telescope lsp_references<CR>";};
|
(mkIf config.vim.lsp.enable (mkMerge [
|
||||||
"<leader>fli" = {action = "<cmd> Telescope lsp_implementations<CR>";};
|
(mkSetBinding mappings.lspDocumentSymbols "<cmd> Telescope lsp_document_symbols<CR>")
|
||||||
"<leader>flD" = {action = "<cmd> Telescope lsp_definitions<CR>";};
|
(mkSetBinding mappings.lspWorkspaceSymbols "<cmd> Telescope lsp_workspace_symbols<CR>")
|
||||||
"<leader>flt" = {action = "<cmd> Telescope lsp_type_definitions<CR>";};
|
|
||||||
"<leader>fld" = {action = "<cmd> Telescope diagnostics<CR>";};
|
(mkSetBinding mappings.lspReferences "<cmd> Telescope lsp_references<CR>")
|
||||||
}
|
(mkSetBinding mappings.lspImplementations "<cmd> Telescope lsp_implementations<CR>")
|
||||||
else {}
|
(mkSetBinding mappings.lspDefinitions "<cmd> Telescope lsp_definitions<CR>")
|
||||||
|
(mkSetBinding mappings.lspTypeDefinitions "<cmd> Telescope lsp_type_definitions<CR>")
|
||||||
|
(mkSetBinding mappings.diagnostics "<cmd> Telescope diagnostics<CR>")
|
||||||
|
]))
|
||||||
|
|
||||||
|
(
|
||||||
|
mkIf config.vim.treesitter.enable
|
||||||
|
(mkSetBinding mappings.treesitter "<cmd> Telescope treesitter<CR>")
|
||||||
)
|
)
|
||||||
// (
|
];
|
||||||
if config.vim.treesitter.enable
|
|
||||||
then {
|
|
||||||
"<leader>fs" = {action = "<cmd> Telescope treesitter<CR>";};
|
|
||||||
}
|
|
||||||
else {}
|
|
||||||
);
|
|
||||||
|
|
||||||
vim.luaConfigRC.telescope = nvim.dag.entryAnywhere ''
|
vim.luaConfigRC.telescope = nvim.dag.entryAnywhere ''
|
||||||
local telescope = require('telescope')
|
local telescope = require('telescope')
|
||||||
|
|
|
@ -1,11 +1,31 @@
|
||||||
{
|
{lib, ...}:
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
with lib;
|
with lib;
|
||||||
with builtins; {
|
with builtins; {
|
||||||
options.vim.telescope = {
|
options.vim.telescope = {
|
||||||
|
mappings = {
|
||||||
|
findFiles = mkMappingOption "Find files [Telescope]" "<leader>ff";
|
||||||
|
liveGrep = mkMappingOption "Live grep [Telescope]" "<leader>fg";
|
||||||
|
buffers = mkMappingOption "Buffers [Telescope]" "<leader>fb";
|
||||||
|
helpTags = mkMappingOption "Help tags [Telescope]" "<leader>fh";
|
||||||
|
open = mkMappingOption "Open [Telescope]" "<leader>ft";
|
||||||
|
|
||||||
|
gitCommits = mkMappingOption "Git commits [Telescope]" "<leader>fvcw";
|
||||||
|
gitBufferCommits = mkMappingOption "Git buffer commits [Telescope]" "<leader>fvcb";
|
||||||
|
gitBranches = mkMappingOption "Git branches [Telescope]" "<leader>fvb";
|
||||||
|
gitStatus = mkMappingOption "Git status [Telescope]" "<leader>fvs";
|
||||||
|
gitStash = mkMappingOption "Git stash [Telescope]" "<leader>fvx";
|
||||||
|
|
||||||
|
lspDocumentSymbols = mkMappingOption "LSP Document Symbols [Telescope]" "<leader>flsb";
|
||||||
|
lspWorkspaceSymbols = mkMappingOption "LSP Workspace Symbols [Telescope]" "<leader>flsw";
|
||||||
|
lspReferences = mkMappingOption "LSP References [Telescope]" "<leader>flr";
|
||||||
|
lspImplementations = mkMappingOption "LSP Implementations [Telescope]" "<leader>fli";
|
||||||
|
lspDefinitions = mkMappingOption "LSP Definitions [Telescope]" "<leader>flD";
|
||||||
|
lspTypeDefinitions = mkMappingOption "LSP Type Definitions [Telescope]" "<leader>flt";
|
||||||
|
diagnostics = mkMappingOption "Diagnostics [Telescope]" "<leader>fld";
|
||||||
|
|
||||||
|
treesitter = mkMappingOption "Treesitter [Telescope]" "<leader>fs";
|
||||||
|
};
|
||||||
|
|
||||||
enable = mkEnableOption "Enable multi-purpose telescope utility";
|
enable = mkEnableOption "Enable multi-purpose telescope utility";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue