Update; Add nice ripgrep search
This commit is contained in:
@@ -59,13 +59,28 @@ in
|
||||
HISTCONTROL='erasedups:ignoreboth'
|
||||
HISTIGNORE='&:[ ]*:exit:ls:bg:fg:history:clear'
|
||||
unsetopt beep
|
||||
'';
|
||||
|
||||
profileExtra = lib.mkIf cfg.sourceProfile ''
|
||||
source $HOME/.profile
|
||||
prg() {
|
||||
# ''${1} is the search term, ''${2} is the path (defaulting to . if empty)
|
||||
local query="''${1:-}"
|
||||
local search_path="''${2:-.}"
|
||||
|
||||
local selected=$(
|
||||
fzf --ansi --disabled --query "$query" \
|
||||
--bind "start:reload(rg --column --line-number --no-heading --color=always --smart-case {q} \"$search_path\")" \
|
||||
--bind "change:reload:sleep 0.1; rg --column --line-number --no-heading --color=always --smart-case {q} \"$search_path\" || true" \
|
||||
--delimiter : \
|
||||
--preview 'bat --color=always --style=numbers --highlight-line {2} {1}' \
|
||||
--preview-window 'right:45%'
|
||||
)
|
||||
|
||||
# Extract file and line, then open in Neovim
|
||||
[ -n "$selected" ] && nvim "$(echo "$selected" | cut -d: -f1)" +"$(echo "$selected" | cut -d: -f2)"
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
|
||||
@@ -66,7 +66,19 @@ vim.opt.directory = swapdir .. "," .. temp
|
||||
-------- CLIPBOARD ---------
|
||||
----------------------------
|
||||
if vim.fn.has("wsl") == 1 then
|
||||
vim.opt.clipboard = vim.opt.clipboard + 'unnamedplus'
|
||||
vim.g.clipboard = {
|
||||
name = 'WslClipboard',
|
||||
copy = {
|
||||
["+"] = 'win32yank.exe -i --crlf',
|
||||
["*"] = 'win32yank.exe -i --crlf',
|
||||
},
|
||||
paste = {
|
||||
["+"] = 'win32yank.exe -o --lf',
|
||||
["*"] = 'win32yank.exe -o --lf',
|
||||
},
|
||||
cache_enabled = 0,
|
||||
}
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user