feat: experimenting with custom Telescope commands

This commit is contained in:
Oliver Davies 2021-11-17 21:50:32 +00:00
parent af6d7d8b4e
commit 04392ea377
2 changed files with 36 additions and 2 deletions

View file

@ -38,14 +38,16 @@ local options = {
}
-- Builtin
map('n', '<leader>df', '<CMD>lua require("telescope.builtin").find_files{ cwd="~/dotfiles", hidden=true }<CR>', options)
map('n', '<leader>fb', '<CMD>lua require("telescope.builtin").buffers()<CR>', options)
map('n', '<leader>fc', '<CMD>lua require("telescope.builtin").lsp_code_actions()<CR>', options)
map('n', '<leader>fd', '<CMD>lua require("telescope.builtin").lsp_workspace_diagnostics()<CR>', options)
map('n', '<leader>fe', '<CMD>lua require("telescope.builtin").file_browser{ cwd = vim.fn.expand("%:p:h") }<CR>', options)
map('n', '<leader>ff', '<CMD>lua require("telescope.builtin").find_files{ hidden = true }<CR>', options)
map('n', '<leader>fg', '<CMD>lua require("telescope.builtin").git_files{}<CR>', options)
map('n', '<leader>fh', '<CMD>lua require("telescope.builtin").help_tags()<CR>', options)
map('n', '<leader>fl', '<CMD>lua require("telescope.builtin").live_grep()<CR>', options)
map('n', '<leader>fr', '<CMD>lua require("telescope.builtin").registers()<CR>', options)
map('n', '<leader>fr', '<CMD>lua require("telescope.builtin").registers()<CR>', options)
-- Custom
map("n", "<Leader>en", '<CMD>lua require("opdavies.telescope.mappings").edit_neovim()<Cr>', options)
map("n", "<Leader>ff", '<CMD>lua require("opdavies.telescope.mappings").fd()<Cr>', options)

View file

@ -0,0 +1,32 @@
local M = {}
function M.edit_neovim()
local opts = {
prompt_title = "~ dotfiles ~",
shorten_path = false,
cwd = "~/.config/nvim",
layout_strategy = "flex",
layout_config = {
width = 0.9,
height = 0.8,
horizontal = {
width = { padding = 0.15 },
},
vertical = {
preview_height = 0.75,
},
},
}
require("telescope.builtin").find_files(opts)
end
function M.fd()
local themes = require "telescope.themes"
require("telescope.builtin").find_files(themes.get_ivy())
end
return M