Browse Source

Merge branch 'master' of git.tovijaeschke.xyz:tovi/dotfiles

master
Tovi Jaeschke-Rogers 1 week ago
parent
commit
95f92bac49
3 changed files with 62 additions and 2 deletions
  1. +1
    -1
      .config/nvim/lua/plugins/telescope.lua
  2. +59
    -0
      .config/nvim/lua/plugins/telescope/multigrep.lua
  3. +2
    -1
      .config/zsh/.zshrc

+ 1
- 1
.config/nvim/lua/plugins/telescope.lua View File

@ -119,7 +119,7 @@ return {
local keymap = vim.keymap
keymap.set("n", "<leader>ff", function()
builtin.live_grep({ hidden = true })
require("plugins.telescope.multigrep").live_multgrep()
end, {})
keymap.set("n", "<leader>p", project_files, {})


+ 59
- 0
.config/nvim/lua/plugins/telescope/multigrep.lua View File

@ -0,0 +1,59 @@
local pickers = require("telescope.pickers")
local finders = require("telescope.finders")
local make_entry = require("telescope.make_entry")
local conf = require("telescope.config").values
local M = {}
M.live_multgrep = function (opts)
opts = opts or {}
opts.cwd = opts.cwd or vim.uv.cwd()
local finder = finders.new_async_job({
command_generator = function (prompt)
print(prompt)
if not prompt or prompt == "" then
return nil
end
local pieces = vim.split(prompt, " ")
local args = { "rg" }
if pieces[1] then
table.insert(args, "-e")
table.insert(args, pieces[1])
end
if pieces[2] then
table.insert(args, "-g")
table.insert(args, pieces[2])
end
---@diagnostic disable-next-line: deprecated
return vim.tbl_flatten({
args,
{
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
"--hidden",
}
})
end,
entry_maker = make_entry.gen_from_vimgrep(opts),
cwd = opts.cwd
})
pickers.new(opts, {
debounce = 100,
prompt_title = "Multi Grep",
finder = finder,
previewer = conf.grep_previewer(opts),
sorter = require("telescope.sorters").empty(),
}):find()
end
return M

+ 2
- 1
.config/zsh/.zshrc View File

@ -42,7 +42,8 @@ if [[ $(uname) == 'Darwin' ]]; then
export PATH="/opt/homebrew/lib/ruby/gems/3.3.0:$PATH"
export PATH="/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/gems/3.3.0:$PATH"
eval "$(rbenv init - zsh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
autoload -Uz compinit


Loading…
Cancel
Save