commit 5c6cf33eef814a38dc31a9e1a27ae7890f047e25
parent ec0eaff9d11faee47f186af59d53449fc9b44914
Author: William Casarin <jb55@jb55.com>
Date: Thu, 12 Nov 2020 09:06:45 -0800
fzf_helpers: make some edit helpers
Diffstat:
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/dotfiles/.fzf_helpers b/dotfiles/.fzf_helpers
@@ -1,4 +1,15 @@
+fze() {
+ local file
+ file=$(git ls-files | fzf) && edit "$file"
+}
+
+# ctags jumper
+fte() {
+ <tags sed -En '/^!/d;s,^([^\t]+).*,\1,p'
+ ctags_list | fzf
+}
+
# fd - cd to selected directory
fd() {
local dir
@@ -40,9 +51,13 @@ ftd() {
cd "$res"
}
+ctags_list() {
+ <tags sed -En '/^!/d;s,^([^\t]+).*,\1,p'
+}
+
# ctags less jumper
fct() {
- <tags sed -En '/^!/d;s,^([^\t]+).*,\1,p' | fzf | xargs -I{} less -t{}
+ ctags_list | fzf | xargs -I{} less -t{}
}
ft() {
@@ -55,19 +70,11 @@ fto() {
open "$(findlt ${1:-1} f)"
}
-fte() {
- edit "$(findlt ${1:-1} f)"
-}
-
# fzt - cd to most recently accessed dirs
fzt() {
local dir=$(z -et | fzcmd) && cd "$dir"
}
-fze() {
- fzcmd | xargs edit
-}
-
# fz helper
fzcmd() {
awk '{ print $2 }' | fzf --query="$1" --tac +s