-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Robin A
committed
Nov 8, 2024
1 parent
ef0dbbd
commit a5f3c36
Showing
2 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
return { | ||
{ | ||
"yetone/avante.nvim", | ||
opts = {}, | ||
build = "make", | ||
dependencies = { | ||
"stevearc/dressing.nvim", | ||
"nvim-lua/plenary.nvim", | ||
"MunifTanjim/nui.nvim", | ||
--- The below dependencies are optional, | ||
"nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons | ||
{ | ||
-- support for image pasting | ||
"HakonHarnes/img-clip.nvim", | ||
event = "VeryLazy", | ||
opts = { | ||
-- recommended settings | ||
default = { | ||
embed_image_as_base64 = false, | ||
prompt_for_file_name = false, | ||
drag_and_drop = { | ||
insert_mode = true, | ||
}, | ||
-- required for Windows users | ||
use_absolute_path = true, | ||
}, | ||
}, | ||
}, | ||
{ | ||
-- Make sure to set this up properly if you have lazy=true | ||
"MeanderingProgrammer/render-markdown.nvim", | ||
opts = { | ||
file_types = { "markdown", "Avante" }, | ||
}, | ||
ft = { "markdown", "Avante" }, | ||
}, | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
local conf = require("telescope.config").values | ||
local finders = require "telescope.finders" | ||
local make_entry = require "telescope.make_entry" | ||
local pickers = require "telescope.pickers" | ||
|
||
local flatten = vim.tbl_flatten | ||
|
||
-- i would like to be able to do telescope | ||
-- and have telescope do some filtering on files and some grepping | ||
|
||
return function(opts) | ||
opts = opts or {} | ||
opts.cwd = opts.cwd and vim.fn.expand(opts.cwd) or vim.loop.cwd() | ||
opts.shortcuts = opts.shortcuts | ||
or { | ||
["l"] = "*.lua", | ||
["v"] = "*.vim", | ||
["n"] = "*.{vim,lua}", | ||
["c"] = "*.c", | ||
["r"] = "*.rs", | ||
["g"] = "*.go", | ||
} | ||
opts.pattern = opts.pattern or "%s" | ||
|
||
local custom_grep = finders.new_async_job { | ||
command_generator = function(prompt) | ||
if not prompt or prompt == "" then | ||
return nil | ||
end | ||
|
||
local prompt_split = vim.split(prompt, " ") | ||
|
||
local args = { "rg" } | ||
if prompt_split[1] then | ||
table.insert(args, "-e") | ||
table.insert(args, prompt_split[1]) | ||
end | ||
|
||
if prompt_split[2] then | ||
table.insert(args, "-g") | ||
|
||
local pattern | ||
if opts.shortcuts[prompt_split[2]] then | ||
pattern = opts.shortcuts[prompt_split[2]] | ||
else | ||
pattern = prompt_split[2] | ||
end | ||
|
||
table.insert(args, string.format(opts.pattern, pattern)) | ||
end | ||
|
||
return flatten { | ||
args, | ||
{ "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case" }, | ||
} | ||
end, | ||
entry_maker = make_entry.gen_from_vimgrep(opts), | ||
cwd = opts.cwd, | ||
} | ||
|
||
pickers | ||
.new(opts, { | ||
debounce = 100, | ||
prompt_title = "Live Grep (with shortcuts)", | ||
finder = custom_grep, | ||
previewer = conf.grep_previewer(opts), | ||
sorter = require("telescope.sorters").empty(), | ||
}) | ||
:find() | ||
end |