Skip to content

Commit

Permalink
wip: Fri Nov 8 05:11:39 PM CET 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin A committed Nov 8, 2024
1 parent ef0dbbd commit a5f3c36
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
39 changes: 39 additions & 0 deletions lua/custom/plugins/avante.lua
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" },
},
},
},
}
70 changes: 70 additions & 0 deletions lua/custom/telescope/multi-ripgrep.lua
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

0 comments on commit a5f3c36

Please sign in to comment.