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 = { [""] = false, [""] = actions.send_to_qflist, }, }, }, }) local M = {} function git_branches () require("telescope.builtin").git_branches({ attach_mappings = function(_, map) map("i", "", actions.git_delete_branch) map("n", "", actions.git_delete_branch) return true end, }) end function files () local ran, errorMessage = pcall(function() require('telescope.builtin').git_files({ show_untracked = true }) end) if not ran then require('telescope.builtin').find_files() end end local options = { noremap = true } vim.keymap.set('n', '', require('telescope.builtin').live_grep, options) vim.keymap.set('n', '', files, options) vim.keymap.set('n', '', function() require('telescope.builtin').find_files() end, options) vim.keymap.set('n', 'df', function() require("telescope.builtin").find_files({ prompt_title = "< VimRC >", cwd = vim.fn.expand('~/.config/nvim'), hidden = true, }) end, options) vim.keymap.set('n', 'fb', require('telescope.builtin').buffers, options) vim.keymap.set('n', 'fo', require('telescope.builtin').oldfiles, options) vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, options) vim.keymap.set('n', 'm', require('telescope.builtin').marks, options) vim.keymap.set('n', 'ch', require('telescope.builtin').command_history, options) vim.keymap.set('n', 'gb', git_branches, options) vim.keymap.set('n', 'gs', require('telescope.builtin').git_status, options)