chore(fish): Change function order
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# vim: filetype=sh
|
||||
|
||||
# OMF plugins: bass, foreign-env, omf, fish-spec, nvm
|
||||
# OMF plugins: bass, fisher, foreign-env, omf, fish-spec, nvm
|
||||
|
||||
# Variables
|
||||
set -g -x fish_greeting ""
|
||||
@@ -106,6 +106,31 @@ end
|
||||
|
||||
bind -e \cv
|
||||
|
||||
# Run zoxide, onefetch and env detector on CD
|
||||
function cd -w='cd'
|
||||
z $argv || return
|
||||
check_directory_for_new_repository
|
||||
check_and_source_activate
|
||||
end
|
||||
|
||||
function check_directory_for_new_repository
|
||||
set current_repository (git rev-parse --show-toplevel 2> /dev/null)
|
||||
if [ "$current_repository" ] && \
|
||||
[ "$current_repository" != "$last_repository" ]
|
||||
if type -q onefetch
|
||||
onefetch
|
||||
end
|
||||
end
|
||||
set -gx last_repository $current_repository
|
||||
end
|
||||
|
||||
function check_and_source_activate
|
||||
if test -f (pwd)/activate.fish
|
||||
echo (set_color green)"Found activate.fish in current directory, sourcing..."(set_color normal)
|
||||
source (pwd)/activate.fish
|
||||
end
|
||||
end
|
||||
|
||||
# Check if any directory has git updates
|
||||
function check_git_status
|
||||
set target_dir $argv[1]
|
||||
@@ -130,29 +155,3 @@ check_git_status $HOME/.local
|
||||
# and not set -q TMUX
|
||||
# exec tmux
|
||||
# end
|
||||
|
||||
|
||||
#onefetch
|
||||
function cd -w='cd'
|
||||
z $argv || return
|
||||
check_directory_for_new_repository
|
||||
check_and_source_activate
|
||||
end
|
||||
|
||||
function check_directory_for_new_repository
|
||||
set current_repository (git rev-parse --show-toplevel 2> /dev/null)
|
||||
if [ "$current_repository" ] && \
|
||||
[ "$current_repository" != "$last_repository" ]
|
||||
if type -q onefetch
|
||||
onefetch
|
||||
end
|
||||
end
|
||||
set -gx last_repository $current_repository
|
||||
end
|
||||
|
||||
function check_and_source_activate
|
||||
if test -f (pwd)/activate.fish
|
||||
echo (set_color green)"Found activate.fish in current directory, sourcing..."(set_color normal)
|
||||
source (pwd)/activate.fish
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user