Browse Source

feat: modify telescope keybinds

master
Tovi Jaeschke-Rogers 7 months ago
parent
commit
6eab3c05b7
2 changed files with 42 additions and 31 deletions
  1. +7
    -8
      .config/nvim/lua/tovi/plugins/dashboard.lua
  2. +35
    -23
      .config/nvim/lua/tovi/plugins/telescope.lua

+ 7
- 8
.config/nvim/lua/tovi/plugins/dashboard.lua View File

@ -9,7 +9,12 @@ return {
enable = true, enable = true,
}, },
shortcut = { shortcut = {
{ desc = '󰊳 Update', group = '@property', action = 'Lazy update', key = 'u' },
{
desc = '󰊳 Update',
group = '@property',
action = 'Lazy update',
key = 'u'
},
{ {
icon = '', icon = '',
icon_hl = '@variable', icon_hl = '@variable',
@ -18,16 +23,10 @@ return {
action = 'Telescope find_files', action = 'Telescope find_files',
key = 'f', key = 'f',
}, },
{
desc = ' Apps',
group = 'DiagnosticHint',
action = 'Telescope app',
key = 'a',
},
{ {
desc = ' dotfiles', desc = ' dotfiles',
group = 'Number', group = 'Number',
action = 'Telescope dotfiles',
action = 'TelescopeDotfiles',
key = 'd', key = 'd',
}, },
}, },


+ 35
- 23
.config/nvim/lua/tovi/plugins/telescope.lua View File

@ -5,6 +5,7 @@ return {
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, { "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
"debugloop/telescope-undo.nvim", "debugloop/telescope-undo.nvim",
"nvim-telescope/telescope-ui-select.nvim",
}, },
config = function() config = function()
local telescope = require("telescope") local telescope = require("telescope")
@ -62,9 +63,9 @@ return {
mappings = { mappings = {
i = { i = {
["<C-k>"] = actions.move_selection_previous, -- move to prev result
["<C-j>"] = actions.move_selection_next, -- move to next result
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["<C-k>"] = actions.move_selection_previous,
["<C-j>"] = actions.move_selection_next,
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
}, },
}, },
}, },
@ -83,11 +84,15 @@ return {
}, },
}, },
}, },
["ui-select"] = {
require("telescope.themes").get_dropdown({})
},
}, },
}) })
telescope.load_extension("fzf") telescope.load_extension("fzf")
telescope.load_extension("undo") telescope.load_extension("undo")
telescope.load_extension("ui-select")
local git_branches = function() local git_branches = function()
builtin.git_branches({ builtin.git_branches({
@ -101,55 +106,62 @@ return {
local find_files = function() local find_files = function()
local ran, errorMessage = pcall(function() local ran, errorMessage = pcall(function()
builtin.git_files({ show_untracked = true })
builtin.git_files({ show_untracked = true, hidden = true })
end) end)
if not ran then if not ran then
builtin.find_files()
builtin.find_files({ hidden = true })
end end
end end
-- set keymaps -- set keymaps
local keymap = vim.keymap -- for conciseness local keymap = vim.keymap -- for conciseness
keymap.set("n", "<C-g>", builtin.live_grep, { desc = "Live grep over project files." })
keymap.set("n", "<C-p>", find_files, { desc = "Fuzzy find files in cwd" })
keymap.set("n", "<C-g>", function () builtin.live_grep({ hidden = true }) end, {})
keymap.set("n", "<C-p>", find_files, {})
keymap.set("n", "<leader>fb", builtin.buffers, { desc = "Fuzzy find open buffers" })
keymap.set("n", "<leader>fo", builtin.oldfiles, { desc = "Fuzzy find recently opened files" })
keymap.set("n", "<leader>fb", builtin.buffers, {})
keymap.set("n", "<leader>fo", builtin.oldfiles, {})
keymap.set("n", "<leader>m", builtin.marks, { desc = "Fuzzy find marks" })
keymap.set("n", "<leader>ch", builtin.command_history, { desc = "Fuzzy find recent commands" })
keymap.set("n", "<leader>m", builtin.marks, {})
keymap.set("n", "<leader>ch", builtin.command_history, {})
keymap.set("n", "<leader>gb", git_branches, { desc = "Fuzzy find git branches" })
keymap.set("n", "<leader>gb", git_branches, {})
keymap.set("n", "<leader>df", function()
builtin.find_files({
prompt_title = "< VimRC >",
cwd = vim.fn.expand("~/.config/nvim"),
hidden = true,
})
end, { desc = "Find neovim config files" })
keymap.set("n", "<leader>vh", builtin.help_tags, {})
keymap.set("n", "<leader>vh", builtin.help_tags, { desc = "Fuzzy find help tags" })
keymap.set("n", "<leader>ds", builtin.lsp_document_symbols, {})
keymap.set("n", "<leader>ws", builtin.lsp_workspace_symbols, {})
keymap.set("n", "<leader>dws", builtin.lsp_dynamic_workspace_symbols, {})
keymap.set("n", "<leader>gf", function () keymap.set("n", "<leader>gf", function ()
builtin.grep_string({ builtin.grep_string({
search = vim.fn.expand("<cword>"), search = vim.fn.expand("<cword>"),
}) })
end, { desc = "Find neovim config files with FZF" })
end)
keymap.set("n", "<leader>gF", function () keymap.set("n", "<leader>gF", function ()
builtin.grep_string({ builtin.grep_string({
search = vim.fn.expand("<cWORD>"), search = vim.fn.expand("<cWORD>"),
}) })
end, { desc = "Find neovim config files with FZF" })
end)
keymap.set("n", "<leader>gD", function () keymap.set("n", "<leader>gD", function ()
builtin.find_files({ builtin.find_files({
search_file = vim.fn.expand("<cword>"), search_file = vim.fn.expand("<cword>"),
}) })
end, { desc = "Find neovim config files with FZF" })
end)
vim.keymap.set("n", "<leader>u", "<cmd>Telescope undo<cr>") vim.keymap.set("n", "<leader>u", "<cmd>Telescope undo<cr>")
local function telescopeDotfiles()
builtin.find_files({
prompt_title = "< VimRC >",
cwd = vim.fn.expand("~/dotfiles"),
hidden = true,
})
end
vim.api.nvim_create_user_command('TelescopeDotfiles', telescopeDotfiles, {})
end, end,
} }

Loading…
Cancel
Save