mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-19 08:39:50 +01:00
telescope: switch to simpler keybind helper
This commit is contained in:
parent
c129c53685
commit
fed9f348c2
1 changed files with 27 additions and 32 deletions
|
@ -5,15 +5,14 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.binds) addDescriptionsToMappings;
|
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.lists) optionals;
|
inherit (lib.lists) optionals;
|
||||||
inherit (lib.nvim.binds) pushDownDefault mkSetLznBinding;
|
inherit (lib.nvim.binds) pushDownDefault mkKeymap;
|
||||||
|
|
||||||
cfg = config.vim.telescope;
|
cfg = config.vim.telescope;
|
||||||
mappingDefinitions = options.vim.telescope.mappings;
|
|
||||||
|
|
||||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
keys = cfg.mappings;
|
||||||
|
inherit (options.vim.telescope) mappings;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
|
@ -34,39 +33,35 @@ in {
|
||||||
|
|
||||||
keys =
|
keys =
|
||||||
[
|
[
|
||||||
(mkSetLznBinding "n" mappings.findFiles "<cmd>Telescope find_files<CR>")
|
(mkKeymap "n" keys.findFiles "<cmd>Telescope find_files<CR>" {desc = mappings.findFiles.description;})
|
||||||
(mkSetLznBinding "n" mappings.liveGrep "<cmd>Telescope live_grep<CR>")
|
(mkKeymap "n" keys.liveGrep "<cmd>Telescope live_grep<CR>" {desc = mappings.liveGrep.description;})
|
||||||
(mkSetLznBinding "n" mappings.buffers "<cmd>Telescope buffers<CR>")
|
(mkKeymap "n" keys.buffers "<cmd>Telescope buffers<CR>" {desc = mappings.buffers.description;})
|
||||||
(mkSetLznBinding "n" mappings.helpTags "<cmd>Telescope help_tags<CR>")
|
(mkKeymap "n" keys.helpTags "<cmd>Telescope help_tags<CR>" {desc = mappings.helpTags.description;})
|
||||||
(mkSetLznBinding "n" mappings.open "<cmd>Telescope<CR>")
|
(mkKeymap "n" keys.open "<cmd>Telescope<CR>" {desc = mappings.open.description;})
|
||||||
(mkSetLznBinding "n" mappings.resume "<cmd>Telescope resume<CR>")
|
(mkKeymap "n" keys.resume "<cmd>Telescope resume<CR>" {desc = mappings.resume.description;})
|
||||||
|
|
||||||
(mkSetLznBinding "n" mappings.gitCommits "<cmd>Telescope git_commits<CR>")
|
(mkKeymap "n" keys.gitCommits "<cmd>Telescope git_commits<CR>" {desc = mappings.gitCommits.description;})
|
||||||
(mkSetLznBinding "n" mappings.gitBufferCommits "<cmd>Telescope git_bcommits<CR>")
|
(mkKeymap "n" keys.gitBufferCommits "<cmd>Telescope git_bcommits<CR>" {desc = mappings.gitBufferCommits.description;})
|
||||||
(mkSetLznBinding "n" mappings.gitBranches "<cmd>Telescope git_branches<CR>")
|
(mkKeymap "n" keys.gitBranches "<cmd>Telescope git_branches<CR>" {desc = mappings.gitBranches.description;})
|
||||||
(mkSetLznBinding "n" mappings.gitStatus "<cmd>Telescope git_status<CR>")
|
(mkKeymap "n" keys.gitStatus "<cmd>Telescope git_status<CR>" {desc = mappings.gitStatus.description;})
|
||||||
(mkSetLznBinding "n" mappings.gitStash "<cmd>Telescope git_stash<CR>")
|
(mkKeymap "n" keys.gitStash "<cmd>Telescope git_stash<CR>" {desc = mappings.gitStash.description;})
|
||||||
]
|
]
|
||||||
++ (optionals config.vim.lsp.enable [
|
++ (optionals config.vim.lsp.enable [
|
||||||
(mkSetLznBinding "n" mappings.lspDocumentSymbols "<cmd>Telescope lsp_document_symbols<CR>")
|
(mkKeymap "n" keys.lspDocumentSymbols "<cmd>Telescope lsp_document_symbols<CR>" {desc = mappings.lspDocumentSymbols.description;})
|
||||||
(mkSetLznBinding "n" mappings.lspWorkspaceSymbols "<cmd>Telescope lsp_workspace_symbols<CR>")
|
(mkKeymap "n" keys.lspWorkspaceSymbols "<cmd>Telescope lsp_workspace_symbols<CR>" {desc = mappings.lspWorkspaceSymbols.description;})
|
||||||
|
|
||||||
(mkSetLznBinding "n" mappings.lspReferences "<cmd>Telescope lsp_references<CR>")
|
(mkKeymap "n" keys.lspReferences "<cmd>Telescope lsp_references<CR>" {desc = mappings.lspReferences.description;})
|
||||||
(mkSetLznBinding "n" mappings.lspImplementations "<cmd>Telescope lsp_implementations<CR>")
|
(mkKeymap "n" keys.lspImplementations "<cmd>Telescope lsp_implementations<CR>" {desc = mappings.lspImplementations.description;})
|
||||||
(mkSetLznBinding "n" mappings.lspDefinitions "<cmd>Telescope lsp_definitions<CR>")
|
(mkKeymap "n" keys.lspDefinitions "<cmd>Telescope lsp_definitions<CR>" {desc = mappings.lspDefinitions.description;})
|
||||||
(mkSetLznBinding "n" mappings.lspTypeDefinitions "<cmd>Telescope lsp_type_definitions<CR>")
|
(mkKeymap "n" keys.lspTypeDefinitions "<cmd>Telescope lsp_type_definitions<CR>" {desc = mappings.lspTypeDefinitions.description;})
|
||||||
(mkSetLznBinding "n" mappings.diagnostics "<cmd>Telescope diagnostics<CR>")
|
(mkKeymap "n" keys.diagnostics "<cmd>Telescope diagnostics<CR>" {desc = mappings.diagnostics.description;})
|
||||||
])
|
])
|
||||||
++ (
|
++ optionals config.vim.treesitter.enable [
|
||||||
optionals config.vim.treesitter.enable [
|
(mkKeymap "n" keys.treesitter "<cmd>Telescope treesitter<CR>" {desc = mappings.treesitter.description;})
|
||||||
(mkSetLznBinding "n" mappings.treesitter "<cmd>Telescope treesitter<CR>")
|
|
||||||
]
|
]
|
||||||
)
|
++ optionals config.vim.projects.project-nvim.enable [
|
||||||
++ (
|
(mkKeymap "n" keys.findProjects "<cmd>Telescope projects<CR>" {desc = mappings.findProjects.description;})
|
||||||
optionals config.vim.projects.project-nvim.enable [
|
];
|
||||||
(mkSetLznBinding "n" mappings.findProjects "<cmd>Telescope projects<CR>")
|
|
||||||
]
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
binds.whichKey.register = pushDownDefault {
|
binds.whichKey.register = pushDownDefault {
|
||||||
|
|
Loading…
Reference in a new issue