You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

61 lines
1.7 KiB

local pickers = require("telescope.pickers")
local finders = require("telescope.finders")
local previewers = require("telescope.previewers")
local action_state = require("telescope.actions.state")
local conf = require("telescope.config").values
local actions = require("telescope.actions")
require("telescope").setup({
defaults = {
file_sorter = require("telescope.sorters").get_fzy_sorter,
prompt_prefix = " >",
color_devicons = true,
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
mappings = {
i = {
["<C-x>"] = false,
["<C-q>"] = actions.send_to_qflist,
},
},
},
})
local M = {}
function git_branches ()
require("telescope.builtin").git_branches({
attach_mappings = function(_, map)
map("i", "<c-d>", actions.git_delete_branch)
map("n", "<c-d>", actions.git_delete_branch)
return true
end,
})
end
local options = { noremap = true }
vim.keymap.set('n', '<C-g>', function()
local term = vim.fn.input("Grep For > ")
if term == '' then
return
end
require('telescope.builtin').grep_string({ search = term })
end, options)
vim.keymap.set('n', '<C-p>', function()
local ran, errorMessage = pcall(require('telescope.builtin').git_files)
if not ran then
require('telescope.builtin').find_files()
end
end, options)
-- vim.keymap.set('n', '<C-q>', function()
-- end, options)
vim.keymap.set('n', '<leader>fb', require('telescope.builtin').buffers, options)
vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, options)