Skip to content

Commit

Permalink
NVIM Use Telescope PrettyPickers
Browse files Browse the repository at this point in the history
  • Loading branch information
awerebea committed Nov 19, 2023
1 parent a28a3c5 commit 6719bb3
Show file tree
Hide file tree
Showing 3 changed files with 319 additions and 36 deletions.
61 changes: 33 additions & 28 deletions nvim/.config/nvim/lua/plugins/neoscopes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,22 @@ return {
end

_G.neoscopes_find_files = function()
require("telescope.builtin").find_files {
search_dirs = get_search_dirs(),
require("plugins.telescope.telescopePickers").prettyFilesPicker {
picker = "find_files",
options = { search_dirs = get_search_dirs() },
}
-- require("telescope.builtin").find_files {
-- search_dirs = get_search_dirs(),
-- }
end
_G.neoscopes_live_grep = function()
require("telescope.builtin").live_grep {
search_dirs = get_search_dirs(),
require("plugins.telescope.telescopePickers").prettyGrepPicker {
picker = "live_grep",
options = { search_dirs = get_search_dirs() },
}
-- require("telescope.builtin").live_grep {
-- search_dirs = get_search_dirs(),
-- }
end
_G.neoscopes_live_grep_args = function()
require("telescope").extensions.live_grep_args.live_grep_args {
Expand All @@ -59,30 +67,27 @@ return {
search = "",
}
end
_G.neoscopes_grep_word = function()
require("plugins.telescope.telescopePickers").prettyGrepPicker {
picker = "grep_string",
options = { search_dirs = get_search_dirs() },
}
end

vim.keymap.set(
"n",
"<leader>ff",
"<Cmd>lua neoscopes_find_files()<CR>",
{ desc = "Find files (menufacture)" }
)
vim.keymap.set(
"n",
"<leader>f/",
"<Cmd>lua neoscopes_live_grep()<CR>",
{ desc = "Live grep (menufacture)" }
)
vim.keymap.set(
"n",
"<leader>f?",
"<Cmd>lua neoscopes_live_grep_args()<CR>",
{ desc = "Live grep (custom args)" }
)
vim.keymap.set(
"n",
"<leader>fag",
"<Cmd>lua neoscopes_fuzzy_grep()<CR>",
{ desc = "Fuzzy Grep (menufacture)" }
)
vim.keymap.set("n", "<leader>ff", function()
neoscopes_find_files()
end, { desc = "Find files (menufacture)" })
vim.keymap.set("n", "<leader>f/", function()
neoscopes_live_grep()
end, { desc = "Live grep (menufacture)" })
vim.keymap.set("n", "<leader>f?", function()
neoscopes_live_grep_args()
end, { desc = "Live grep (custom args)" })
vim.keymap.set("n", "<leader>fag", function()
neoscopes_fuzzy_grep()
end, { desc = "Fuzzy Grep (menufacture)" })
vim.keymap.set("n", "<leader>fw", function()
neoscopes_grep_word()
end, { desc = "Find word under cursor (menufacture)" })
end,
}
24 changes: 16 additions & 8 deletions nvim/.config/nvim/lua/plugins/telescope/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ return {
},
cmd = "Telescope",
keys = {
-- Following 4 keymaps are defined in nescopes.lua module
-- Following 5 keymaps are defined in nescopes.lua module
-- {
-- "<leader>ff",
-- function()
-- require("telescope").extensions.menufacture.find_files()
-- require("plugins.telescope.telescopePickers").prettyGrepPicker { picker = "find_files" }
-- end,
-- desc = "Find files (menufacture)",
-- },
-- {
-- "<leader>f/",
-- function()
-- require("telescope").extensions.menufacture.live_grep()
-- require("plugins.telescope.telescopePickers").prettyGrepPicker { picker = "live_grep" }
-- end,
-- { desc = "Live grep (menufacture)" },
-- },
Expand All @@ -58,6 +58,13 @@ return {
-- end,
-- desc = "Fuzzy Grep (menufacture)",
-- },
-- {
-- "<leader>fw",
-- function()
-- require("plugins.telescope.telescopePickers").prettyGrepPicker { picker = "grep_string" }
-- end,
-- desc = "Find word under cursor",
-- },
{
"<leader>//",
function()
Expand All @@ -68,10 +75,9 @@ return {
{
"<leader>fg",
function()
local ok = pcall(require("telescope").extensions.menufacture.git_files, {})
if not ok then
require("telescope").extensions.menufacture.find_files()
end
require("plugins.telescope.telescopePickers").prettyFilesPicker {
picker = "git_files",
}
end,
desc = "Find Git managed files",
},
Expand Down Expand Up @@ -131,7 +137,9 @@ return {
{
"<leader>fo",
function()
require("telescope.builtin").oldfiles()
require("plugins.telescope.telescopePickers").prettyFilesPicker {
picker = "oldfiles",
}
end,
desc = "Recent",
},
Expand Down
Loading

0 comments on commit 6719bb3

Please sign in to comment.