Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions lua/theprimeagen/lazy/telescope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,25 @@ return {
require('telescope').setup({})

local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
-- search the current directory
vim.keymap.set('n', '<leader>pp', function()
local Cdir = vim.fn.expand('%:p')
if Cdir == "" then
builtin.find_files()
else
Cdir = string.gsub(Cdir, "oil://", "");
Cdir = string.gsub(Cdir, "[^/]+%.%w+$", "");
print(Cdir);
builtin.find_files({ cwd = Cdir })
end
end, {})
-- fixed so even if you use this: nvim /path/to/your/project, git will be detected
vim.keymap.set('n', '<C-p>', function()
local Cdir = vim.fn.expand("%:p")
Cdir = string.gsub(Cdir, "oil://", "")
Cdir = string.gsub(Cdir, "[^/]+%.%w+$", "")
builtin.git_files({ cwd = Cdir })
end, {})
vim.keymap.set('n', '<leader>pws', function()
local word = vim.fn.expand("<cword>")
builtin.grep_string({ search = word })
Expand Down