mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-12-22 13:37:36 +00:00
Use my keymap functions instead of whichkey for telescope
This commit is contained in:
parent
a616e2e14c
commit
963cc8bb6a
@ -20,53 +20,38 @@ local function config_telescope()
|
||||
layout_strategy = "flex",
|
||||
},
|
||||
})
|
||||
local utils = require("utils")
|
||||
utils.try_require("which-key", function(wk)
|
||||
wk.register({
|
||||
["<C-t>"] = { "<cmd>lua require('telescope.builtin').find_files()<CR>", "Find files" },
|
||||
})
|
||||
wk.register({
|
||||
b = { "<cmd>lua require('telescope.builtin').buffers()<CR>", "Find buffers" },
|
||||
t = { "<cmd>lua require('telescope.builtin').current_buffer_tags()<CR>", "Find buffer tags" },
|
||||
["*"] = { "<cmd>lua require('telescope.builtin').grep_string()<CR>", "Find buffers" },
|
||||
f = {
|
||||
b = { "<cmd>lua require('telescope.builtin').buffers()<CR>", "Find buffers" },
|
||||
f = { "<cmd>lua require('telescope.builtin').find_files()<CR>", "Find file" },
|
||||
g = { "<cmd>lua require('telescope.builtin').live_grep()<CR>", "Live grep" },
|
||||
h = { "<cmd>lua require('telescope.builtin').help_tags()<CR>", "Find help tags" },
|
||||
l = { "<cmd>lua require('telescope.builtin').resume()<CR>", "Resume finding" },
|
||||
t = { "<cmd>lua require('telescope.builtin').current_buffer_tags()<CR>", "Find buffer tags" },
|
||||
T = { "<cmd>lua require('telescope.builtin').tags()<CR>", "Find tags" },
|
||||
},
|
||||
}, {
|
||||
prefix = "<leader>",
|
||||
})
|
||||
end, function()
|
||||
local opts = { silent = true, noremap = true }
|
||||
vim.api.nvim_set_keymap("n", "<C-t>", "<cmd>lua require('telescope.builtin').find_files()<CR>", opts)
|
||||
vim.api.nvim_set_keymap("n", "<leader>ff", "<cmd>lua require('telescope.builtin').find_files()<CR>", opts)
|
||||
vim.api.nvim_set_keymap("n", "<leader>fl", "<cmd>lua require('telescope.builtin').resume()<CR>", opts)
|
||||
vim.api.nvim_set_keymap("n", "<leader>fh", "<cmd>lua require('telescope.builtin').help_tags()<CR>", opts)
|
||||
vim.api.nvim_set_keymap("n", "<leader>b", "<cmd>lua require('telescope.builtin').buffers()<CR>", opts)
|
||||
vim.api.nvim_set_keymap("n", "<leader>fb", "<cmd>lua require('telescope.builtin').buffers()<CR>", opts)
|
||||
vim.api.nvim_set_keymap(
|
||||
"n",
|
||||
"<leader>t",
|
||||
"<cmd>lua require('telescope.builtin').current_buffer_tags()<CR>",
|
||||
opts
|
||||
)
|
||||
vim.api.nvim_set_keymap("n", "<leader>ft", "<cmd>lua require('telescope.builtin').tags()<CR>", opts)
|
||||
vim.api.nvim_set_keymap("n", "<leader>fg", "<cmd>lua require('telescope.builtin').live_grep()<CR>", opts)
|
||||
vim.api.nvim_set_keymap("n", "<leader>*", "<cmd>lua require('telescope.builtin').grep_string()<CR>", opts)
|
||||
|
||||
-- Better spelling replacement for word under cursor
|
||||
vim.api.nvim_set_keymap(
|
||||
"n",
|
||||
"<leader>s",
|
||||
"<cmd>lua require('telescope.builtin').spell_suggest(require('telescope.themes').get_cursor())<CR>",
|
||||
opts
|
||||
)
|
||||
end)
|
||||
local utils = require("utils")
|
||||
utils.keymap_set("n", "<C-t>", "<cmd>lua require('telescope.builtin').find_files()<CR>", { desc = "Find files" })
|
||||
utils.keymap_set("n", "<leader>b", "<cmd>lua require('telescope.builtin').buffers()<CR>", { desc = "Find buffers" })
|
||||
utils.keymap_set(
|
||||
"n",
|
||||
"<leader>t",
|
||||
"<cmd>lua require('telescope.builtin').current_buffer_tags()<CR>",
|
||||
{ desc = "Find buffer tags" }
|
||||
)
|
||||
utils.keymap_set(
|
||||
"n",
|
||||
"<leader>*",
|
||||
"<cmd>lua require('telescope.builtin').grep_string()<CR>",
|
||||
{ desc = "Find string under cursor" }
|
||||
)
|
||||
-- Better spelling replacement for word under cursor
|
||||
utils.keymap_set(
|
||||
"n",
|
||||
"<leader>s",
|
||||
"<cmd>lua require('telescope.builtin').spell_suggest(require('telescope.themes').get_cursor())<CR>",
|
||||
{ desc = "Spell check" }
|
||||
)
|
||||
|
||||
local finder_keymap = utils.curry_keymap("n", "<leader>f")
|
||||
finder_keymap("b", "<cmd>lua require('telescope.builtin').buffers()<CR>", { desc = "Find buffers" })
|
||||
finder_keymap("f", "<cmd>lua require('telescope.builtin').find_files()<CR>", { desc = "Find file" })
|
||||
finder_keymap("g", "<cmd>lua require('telescope.builtin').live_grep()<CR>", { desc = "Live grep" })
|
||||
finder_keymap("h", "<cmd>lua require('telescope.builtin').help_tags()<CR>", { desc = "Find help tags" })
|
||||
finder_keymap("l", "<cmd>lua require('telescope.builtin').resume()<CR>", { desc = "Resume finding" })
|
||||
finder_keymap("t", "<cmd>lua require('telescope.builtin').current_buffer_tags()<CR>", { desc = "Find buffer tags" })
|
||||
finder_keymap("T", "<cmd>lua require('telescope.builtin').tags()<CR>", { desc = "Find tags" })
|
||||
|
||||
load_extensions()
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user