home-environments: radio: Make @git-root fish-abbreviation more general

pull/1/head
anemofilia 2023-10-30 01:41:22 -03:00 committed by Luis Guilherme Coelho
parent fdfdd898ae
commit e62b83b75c
No known key found for this signature in database
GPG Key ID: 1F2E76ACE3F531C8
2 changed files with 10 additions and 2 deletions

View File

@ -2,6 +2,11 @@ function code-projects
string replace '@' '~/projects/code/' $argv[1] string replace '@' '~/projects/code/' $argv[1]
end end
function git-root
set -l result (git root 2>/dev/null) && \
echo $result || echo ""
end
function bookmarks function bookmarks
$EDITOR (string replace ':' '~/resources/bookmarks/' $argv[1]) $EDITOR (string replace ':' '~/resources/bookmarks/' $argv[1])
end end
@ -36,7 +41,7 @@ end
function bang-bang-k function bang-bang-k
set -l k (string replace '!!:' '' $argv[1]) set -l k (string replace '!!:' '' $argv[1])
set -l arr $history[1] set -l arr (string replace -ra ' ' '\n' $history[1])
echo $arr[$k] echo $arr[$k]
end end

View File

@ -284,7 +284,10 @@
(expansion "~/resources/bookmarks")) (expansion "~/resources/bookmarks"))
(abbreviation (abbreviation
(name "@git-root") (name "@git-root")
(expansion "cd (git root)")) (pattern "@git-root")
(position 'anywhere)
(expansion
(fish-function "git-root")))
#|Quick edit|# #|Quick edit|#
(abbreviation (abbreviation