dotfiles/nvim/lua/telescope-config.lua

31 lines
1.0 KiB
Lua
Raw Normal View History

2022-07-03 14:30:11 +02:00
local M = {}
local telescope = require("telescope")
M.project_files = function()
2022-07-03 18:00:31 +02:00
local opts = require('telescope.themes').get_ivy({}) -- define here if you want to define something
opts["show_untracked"] = true
opts["layout_config"] = {height=0.2}
2022-07-03 14:30:11 +02:00
local ok = pcall(require"telescope.builtin".git_files, opts)
if not ok then require"telescope.builtin".find_files(opts) end
end
2022-07-03 18:00:31 +02:00
local actions = require("telescope.actions")
require("telescope").setup{
defaults = {
mappings = {
i = {
["jj"] = actions.close
},
},
}
}
2022-07-03 14:30:11 +02:00
telescope.load_extension('fzf')
vim.api.nvim_set_keymap("n", "<C-p>", "<CMD>lua require'telescope-config'.project_files()<CR>", {noremap = true, silent = true})
2022-07-03 18:00:31 +02:00
vim.api.nvim_set_keymap("n", "<leader>/", "<cmd>lua require('telescope.builtin').live_grep{ cwd = vim.fn.systemlist(\"git rev-parse --show-toplevel 2> /dev/null || pwd\")[1] }<cr>", { silent = true })
vim.api.nvim_set_keymap("n", "<C-o>", "<cmd>Telescope buffers theme=ivy<cr>", { silent = true })
2022-07-03 14:30:11 +02:00
return M