51 lines
1.7 KiB
Lua
51 lines
1.7 KiB
Lua
-- -----------------
|
|
-- -- Helper Functions
|
|
-- -------------------
|
|
-- -- If in a git repo, execute the given function with the option
|
|
-- -- "cwd=<git root>". Otherwise, execute the function with no options.
|
|
-- local function execute_in_repo_root(func)
|
|
-- local function is_git_repo()
|
|
-- vim.fn.system("git rev-parse --is-inside-work-tree")
|
|
--
|
|
-- return vim.v.shell_error == 0
|
|
-- end
|
|
--
|
|
-- local function get_git_root()
|
|
-- local dot_git_path = vim.fn.finddir(".git", ".;")
|
|
-- return vim.fn.fnamemodify(dot_git_path, ":h")
|
|
-- end
|
|
--
|
|
-- local opts = {}
|
|
--
|
|
-- if is_git_repo() then opts = {cwd = get_git_root()} end
|
|
--
|
|
-- func(opts)
|
|
-- end
|
|
-----------------------
|
|
-- Plugin Configuration
|
|
-----------------------
|
|
return {
|
|
{
|
|
'nvim-telescope/telescope.nvim',
|
|
version = '0.1.5',
|
|
dependencies = {
|
|
{
|
|
'nvim-lua/plenary.nvim'
|
|
}
|
|
},
|
|
cmd = "Telescope",
|
|
init = function()
|
|
-- LuaFormatter off
|
|
vim.keymap.set('n', '<leader>ff', function() require("telescope.builtin").find_files() end,{desc = "Files"})
|
|
vim.keymap.set('n', '<leader>fg', function() require("telescope.builtin").live_grep() end,{desc = "grep"})
|
|
vim.keymap.set('n', '<leader>fa', function()
|
|
require("telescope.builtin").find_files({hidden = true})
|
|
end, {desc = "All files"})
|
|
|
|
vim.keymap.set('n', '<leader>fb', function() require("telescope.builtin").buffers() end, {desc = "Buffers"})
|
|
vim.keymap.set('n', '<leader>fh', function() require("telescope.builtin").help_tags() end, {desc = "Help tags"})
|
|
-- LuaFormatter on
|
|
end
|
|
}
|
|
}
|