From 4a976f6df7248d3e3c11fbe6fc7d0cc5fa44cac4 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Thu, 10 Aug 2023 03:18:46 +0200 Subject: [PATCH] vim/telescope: move keymap --- config/nvim/lua/fschauen/keymap.lua | 46 ++++++++++++++++++ .../nvim/lua/fschauen/plugins/telescope.lua | 47 +------------------ config/nvim/lua/fschauen/telescope.lua | 2 - 3 files changed, 47 insertions(+), 48 deletions(-) diff --git a/config/nvim/lua/fschauen/keymap.lua b/config/nvim/lua/fschauen/keymap.lua index 3a23bcb..bdfcc87 100644 --- a/config/nvim/lua/fschauen/keymap.lua +++ b/config/nvim/lua/fschauen/keymap.lua @@ -2,6 +2,7 @@ local M = {} local diagnostic = require 'fschauen.diagnostic' local window = require 'fschauen.window' +local pickers = require('fschauen.telescope').pickers local toggle_number = function() vim.wo.number = not vim.wo.number @@ -91,6 +92,51 @@ local keymap = { { 'do', diagnostic.open_float }, { 'dh', diagnostic.hide }, + telescope = { + { 'fa', pickers.autocommands (' Autocommands' ), desc = ' [a]utocommands' }, + { 'fb', pickers.buffers (' Buffers' ), desc = ' [b]uffers' }, + { 'fB', 'Telescope file_browser' , desc = ' file [B]rowser' }, + { 'fc', pickers.colorscheme (' Colorschemes' ), desc = ' [c]olorschemes' }, + { 'fdd', pickers.diagnostics ('󰀪 Document Diagnostics' ), desc = ' [d]iagnostics [d]ocument' }, + { 'fdw', pickers.diagnostics ('󰀪 Workspace Diagnostics'), desc = ' [d]iagnostics [w]orkspace' }, + --'fe' + { 'ff', pickers.find_files (' Files' ), desc = ' [f]ind files' }, + { 'fF', pickers.all_files (' ALL files' ), desc = ' all [F]iles' }, + { 'fgr', pickers.live_grep (' Live grep' ), desc = ' Live [gr]ep' }, + { 'fgf', pickers.git_files (' Git files' ), desc = ' [g]it [f]iles' }, + { 'fgc', pickers.git_commits (' Commits' ), desc = ' [g]it [c]ommits' }, + { 'fh', pickers.here (' Current buffer' ), desc = ' [b]uffer [h]ere' }, + { 'fH', pickers.highlights ('󰌶 Highlights' ), desc = ' [H]ighlights' }, + --'fi' + { 'fj', pickers.jumplist (' Jumplist' ), desc = ' [j]umplist' }, + { 'fk', pickers.keymaps (' Keymaps' ), desc = ' [k]eymaps' }, + { 'fK', pickers.help_tags (' Help tags' ), desc = ' [K] help/documentation' }, + { 'fl', pickers.loclist (' Location list' ), desc = ' [l]ocation List' }, + { 'fm', pickers.man_pages (' Man pages' ), desc = ' [m]an pages' }, + --'fn' + { 'fo', pickers.vim_options (' Vim options' ), desc = ' vim [o]ptions' }, + --'fp' + { 'fq', pickers.quickfix (' Quickfix' ), desc = ' [q]uickfix' }, + { 'fr', pickers.lsp_references (' References' ), desc = ' [r]eferences' }, + { 'fR', pickers.registers ('󱓥 Registers' ), desc = ' [R]registers' }, + { 'fs', pickers.lsp_document_symbols ('󰫧 Document Symbols ' ), desc = ' lsp document [s]ymbols' }, + { 'fS', pickers.lsp_workspace_symbols ('󱄑 Workspace Symbols ' ), desc = ' lsp workspace [S]ymbols' }, + --'ft' used in todo-commenpickers + { 'fT', pickers.treesitter (' Treesitter symbols' ), desc = ' [T]reesitter Symbols' }, + --'fu' + --'fv' + { 'fw', pickers.selection (--[[dynamic]]) , desc = ' [w]word under cursor' }, + { 'fw', pickers.selection (--[[dynamic]]), 'v' , desc = ' visual [s]election' }, + --'fx' + --'fy' + { 'fz', pickers.spell_suggest ('󰓆 Spelling suggestions') , desc = ' [z] spell suggestions' }, + { 'f.', pickers.dotfiles (' Dotfiles' ) , desc = ' [.]dotfiles' }, + { 'f:', pickers.command_history (' Command history' ) , desc = ' [:]command history' }, + { 'f?', pickers.commands (' Commands' ) , desc = ' commands [?]' }, + { 'f/', pickers.search_history (' Search history' ) , desc = ' [/]search history' }, + { 'f', pickers.resume ('󰐎 Resume' ) , desc = ' Resume ' }, + }, + fugitive = { { 'gg', ':Git ' }, { 'gs', 'tab Git' }, diff --git a/config/nvim/lua/fschauen/plugins/telescope.lua b/config/nvim/lua/fschauen/plugins/telescope.lua index 3607a5b..10163a4 100644 --- a/config/nvim/lua/fschauen/plugins/telescope.lua +++ b/config/nvim/lua/fschauen/plugins/telescope.lua @@ -1,5 +1,3 @@ -local prefix = require('fschauen.telescope').prefix -local pickers = require('fschauen.telescope').pickers local actions = require('fschauen.telescope').actions local mappings = { @@ -29,6 +27,7 @@ return { }, lazy = true, cmd = 'Telescope', + keys = require('fschauen.keymap').telescope, opts = { defaults = { mappings = { @@ -75,50 +74,6 @@ return { }, }, }, - keys = { - { prefix .. 'a', pickers.autocommands (' Autocommands' ), { desc = ' [a]utocommands' }}, - { prefix .. 'b', pickers.buffers (' Buffers' ), { desc = ' [b]uffers' }}, - { prefix .. 'B', 'Telescope file_browser' , { desc = ' file [B]rowser' }}, - { prefix .. 'c', pickers.colorscheme (' Colorschemes' ), { desc = ' [c]olorschemes' }}, - { prefix .. 'dd', pickers.diagnostics ('󰀪 Document Diagnostics' ), { desc = ' [d]iagnostics [d]ocument' }}, - { prefix .. 'dw', pickers.diagnostics ('󰀪 Workspace Diagnostics'), { desc = ' [d]iagnostics [w]orkspace' }}, - -- 'e' - { prefix .. 'f', pickers.find_files (' Files' ), { desc = ' [f]ind files' }}, - { prefix .. 'F', pickers.all_files (' ALL files' ), { desc = ' all [F]iles' }}, - { prefix .. 'gr', pickers.live_grep (' Live grep' ), { desc = ' Live [gr]ep' }}, - { prefix .. 'gf', pickers.git_files (' Git files' ), { desc = ' [g]it [f]iles' }}, - { prefix .. 'gc', pickers.git_commits (' Commits' ), { desc = ' [g]it [c]ommits' }}, - { prefix .. 'h', pickers.here (' Current buffer' ), { desc = ' [b]uffer [h]ere' }}, - { prefix .. 'H', pickers.highlights ('󰌶 Highlights' ), { desc = ' [H]ighlights' }}, - -- 'i' - { prefix .. 'j', pickers.jumplist (' Jumplist' ), { desc = ' [j]umplist' }}, - { prefix .. 'k', pickers.keymaps (' Keymaps' ), { desc = ' [k]eymaps' }}, - { prefix .. 'K', pickers.help_tags (' Help tags' ), { desc = ' [K] help/documentation' }}, - { prefix .. 'l', pickers.loclist (' Location list' ), { desc = ' [l]ocation List' }}, - { prefix .. 'm', pickers.man_pages (' Man pages' ), { desc = ' [m]an pages' }}, - -- 'n' - { prefix .. 'o', pickers.vim_options (' Vim options' ), { desc = ' vim [o]ptions' }}, - -- 'p' - { prefix .. 'q', pickers.quickfix (' Quickfix' ), { desc = ' [q]uickfix' }}, - { prefix .. 'r', pickers.lsp_references (' References' ), { desc = ' [r]eferences' }}, - { prefix .. 'R', pickers.registers ('󱓥 Registers' ), { desc = ' [R]registers' }}, - { prefix .. 's', pickers.lsp_document_symbols ('󰫧 Document Symbols ' ), { desc = ' lsp document [s]ymbols' }}, - { prefix .. 'S', pickers.lsp_workspace_symbols ('󱄑 Workspace Symbols ' ), { desc = ' lsp workspace [S]ymbols' }}, - -- 't' used in todo-commenpickers - { prefix .. 'T', pickers.treesitter (' Treesitter symbols' ), { desc = ' [T]reesitter Symbols' }}, - -- 'u' - -- 'v' - { prefix .. 'w', pickers.selection (--[[dynamic]]) , { desc = ' [w]word under cursor' }}, - { prefix .. 'w', pickers.selection (--[[dynamic]]), mode = 'v' , { desc = ' visual [s]election' }}, - -- 'x' - -- 'y' - { prefix .. 'z', pickers.spell_suggest ('󰓆 Spelling suggestions') , { desc = ' [z] spell suggestions' }}, - { prefix .. '.', pickers.dotfiles (' Dotfiles' ) , { desc = ' [.]dotfiles' }}, - { prefix .. ':', pickers.command_history (' Command history' ) , { desc = ' [:]command history' }}, - { prefix .. '?', pickers.commands (' Commands' ) , { desc = ' commands [?]' }}, - { prefix .. '/', pickers.search_history (' Search history' ) , { desc = ' [/]search history' }}, - { prefix .. '', pickers.resume ('󰐎 Resume' ) , { desc = ' Resume ' }}, - }, config = function(_, opts) require('telescope').setup(opts) require('telescope').load_extension 'fzf' diff --git a/config/nvim/lua/fschauen/telescope.lua b/config/nvim/lua/fschauen/telescope.lua index b57ff3f..625dd0b 100644 --- a/config/nvim/lua/fschauen/telescope.lua +++ b/config/nvim/lua/fschauen/telescope.lua @@ -1,7 +1,5 @@ M = {} -M.prefix = 'f' - local builtin = function() return require('telescope.builtin') end local actions = function() return require('telescope.actions') end local layout = function() return require('telescope.actions.layout') end