|
@ -1,24 +1,26 @@ |
|
|
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") |
|
|
|
|
|
|
|
|
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 builtin = require('telescope.builtin') |
|
|
|
|
|
local sorters = require('telescope.sorters') |
|
|
|
|
|
local actions = require('telescope.actions') |
|
|
|
|
|
|
|
|
require("telescope").setup({ |
|
|
|
|
|
|
|
|
require('telescope').setup({ |
|
|
defaults = { |
|
|
defaults = { |
|
|
file_sorter = require("telescope.sorters").get_fzy_sorter, |
|
|
|
|
|
prompt_prefix = " >", |
|
|
|
|
|
|
|
|
file_sorter = sorters.get_fzy_sorter, |
|
|
|
|
|
prompt_prefix = ' >', |
|
|
color_devicons = true, |
|
|
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, |
|
|
|
|
|
|
|
|
file_previewer = previewers.vim_buffer_cat.new, |
|
|
|
|
|
grep_previewer = previewers.vim_buffer_vimgrep.new, |
|
|
|
|
|
qflist_previewer = previewers.vim_buffer_qflist.new, |
|
|
|
|
|
|
|
|
mappings = { |
|
|
mappings = { |
|
|
i = { |
|
|
i = { |
|
|
["<C-x>"] = false, |
|
|
|
|
|
["<C-q>"] = actions.send_to_qflist, |
|
|
|
|
|
|
|
|
['<C-x>'] = false, |
|
|
|
|
|
['<C-q>'] = actions.send_to_qflist, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
@ -27,7 +29,7 @@ require("telescope").setup({ |
|
|
local M = {} |
|
|
local M = {} |
|
|
|
|
|
|
|
|
function git_branches () |
|
|
function git_branches () |
|
|
require("telescope.builtin").git_branches({ |
|
|
|
|
|
|
|
|
builtin.git_branches({ |
|
|
attach_mappings = function(_, map) |
|
|
attach_mappings = function(_, map) |
|
|
map("i", "<c-d>", actions.git_delete_branch) |
|
|
map("i", "<c-d>", actions.git_delete_branch) |
|
|
map("n", "<c-d>", actions.git_delete_branch) |
|
|
map("n", "<c-d>", actions.git_delete_branch) |
|
@ -38,37 +40,37 @@ end |
|
|
|
|
|
|
|
|
function files () |
|
|
function files () |
|
|
local ran, errorMessage = pcall(function() |
|
|
local ran, errorMessage = pcall(function() |
|
|
require('telescope.builtin').git_files({ show_untracked = true }) |
|
|
|
|
|
|
|
|
builtin.git_files({ show_untracked = true }) |
|
|
end) |
|
|
end) |
|
|
if not ran then |
|
|
if not ran then |
|
|
require('telescope.builtin').find_files() |
|
|
|
|
|
|
|
|
builtin.find_files() |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
local options = { noremap = true } |
|
|
local options = { noremap = true } |
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<C-g>', require('telescope.builtin').live_grep, options) |
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<C-g>', builtin.live_grep, options) |
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<C-p>', files, options) |
|
|
vim.keymap.set('n', '<C-p>', files, options) |
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<A-p>', function() |
|
|
|
|
|
require('telescope.builtin').find_files() |
|
|
|
|
|
end, options) |
|
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<leader>df', function() |
|
|
vim.keymap.set('n', '<leader>df', function() |
|
|
require("telescope.builtin").find_files({ |
|
|
|
|
|
|
|
|
builtin.find_files({ |
|
|
prompt_title = "< VimRC >", |
|
|
prompt_title = "< VimRC >", |
|
|
cwd = vim.fn.expand('~/.config/nvim'), |
|
|
cwd = vim.fn.expand('~/.config/nvim'), |
|
|
hidden = true, |
|
|
hidden = true, |
|
|
}) |
|
|
}) |
|
|
end, options) |
|
|
end, options) |
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<leader>fb', require('telescope.builtin').buffers, options) |
|
|
|
|
|
vim.keymap.set('n', '<leader>fo', require('telescope.builtin').oldfiles, options) |
|
|
|
|
|
vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, options) |
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<leader>fb', builtin.buffers, options) |
|
|
|
|
|
vim.keymap.set('n', '<leader>fo', builtin.oldfiles, options) |
|
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('n', 'gr', builtin.lsp_references, options) |
|
|
|
|
|
vim.keymap.set("n", 'gd', builtin.lsp_definitions, options) |
|
|
|
|
|
vim.keymap.set("n", 'gi', builtin.lsp_implementations, options) |
|
|
|
|
|
vim.keymap.set("n", 'gT', builtin.lsp_type_definitions, options) |
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<leader>m', require('telescope.builtin').marks, options) |
|
|
|
|
|
vim.keymap.set('n', '<leader>ch', require('telescope.builtin').command_history, options) |
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<leader>m', builtin.marks, options) |
|
|
|
|
|
vim.keymap.set('n', '<leader>ch', builtin.command_history, options) |
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<leader>gb', git_branches, options) |
|
|
vim.keymap.set('n', '<leader>gb', git_branches, options) |
|
|
vim.keymap.set('n', '<leader>gs', require('telescope.builtin').git_status, options) |
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<leader>gs', builtin.git_status, options) |