Fixing fish submodule issue.
This commit is contained in:
parent
776a258f50
commit
52d0953064
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 8972c47f1f17109e34b7d80a1ac6b18f9f281819
|
||||
|
|
@ -0,0 +1 @@
|
|||
fisher complete
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
complete -xc nvm -n __fish_use_subcommand -a ls -d "List available versions matching <regex>"
|
||||
complete -xc nvm -n __fish_use_subcommand -a use -d "Download <version> and modify PATH so it's available"
|
||||
complete -xc nvm -n __fish_use_subcommand -a --help -d "Show usage help"
|
||||
complete -xc nvm -n __fish_use_subcommand -a --version -d "Show the current version of nvm"
|
||||
|
||||
nvm complete
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
function _nvm_uninstall -e nvm_uninstall
|
||||
if test -s "$nvm_config/version"
|
||||
read -l ver <$nvm_config/version
|
||||
if set -l i (contains -i -- "$nvm_config/$ver/bin" $fish_user_paths)
|
||||
set -e fish_user_paths[$i]
|
||||
end
|
||||
command rm -f $nvm_config/version
|
||||
end
|
||||
|
||||
for name in (set -n | command awk '/^nvm_/')
|
||||
set -e "$name"
|
||||
end
|
||||
|
||||
functions -e (functions -a | command awk '/^_nvm_/')
|
||||
end
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# Path to Oh My Fish install.
|
||||
set -q XDG_DATA_HOME
|
||||
and set -gx OMF_PATH "$XDG_DATA_HOME/omf"
|
||||
or set -gx OMF_PATH "$HOME/.local/share/omf"
|
||||
|
||||
# Load Oh My Fish configuration.
|
||||
source $OMF_PATH/init.fish
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
set -g VIRTUALFISH_VERSION 2.3.0
|
||||
set -g VIRTUALFISH_PYTHON_EXEC /usr/bin/python3
|
||||
source /home/ygg/.local/lib/python3.8/site-packages/virtualfish/virtual.fish
|
||||
source /home/ygg/.local/lib/python3.8/site-packages/virtualfish/auto_activation.fish
|
||||
emit virtualfish_did_setup_plugins
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
#-------------------------------------------------------------------------------
|
||||
# Fish Configuration
|
||||
# Started September 14th 2020 by Shawn Anderson
|
||||
#
|
||||
# This configuration heavily integrates fish with vim, tmux, fzf, and other
|
||||
# powerful commandline tools. It's interactive computing for effective
|
||||
# workflow.
|
||||
#-------------------------------------------------------------------------------
|
||||
# FZF -> Fuzzy find everything!
|
||||
|
||||
# Use Ripgrep (Faster than Grep)
|
||||
if type rg &> /dev/null
|
||||
set FZF_DEFAULT_COMMAND 'rg --files --hidden --follow --glob "!.git/"'
|
||||
end
|
||||
|
||||
# Multi-select by default
|
||||
set FZF_DEFAULT_OPTS '-m'
|
||||
|
||||
# If installed through vim, fzf needs to be added to path
|
||||
set PATH $PATH ~/.local/share/nvim/plugged/fzf/bin
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Autojump -> Faster filesystem navigation
|
||||
if test -f ~/.autojump/share/autojump/autojump.fish
|
||||
. ~/.autojump/share/autojump/autojump.fish
|
||||
end
|
||||
#-------------------------------------------------------------------------------
|
||||
# Abbreviations
|
||||
abbr vim nvim
|
||||
abbr cat bat
|
||||
abbr pd prevd
|
||||
abbr l ls -a
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Key Bindings
|
||||
bind \er 'source ~/.config/fish/config.fish'
|
||||
bind \ev '$EDITOR ~/.config/nvim/init.vim'
|
||||
bind \ef '$EDITOR ~/.config/fish/config.fish'
|
||||
bind \et '$EDITOR ~/.tmux.conf'
|
||||
# bind \es '$EDITOR ~/.ssh/config'
|
||||
bind \ed '$EDITOR ~/Workspace/dotfiles/'
|
||||
bind \ew '$EDITOR ~/Workspace/'
|
||||
bind \en '$EDITOR ~/Notes/'
|
||||
# bind \cg 'sr google '
|
||||
# bind \cy 'sr youtube '
|
||||
bind \ck beginning-of-line # Use k because \ca is overwitten as my tmux leader
|
||||
set FZF_TMUX 1
|
||||
|
|
@ -0,0 +1 @@
|
|||
jorgebucaran/nvm.fish
|
||||
Binary file not shown.
|
|
@ -0,0 +1,3 @@
|
|||
function EditDailyLog
|
||||
vim (LogDirectory)/(date +%d-%B).md
|
||||
end
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
function LogDirectory
|
||||
echo ~/Documents/Session\ Notes/(date +%B)
|
||||
end
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
function OpenLogDirectory
|
||||
tmux split-window -h -c (LogDirectory)
|
||||
end
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
function RunBackup
|
||||
echo Pushing ~/.vim to GitHub
|
||||
cd ~/.vim
|
||||
git add .
|
||||
git commit --ammend -m "Running Backup: (date +%D)
|
||||
git push origin master
|
||||
|
||||
echo Pushing ~/.config/fish to GitHub
|
||||
cd ~/.config/fish
|
||||
git add config.fish functions/
|
||||
git commit --ammend -m "Running Backup: (date +%D)
|
||||
git push origin master
|
||||
|
||||
echo Pushing ~/.config/tmux to GitHub
|
||||
cd ~/.config/tmux
|
||||
git add .
|
||||
git commit --ammend -m "Running Backup: (date +%D)
|
||||
git push origin master
|
||||
|
||||
echo Pushing ~/Documents/Notes to GitHub
|
||||
cd ~/Documents/Notes/
|
||||
git add .
|
||||
git commit --ammend -m "Running Backup: (date +%D)
|
||||
git push origin master
|
||||
|
||||
cp ~/Documents ~/sfuhome/Documents
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
function create_daily_log
|
||||
touch (date +%d-%B).md
|
||||
end
|
||||
|
|
@ -0,0 +1 @@
|
|||
/home/ygg/.local/share/omf/themes/agnoster/fish_prompt.fish
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
function fish_prompt --description 'Write out the prompt'
|
||||
# Just calculate this once, to save a few cycles when displaying the prompt
|
||||
if not set -q __fish_prompt_hostname
|
||||
set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
|
||||
end
|
||||
|
||||
set -l color_cwd
|
||||
set -l suffix
|
||||
switch $USER
|
||||
case root toor
|
||||
if set -q fish_color_cwd_root
|
||||
set color_cwd $fish_color_cwd_root
|
||||
else
|
||||
set color_cwd $fish_color_cwd
|
||||
end
|
||||
set suffix '#'
|
||||
case '*'
|
||||
set color_cwd $fish_color_cwd
|
||||
set suffix '>'
|
||||
end
|
||||
|
||||
echo -n -s "$USER" @ "$__fish_prompt_hostname" ' ' (set_color $color_cwd) (prompt_pwd) (set_color normal) "$suffix "
|
||||
end
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
function fish_user_key_bindings
|
||||
fzf_key_bindings
|
||||
end
|
||||
|
|
@ -0,0 +1,436 @@
|
|||
set -g fisher_version 3.3.2
|
||||
|
||||
function fisher -a cmd -d "fish plugin manager"
|
||||
set -q XDG_CACHE_HOME; or set XDG_CACHE_HOME ~/.cache
|
||||
set -q XDG_CONFIG_HOME; or set XDG_CONFIG_HOME ~/.config
|
||||
set -q XDG_DATA_HOME; or set XDG_DATA_HOME ~/.local/share
|
||||
|
||||
set -g fish_config $XDG_CONFIG_HOME/fish
|
||||
set -g fisher_cache $XDG_CACHE_HOME/fisher
|
||||
set -g fisher_data $XDG_DATA_HOME/fisher
|
||||
|
||||
set -q fisher_path; or set -g fisher_path $fish_config
|
||||
set -g fishfile $fish_config/fishfile
|
||||
|
||||
for path in {$fish_config,$fisher_path}/{functions,completions,conf.d} $fisher_cache
|
||||
if test ! -d $path
|
||||
command mkdir -p $path
|
||||
end
|
||||
end
|
||||
|
||||
if test ! -e $fisher_path/completions/fisher.fish
|
||||
echo "fisher complete" >$fisher_path/completions/fisher.fish
|
||||
_fisher_complete
|
||||
end
|
||||
|
||||
if test -e $fisher_path/conf.d/fisher.fish
|
||||
switch "$version"
|
||||
case \*-\*
|
||||
command rm -f $fisher_path/conf.d/fisher.fish
|
||||
case 2\*
|
||||
case \*
|
||||
command rm -f $fisher_path/conf.d/fisher.fish
|
||||
end
|
||||
else
|
||||
switch "$version"
|
||||
case \*-\*
|
||||
case 2\*
|
||||
echo "fisher copy-user-key-bindings" >$fisher_path/conf.d/fisher.fish
|
||||
end
|
||||
end
|
||||
|
||||
# 2019-10-22: temp code, migrates fishfile from old path back to $fish_config
|
||||
if test -e "$fisher_path/fishfile"; and test ! -e "$fishfile"
|
||||
command mv -f "$fisher_path/fishfile" "$fishfile"
|
||||
end
|
||||
|
||||
# 2020-06-23: temp code, migrates fisher data from XDG_CONFIG_HOME to XDG_DATA_HOME
|
||||
set -l fisher_config $XDG_CONFIG_HOME/fisher
|
||||
if test -d $fisher_config
|
||||
echo "migrating local data from $fisher_config to $fisher_data"
|
||||
command rm -rf $fisher_data
|
||||
command mv -f $fisher_config $fisher_data
|
||||
end
|
||||
|
||||
switch "$cmd"
|
||||
case {,self-}complete
|
||||
_fisher_complete
|
||||
case copy-user-key-bindings
|
||||
_fisher_copy_user_key_bindings
|
||||
case ls
|
||||
set -e argv[1]
|
||||
if test -s "$fishfile"
|
||||
set -l file (_fisher_fmt <$fishfile | _fisher_parse -R | command sed "s|@.*||")
|
||||
_fisher_ls | _fisher_fmt | command awk -v FILE="$file" "
|
||||
BEGIN { for (n = split(FILE, f); ++i <= n;) file[f[i]] } \$0 in file && /$argv[1]/
|
||||
" | command sed "s|^$HOME|~|"
|
||||
end
|
||||
case self-update
|
||||
_fisher_self_update (status -f)
|
||||
case self-uninstall
|
||||
_fisher_self_uninstall
|
||||
case {,-}-v{ersion,}
|
||||
echo "fisher version $fisher_version" (status -f | command sed "s|^$HOME|~|")
|
||||
case {,-}-h{elp,}
|
||||
_fisher_help
|
||||
case ""
|
||||
_fisher_commit --
|
||||
case add rm
|
||||
if not isatty
|
||||
while read -l arg
|
||||
set argv $argv $arg
|
||||
end
|
||||
end
|
||||
|
||||
if test (count $argv) = 1
|
||||
echo "fisher: invalid number of arguments" >&2
|
||||
_fisher_help >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
_fisher_commit $argv
|
||||
case \*
|
||||
echo "fisher: unknown flag or command \"$cmd\"" >&2
|
||||
_fisher_help >&2
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_complete
|
||||
complete -ec fisher
|
||||
complete -xc fisher -n __fish_use_subcommand -a add -d "Add plugins"
|
||||
complete -xc fisher -n __fish_use_subcommand -a rm -d "Remove plugins"
|
||||
complete -xc fisher -n __fish_use_subcommand -a ls -d "List installed plugins matching REGEX"
|
||||
complete -xc fisher -n __fish_use_subcommand -a --help -d "Show usage help"
|
||||
complete -xc fisher -n __fish_use_subcommand -a --version -d "$fisher_version"
|
||||
complete -xc fisher -n __fish_use_subcommand -a self-update -d "Update to the latest version"
|
||||
for pkg in (fisher ls)
|
||||
complete -xc fisher -n "__fish_seen_subcommand_from rm" -a $pkg
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_copy_user_key_bindings
|
||||
if functions -q fish_user_key_bindings
|
||||
functions -c fish_user_key_bindings fish_user_key_bindings_copy
|
||||
end
|
||||
function fish_user_key_bindings
|
||||
for file in $fisher_path/conf.d/*_key_bindings.fish
|
||||
source $file >/dev/null 2>/dev/null
|
||||
end
|
||||
if functions -q fish_user_key_bindings_copy
|
||||
fish_user_key_bindings_copy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_ls
|
||||
for pkg in $fisher_data/*/*/*
|
||||
command readlink $pkg; or echo $pkg
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_fmt
|
||||
command sed "s|^[[:space:]]*||;s|^$fisher_data/||;s|^~|$HOME|;s|^\.\/*|$PWD/|;s|^https*:/*||;s|^github\.com/||;s|/*\$||"
|
||||
end
|
||||
|
||||
function _fisher_help
|
||||
echo "usage: fisher add <plugin...> Add plugin/s"
|
||||
echo " fisher rm <plugin...> Remove plugin/s"
|
||||
echo " fisher Update all plugins"
|
||||
echo " fisher ls [<regex>] List installed plugins matching <regex>"
|
||||
echo " fisher --help Show this help"
|
||||
echo " fisher --version Show the current version"
|
||||
echo " fisher self-update Update to the latest version"
|
||||
echo " fisher self-uninstall Uninstall from your system"
|
||||
echo "examples:"
|
||||
echo " fisher add jorgebucaran/z rafaelrinaldi/pure"
|
||||
echo " fisher add gitlab.com/foo/bar@v2"
|
||||
echo " fisher add ~/path/to/local/pkg"
|
||||
echo " fisher add <file"
|
||||
echo " fisher rm rafaelrinaldi/pure"
|
||||
echo " fisher ls | fisher rm"
|
||||
end
|
||||
|
||||
function _fisher_self_update -a file
|
||||
set -l url "https://raw.githubusercontent.com/jorgebucaran/fisher/main/fisher.fish"
|
||||
echo "fetching $url" >&2
|
||||
command curl -s "$url?nocache" >$file.
|
||||
|
||||
set -l next_version (command awk '$4 ~ /^[0-9]+\.[0-9]+\.[0-9]+$/ { print v=$4 } { exit !v }' <$file.)
|
||||
switch "$next_version"
|
||||
case "" $fisher_version
|
||||
command rm -f $file.
|
||||
if test -z "$next_version"
|
||||
echo "fisher: cannot update fisher -- are you offline?" >&2
|
||||
return 1
|
||||
end
|
||||
echo "fisher is already up-to-date" >&2
|
||||
case \*
|
||||
echo "linking $file" | command sed "s|$HOME|~|" >&2
|
||||
command mv -f $file. $file
|
||||
source $file
|
||||
echo "updated to fisher $fisher_version -- hooray!" >&2
|
||||
_fisher_complete
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_self_uninstall
|
||||
for pkg in (_fisher_ls)
|
||||
_fisher_rm $pkg
|
||||
end
|
||||
|
||||
for file in $fisher_cache $fisher_data $fisher_path/{functions,completions,conf.d}/fisher.fish $fishfile
|
||||
echo "removing $file"
|
||||
command rm -Rf $file 2>/dev/null
|
||||
end | command sed "s|$HOME|~|" >&2
|
||||
|
||||
for name in (set -n | command awk '/^fisher_/')
|
||||
set -e "$name"
|
||||
end
|
||||
|
||||
functions -e (functions -a | command awk '/^_fisher/') fisher
|
||||
complete -c fisher --erase
|
||||
end
|
||||
|
||||
function _fisher_commit -a cmd
|
||||
set -e argv[1]
|
||||
set -l elapsed (_fisher_now)
|
||||
|
||||
if test ! -e "$fishfile"
|
||||
command touch $fishfile
|
||||
echo "created new fishfile in $fishfile" | command sed "s|$HOME|~|" >&2
|
||||
end
|
||||
|
||||
set -l old_pkgs (_fisher_ls | _fisher_fmt)
|
||||
for pkg in (_fisher_ls)
|
||||
_fisher_rm $pkg
|
||||
end
|
||||
command rm -Rf $fisher_data
|
||||
command mkdir -p $fisher_data
|
||||
|
||||
set -l next_pkgs (_fisher_fmt <$fishfile | _fisher_parse -R $cmd (printf "%s\n" $argv | _fisher_fmt))
|
||||
set -l actual_pkgs (_fisher_fetch $next_pkgs)
|
||||
set -l updated_pkgs
|
||||
for pkg in $old_pkgs
|
||||
if contains -- $pkg $actual_pkgs
|
||||
set updated_pkgs $updated_pkgs $pkg
|
||||
end
|
||||
end
|
||||
|
||||
if test -z "$actual_pkgs$updated_pkgs$old_pkgs$next_pkgs"
|
||||
echo "fisher: nothing to commit -- try adding some plugins" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l out_pkgs
|
||||
if test "$cmd" = "rm"
|
||||
set out_pkgs $next_pkgs
|
||||
else
|
||||
for pkg in $next_pkgs
|
||||
if contains -- (echo $pkg | command sed "s|@.*||") $actual_pkgs
|
||||
set out_pkgs $out_pkgs $pkg
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
printf "%s\n" (_fisher_fmt <$fishfile | _fisher_parse -W $cmd $out_pkgs | command sed "s|^$HOME|~|") >$fishfile
|
||||
|
||||
_fisher_complete
|
||||
|
||||
command awk -v A=(count $actual_pkgs) -v U=(count $updated_pkgs) -v O=(count $old_pkgs) -v E=(_fisher_now $elapsed) '
|
||||
BEGIN {
|
||||
res = fmt("removed", O - U, fmt("updated", U, fmt("added", A - U)))
|
||||
printf((res ? res : "done") " in %.2fs\n", E / 1000)
|
||||
}
|
||||
function fmt(action, n, s) {
|
||||
return n ? (s ? s ", " : s) action " " n " plugin" (n > 1 ? "s" : "") : s
|
||||
}
|
||||
' >&2
|
||||
end
|
||||
|
||||
function _fisher_parse -a mode cmd
|
||||
set -e argv[1..2]
|
||||
command awk -v FS="[[:space:]]*#+" -v MODE="$mode" -v CMD="$cmd" -v ARGSTR="$argv" '
|
||||
BEGIN {
|
||||
for (n = split(ARGSTR, a, " "); i++ < n;) pkgs[getkey(a[i])] = a[i]
|
||||
}
|
||||
!NF { next } { k = getkey($1) }
|
||||
MODE == "-R" && !(k in pkgs) && ($0 = $1)
|
||||
MODE == "-W" && (/^#/ || k in pkgs || CMD != "rm") { print pkgs[k] (sub($1, "") ? $0 : "") }
|
||||
MODE == "-W" || CMD == "rm" { delete pkgs[k] }
|
||||
END {
|
||||
for (k in pkgs) {
|
||||
if (CMD != "rm" || MODE == "-W") print pkgs[k]
|
||||
else print "fisher: cannot remove \""k"\" -- plugin is not in fishfile" > "/dev/stderr"
|
||||
}
|
||||
}
|
||||
function getkey(s, a) {
|
||||
return (split(s, a, /@+|:/) > 2) ? a[2]"/"a[1]"/"a[3] : a[1]
|
||||
}
|
||||
'
|
||||
end
|
||||
|
||||
function _fisher_fetch
|
||||
set -l pkg_jobs
|
||||
set -l out_pkgs
|
||||
set -l next_pkgs
|
||||
set -l local_pkgs
|
||||
set -q fisher_user_api_token; and set -l curl_opts -u $fisher_user_api_token
|
||||
|
||||
for pkg in $argv
|
||||
switch $pkg
|
||||
case \~\* /\*
|
||||
set -l path (echo "$pkg" | command sed "s|^~|$HOME|")
|
||||
if test -e "$path"
|
||||
set local_pkgs $local_pkgs $path
|
||||
else
|
||||
echo "fisher: cannot add \"$pkg\" -- is this a valid file?" >&2
|
||||
end
|
||||
continue
|
||||
end
|
||||
|
||||
command awk -v PKG="$pkg" -v FS=/ '
|
||||
BEGIN {
|
||||
split(PKG, tmp, /@/)
|
||||
pkg = split(PKG, _, "/") <= 2 ? "github.com/"tmp[1] : tmp[1]
|
||||
tag = tmp[2] ? tmp[2] : "HEAD"
|
||||
print pkg "\t" (\
|
||||
pkg ~ /^github/ ? "https://codeload."pkg"/tar.gz/"tag : \
|
||||
pkg ~ /^gitlab/ ? "https://"pkg"/-/archive/"tag"/"tmp[split(pkg, tmp, "/")]"-"tag".tar.gz" : \
|
||||
pkg ~ /^bitbucket/ ? "https://"pkg"/get/"tag".tar.gz" : pkg\
|
||||
)
|
||||
}
|
||||
' | read -l pkg url
|
||||
|
||||
if test ! -d "$fisher_data/$pkg"
|
||||
fish -c "
|
||||
echo fetching $url >&2
|
||||
command mkdir -p $fisher_data/$pkg $fisher_cache/(command dirname $pkg)
|
||||
if command curl $curl_opts -Ss -w \"\" $url 2>&1 | command tar -xzf- -C $fisher_data/$pkg 2>/dev/null
|
||||
command rm -Rf $fisher_cache/$pkg
|
||||
command mv -f $fisher_data/$pkg/* $fisher_cache/$pkg
|
||||
command rm -Rf $fisher_data/$pkg
|
||||
command cp -Rf {$fisher_cache,$fisher_data}/$pkg
|
||||
else if test -d \"$fisher_cache/$pkg\"
|
||||
echo fisher: cannot connect to server -- looking in \"$fisher_cache/$pkg\" | command sed 's|$HOME|~|' >&2
|
||||
command cp -Rf $fisher_cache/$pkg $fisher_data/$pkg/..
|
||||
else
|
||||
command rm -Rf $fisher_data/$pkg
|
||||
echo fisher: cannot add \"$pkg\" -- is this a valid plugin\? >&2
|
||||
end
|
||||
" >/dev/null &
|
||||
set pkg_jobs $pkg_jobs (_fisher_jobs --last)
|
||||
set next_pkgs $next_pkgs "$fisher_data/$pkg"
|
||||
end
|
||||
end
|
||||
|
||||
if set -q pkg_jobs[1]
|
||||
while for job in $pkg_jobs
|
||||
contains -- $job (_fisher_jobs); and break
|
||||
end
|
||||
end
|
||||
for pkg in $next_pkgs
|
||||
if test -d "$pkg"
|
||||
set out_pkgs $out_pkgs $pkg
|
||||
_fisher_add $pkg
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set -l local_prefix $fisher_data/local/$USER
|
||||
if test ! -d "$local_prefix"
|
||||
command mkdir -p $local_prefix
|
||||
end
|
||||
for pkg in $local_pkgs
|
||||
set -l target $local_prefix/(command basename $pkg)
|
||||
if test ! -L "$target"
|
||||
command ln -sf $pkg $target
|
||||
set out_pkgs $out_pkgs $pkg
|
||||
_fisher_add $pkg --link
|
||||
end
|
||||
end
|
||||
|
||||
if set -q out_pkgs[1]
|
||||
_fisher_fetch (
|
||||
for pkg in $out_pkgs
|
||||
if test -s "$pkg/fishfile"
|
||||
_fisher_fmt <$pkg/fishfile | _fisher_parse -R
|
||||
end
|
||||
end)
|
||||
printf "%s\n" $out_pkgs | _fisher_fmt
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_add -a pkg opts
|
||||
for src in $pkg/{functions,completions,conf.d}/**.* $pkg/*.fish
|
||||
set -l target (command basename $src)
|
||||
switch $src
|
||||
case $pkg/conf.d\*
|
||||
set target $fisher_path/conf.d/$target
|
||||
case $pkg/completions\*
|
||||
set target $fisher_path/completions/$target
|
||||
case $pkg/{functions,}\*
|
||||
switch $target
|
||||
case uninstall.fish
|
||||
continue
|
||||
case {init,key_bindings}.fish
|
||||
set target $fisher_path/conf.d/(command basename $pkg)\_$target
|
||||
case \*
|
||||
set target $fisher_path/functions/$target
|
||||
end
|
||||
end
|
||||
echo "linking $target" | command sed "s|$HOME|~|" >&2
|
||||
if set -q opts[1]
|
||||
command ln -sf $src $target
|
||||
else
|
||||
command cp -f $src $target
|
||||
end
|
||||
switch $target
|
||||
case \*.fish
|
||||
source $target >/dev/null 2>/dev/null
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_rm -a pkg
|
||||
for src in $pkg/{conf.d,completions,functions}/**.* $pkg/*.fish
|
||||
set -l target (command basename $src)
|
||||
set -l filename (command basename $target .fish)
|
||||
switch $src
|
||||
case $pkg/conf.d\*
|
||||
test "$filename.fish" = "$target"; and emit "$filename"_uninstall
|
||||
set target conf.d/$target
|
||||
case $pkg/completions\*
|
||||
test "$filename.fish" = "$target"; and complete -ec $filename
|
||||
set target completions/$target
|
||||
case $pkg/{,functions}\*
|
||||
test "$filename.fish" = "$target"; and functions -e $filename
|
||||
switch $target
|
||||
case uninstall.fish
|
||||
source $src
|
||||
continue
|
||||
case {init,key_bindings}.fish
|
||||
set target conf.d/(command basename $pkg)\_$target
|
||||
case \*
|
||||
set target functions/$target
|
||||
end
|
||||
end
|
||||
command rm -f $fisher_path/$target
|
||||
end
|
||||
if not functions -q fish_prompt
|
||||
source "$__fish_datadir$__fish_data_dir/functions/fish_prompt.fish"
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_jobs
|
||||
jobs $argv | command awk '/^[0-9]+\t/ { print $1 }'
|
||||
end
|
||||
|
||||
function _fisher_now -a elapsed
|
||||
switch (command uname)
|
||||
case Darwin \*BSD
|
||||
command perl -MTime::HiRes -e 'printf("%.0f\n", (Time::HiRes::time() * 1000) - $ARGV[0])' $elapsed
|
||||
case \*
|
||||
math (command date "+%s%3N") - "0$elapsed"
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1 @@
|
|||
/home/ygg/.local/share/nvim/plugged/fzf/shell/key-bindings.fish
|
||||
|
|
@ -0,0 +1,232 @@
|
|||
set -g nvm_version 1.1.0
|
||||
|
||||
function nvm -a cmd -d "Node.js version manager"
|
||||
set -q XDG_CONFIG_HOME; or set XDG_CONFIG_HOME ~/.config
|
||||
set -g nvm_config $XDG_CONFIG_HOME/nvm
|
||||
set -g nvm_file .nvmrc
|
||||
set -q nvm_mirror; or set -g nvm_mirror "https://nodejs.org/dist"
|
||||
|
||||
if test ! -d $nvm_config
|
||||
command mkdir -p $nvm_config
|
||||
end
|
||||
|
||||
switch "$cmd"
|
||||
case ls list
|
||||
set -e argv[1]
|
||||
_nvm_ls $argv
|
||||
case use
|
||||
set -e argv[1]
|
||||
_nvm_use $argv
|
||||
case ""
|
||||
if isatty
|
||||
if set -l root (_nvm_find_up (pwd) $nvm_file)
|
||||
read cmd <$root/$nvm_file
|
||||
end
|
||||
else
|
||||
read cmd
|
||||
end
|
||||
if not set -q cmd[1]
|
||||
echo "nvm: version or .nvmrc file missing" >&2
|
||||
_nvm_help >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
_nvm_use $cmd
|
||||
case {,-}-v{ersion,}
|
||||
echo "nvm version $nvm_version"
|
||||
case {,-}-h{elp,}
|
||||
_nvm_help
|
||||
case complete
|
||||
_nvm_complete "$nvm_config/index"
|
||||
case \*
|
||||
echo "nvm: unknown flag or command \"$cmd\"" >&2
|
||||
_nvm_help >&2
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
function _nvm_help
|
||||
echo "usage: nvm --help Show this help"
|
||||
echo " nvm --version Show the current version of nvm"
|
||||
echo " nvm ls [<regex>] List available versions matching <regex>"
|
||||
echo " nvm use <version> Download <version> and modify PATH to use it"
|
||||
echo " nvm Use version in .nvmrc (or stdin if not a tty)"
|
||||
echo "examples:"
|
||||
echo " nvm use 14"
|
||||
echo " nvm use lts"
|
||||
echo " nvm use latest"
|
||||
echo " nvm use dubnium"
|
||||
echo " nvm ls '^1|9\$'"
|
||||
echo " nvm ls 12"
|
||||
echo " nvm <file"
|
||||
end
|
||||
|
||||
function _nvm_complete -a index
|
||||
if test -s "$index"
|
||||
for alias in (command awk '
|
||||
$4 {
|
||||
for (i = split($4, alias, "|"); i; i--)
|
||||
if (!seen[alias[i]]++) print alias[i]
|
||||
}
|
||||
$2 != "-" && !seen[$2]++ { print $2 } { print $1 }
|
||||
' <$index)
|
||||
complete -xc nvm -n "__fish_seen_subcommand_from use" -a $alias
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _nvm_get_index
|
||||
set -l index "$nvm_config/index"
|
||||
set -q nvm_index_update_interval; or set -g nvm_index_update_interval 0
|
||||
|
||||
if test ! -e $index -o (math (command date +%s) - $nvm_index_update_interval) -gt 120
|
||||
command curl -sS $nvm_mirror/index.tab | command awk -v OFS=\t '
|
||||
NR > 1 && !/^v0\.[1-9]\./ {
|
||||
split($1 = substr($1, 2), v, ".")
|
||||
is_latest = NR == 2
|
||||
alias = ($10 = tolower($10)) == "-" ? "" : "lts|"$10
|
||||
is_lts = alias != ""
|
||||
print $1, (/^0/ ? "-" : v[1]), v[1]"."v[2],
|
||||
is_latest ? is_lts ? alias"|latest" : "latest" : is_lts ? alias : ""
|
||||
}
|
||||
' >$index 2>/dev/null
|
||||
|
||||
if test ! -s "$index"
|
||||
echo "nvm: invalid mirror index -- is \"$nvm_mirror\" a valid host?" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
_nvm_complete $index
|
||||
set -g nvm_index_update_interval (command date +%s)
|
||||
end
|
||||
|
||||
echo $index
|
||||
end
|
||||
|
||||
function _nvm_ls -a query
|
||||
set -l index (_nvm_get_index); or return
|
||||
test -s "$nvm_config/version"; and read -l current <"$nvm_config/version"
|
||||
command awk -v current="$current" '
|
||||
$1 ~ /'"$query"'/ {
|
||||
gsub(/\|/, "/", $4)
|
||||
out[n++] = $1
|
||||
out[n++] = $4 ($1 == current ? ($4 ? "/" : "") "current" : "")
|
||||
pad = pad < length($1) ? length($1) : pad
|
||||
}
|
||||
END {
|
||||
for (i = n - 1; i > 0; i -= 2) {
|
||||
printf("%"pad"s %s\n", out[i - 1] , out[i] ? "("out[i]")": "")
|
||||
}
|
||||
}
|
||||
' <$index 2>/dev/null
|
||||
end
|
||||
|
||||
function _nvm_resolve_version
|
||||
set -l index (_nvm_get_index); or return
|
||||
set -l ver (command awk -v ver="$argv[1]" '
|
||||
BEGIN {
|
||||
if (match(ver, /v[0-9]/)) gsub(/^[ \t]*v|[ \t]*$/, "", ver)
|
||||
if ((n = split(tolower(ver), a, "/")) > 3) exit
|
||||
for (ver = a[1]; n > 0; n--) {
|
||||
if (a[n] != "*" && a[n] != "latest" && (ver = a[n]) != "lts")
|
||||
break
|
||||
}
|
||||
}
|
||||
ver == $1"" || ver == $2"" || ver == $3"" || $4 && ver ~ $4 {
|
||||
print $1
|
||||
exit
|
||||
}
|
||||
' <$index 2>/dev/null)
|
||||
|
||||
if not set -q ver[1]
|
||||
return 1
|
||||
end
|
||||
|
||||
echo $ver
|
||||
end
|
||||
|
||||
function _nvm_use
|
||||
set -l index (_nvm_get_index); or return
|
||||
set -l ver (_nvm_resolve_version $argv[1])
|
||||
|
||||
if not set -q ver[1]
|
||||
echo "nvm: invalid version number or alias: \"$argv[1]\"" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
if test ! -d "$nvm_config/$ver/bin"
|
||||
set -l os
|
||||
set -l arch
|
||||
set -l name "node-v$ver"
|
||||
set -l target "$nvm_config/$ver"
|
||||
switch (uname -s)
|
||||
case Linux
|
||||
set os linux
|
||||
switch (uname -m)
|
||||
case x86_64
|
||||
set arch x64
|
||||
case armv6 armv6l
|
||||
set arch armv6l
|
||||
case armv7 armv7l
|
||||
set arch armv7l
|
||||
case armv8 armv8l aarch64
|
||||
set arch arm64
|
||||
case \*
|
||||
set arch x86
|
||||
end
|
||||
set name "$name-linux-$arch.tar.gz"
|
||||
case Darwin
|
||||
set os darwin
|
||||
set arch x64
|
||||
case \*
|
||||
echo "nvm: OS not implemented -- request it on https://git.io/fish-nvm" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l name "node-v$ver-$os-$arch"
|
||||
set -l url $nvm_mirror/v$ver/$name
|
||||
|
||||
echo "fetching $url" >&2
|
||||
command mkdir -p $target/$name
|
||||
|
||||
if not command curl -L --fail --progress-bar $url.tar.gz | command tar -xzf- -C $target/$name
|
||||
command rm -rf $target
|
||||
echo "nvm: fetch error -- are you offline?" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
command mv -f $target/$name/$name $nvm_config/$ver.
|
||||
command rm -rf $target
|
||||
command mv -f $nvm_config/$ver. $target
|
||||
end
|
||||
|
||||
if test -s "$nvm_config/version"
|
||||
read -l last <"$nvm_config/version"
|
||||
if set -l i (contains -i -- "$nvm_config/$last/bin" $fish_user_paths)
|
||||
set -e fish_user_paths[$i]
|
||||
end
|
||||
end
|
||||
|
||||
if set -l root (_nvm_find_up (pwd) $nvm_file)
|
||||
read -l line <$root/$nvm_file
|
||||
if test $ver != (_nvm_resolve_version $line)
|
||||
echo $argv[1] >$root/$nvm_file
|
||||
end
|
||||
end
|
||||
|
||||
echo $ver >$nvm_config/version
|
||||
|
||||
if not contains -- "$nvm_config/$ver/bin" $fish_user_paths
|
||||
set -U fish_user_paths "$nvm_config/$ver/bin" $fish_user_paths
|
||||
end
|
||||
end
|
||||
|
||||
function _nvm_find_up -a path file
|
||||
if test -e "$path/$file"
|
||||
echo $path
|
||||
else if test "$path" != /
|
||||
_nvm_find_up (command dirname $path) $file
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# Defined in /tmp/fish.nJXl9C/pacmd-loopback.fish @ line 1
|
||||
function pacmd-loopback --description 'Loop a pacmd source into a pacmd sink interactively.'
|
||||
if test (set source (pacmd list-sources | grep name: | awk '{ print $2 }' | cut -d'<' -f2 | cut -d'>' -f1 | fzf-tmux --header="Select a source" --phony); set sink (pacmd list-sinks | grep name: | awk '{ print $2 }' | cut -d'<' -f2 | cut -d'>' -f1 | fzf-tmux --header="Select a sink:"); printf "No\nYes" | fzf-tmux --header="CONFIRM: <$source> -> <$sink>") = "Yes"
|
||||
pacmd load-module module-loopback source=$source sink=$sink
|
||||
else
|
||||
echo "Aborted."
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#Regex for shortning prompt(after$args_pre) : -e 's-\([^/.]\)[^/]*/-\1/-g'
|
||||
|
||||
function prompt_pwd --description 'Print the current working directory, shortened to fit the prompt'
|
||||
set -l args_post
|
||||
set -l args_pre
|
||||
set -l realhome ~
|
||||
echo $PWD | sed -e "s|^$realhome|~|" $args_pre $args_post
|
||||
end
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
/home/ygg/.rsvm/rsvm.fish
|
||||
Loading…
Reference in New Issue