mirror of
https://github.com/nmasur/dotfiles
synced 2025-07-05 20:50:15 +00:00
fish search updates
This commit is contained in:
@ -51,6 +51,10 @@
|
||||
description = "Open a recent file in Vim";
|
||||
body = builtins.readFile ./functions/recent.fish;
|
||||
};
|
||||
search-and-edit = {
|
||||
description = "Search and open the relevant file in Vim";
|
||||
body = builtins.readFile ./functions/search-and-edit.fish;
|
||||
};
|
||||
syncnotes = {
|
||||
description = "Full git commit on notes";
|
||||
body = builtins.readFile ./functions/syncnotes.fish;
|
||||
|
@ -1,5 +1,7 @@
|
||||
bind -M insert \co edit
|
||||
bind -M default \co edit
|
||||
bind -M insert \cs search-and-edit
|
||||
bind -M default \cs search-and-edit
|
||||
bind -M insert \ca 'cd ~; and edit; and commandline -a "; cd -"; commandline -f execute'
|
||||
bind -M default \ca 'cd ~; and edit; and commandline -a "; cd -"; commandline -f execute'
|
||||
bind -M insert \ce recent
|
||||
|
18
modules/shell/fish/functions/search-and-edit.fish
Normal file
18
modules/shell/fish/functions/search-and-edit.fish
Normal file
@ -0,0 +1,18 @@
|
||||
set vimfile (
|
||||
rg \
|
||||
--color=always \
|
||||
--line-number \
|
||||
--no-heading \
|
||||
--smart-case \
|
||||
--iglob !/Library/** \
|
||||
--iglob !/System/** \
|
||||
--iglob "!Users/$HOME/Library/*" \
|
||||
| fzf --ansi \
|
||||
--color "hl:-1:underline,hl+:-1:underline:reverse" \
|
||||
--delimiter : \
|
||||
--preview 'bat --color=always {1} --highlight-line {2}' \
|
||||
--preview-window 'up,60%,border-bottom,+{2}+3/3,~3'
|
||||
)
|
||||
and set vimfile (echo $vimfile | tr -d '\r')
|
||||
and commandline -r "vim $vimfile"
|
||||
and commandline -f execute
|
Reference in New Issue
Block a user