Add dotfiles
This commit is contained in:
50
.config/nvim/lua/plugins/telescope.lua
Normal file
50
.config/nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
-- -----------------
|
||||
-- -- 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 = "Telescope find files"})
|
||||
vim.keymap.set('n', '<leader>fg', function() require("telescope.builtin").live_grep() end,{desc = "Telescope live grep"})
|
||||
vim.keymap.set('n', '<leader>fa', function()
|
||||
require("telescope.builtin").find_files({hidden = true})
|
||||
end, {desc = "Telescope find all files"})
|
||||
|
||||
vim.keymap.set('n', '<leader>fb', function() require("telescope.builtin").buffers() end, {desc = "Telescope buffers"})
|
||||
vim.keymap.set('n', '<leader>fh', function() require("telescope.builtin").help_tags() end, {desc = "Telescope help tags"})
|
||||
-- LuaFormatter on
|
||||
end
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user