Configure for .stowrc
This commit is contained in:
parent
e58bb4c0a0
commit
1091129506
132 changed files with 4 additions and 18 deletions
3
slackware/home/fish/.config/fish/completions/awsume.fish
Normal file
3
slackware/home/fish/.config/fish/completions/awsume.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
#Auto-Complete function for AWSume
|
||||
complete --command awsume --arguments '(awsume-autocomplete)'
|
||||
7
slackware/home/fish/.config/fish/completions/fisher.fish
Normal file
7
slackware/home/fish/.config/fish/completions/fisher.fish
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
complete --command fisher --exclusive --long help --description "Print help"
|
||||
complete --command fisher --exclusive --long version --description "Print version"
|
||||
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments install --description "Install plugins"
|
||||
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments update --description "Update installed plugins"
|
||||
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments remove --description "Remove installed plugins"
|
||||
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments list --description "List installed plugins matching regex"
|
||||
complete --command fisher --exclusive --condition "__fish_seen_subcommand_from update remove" --arguments "(fisher list)"
|
||||
19
slackware/home/fish/.config/fish/completions/nvm.fish
Normal file
19
slackware/home/fish/.config/fish/completions/nvm.fish
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
complete --command nvm --exclusive --long version --description "Print version"
|
||||
complete --command nvm --exclusive --long help --description "Print help"
|
||||
|
||||
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments install --description "Download and activate the specified Node version"
|
||||
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments use --description "Activate a version in the current shell"
|
||||
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list --description "List installed versions"
|
||||
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list-remote --description "List versions available to install matching optional regex"
|
||||
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments current --description "Print the currently-active version"
|
||||
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from install" --arguments "(
|
||||
test -e $nvm_data && string split ' ' <$nvm_data/.index
|
||||
)"
|
||||
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from use" --arguments "(_nvm_list | string split ' ')"
|
||||
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments uninstall --description "Uninstall a version"
|
||||
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from uninstall" --arguments "(
|
||||
_nvm_list | string split ' ' | string replace system ''
|
||||
)"
|
||||
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from use uninstall" --arguments "(
|
||||
set --query nvm_default_version && echo default
|
||||
)"
|
||||
189
slackware/home/fish/.config/fish/completions/watson.fish
Normal file
189
slackware/home/fish/.config/fish/completions/watson.fish
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
# copy this into ~/.config/fish/completions/ to enable autocomplete for the watson time tracker
|
||||
#
|
||||
function __fish_watson_needs_sub -d "provides a list of sub commands"
|
||||
set cmd (commandline -opc)
|
||||
if [ (count $cmd) -eq 1 -a $cmd[1] = 'watson' ]
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
function __fish_watson_using_command -d "determine if watson is using the passed command"
|
||||
set cmd (commandline -opc)
|
||||
if [ (count $cmd) -ge 2 -a $cmd[1] = 'watson' ]
|
||||
if [ $argv[1] = $cmd[2] ]
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
function __fish_watson_get_projects -d "return a list of projects"
|
||||
command watson projects
|
||||
end
|
||||
|
||||
function __fish_watson_get_tags -d "return a list of tags"
|
||||
command watson tags
|
||||
end
|
||||
|
||||
function __fish_watson_has_project -d "determine if watson is using a passed command and if it has a project"
|
||||
set cmd (commandline -opc)
|
||||
if [ (count $cmd) -gt 2 -a $cmd[1] = 'watson' ]
|
||||
if [ $argv[1] = $cmd[2] ]
|
||||
if contains "$cmd[3]" (__fish_watson_get_projects)
|
||||
return 0
|
||||
end
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
function __fish_watson_has_from -d "determine if watson is using a passed command and if it is using from"
|
||||
set cmd (commandline -opc)
|
||||
if [ (count $cmd) -gt 2 -a $cmd[1] = 'watson' ]
|
||||
if [ $argv[1] = $cmd[2] ]
|
||||
if contains -- "$cmd[3]" -f --from
|
||||
return 0
|
||||
end
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
function __fish_watson_get_frames -d "return a list of frames" #TODO, use watson logs to get more info
|
||||
command watson frames
|
||||
end
|
||||
|
||||
function __fish_watson_needs_project -d "check if we need a project"
|
||||
set cmd (commandline -opc)
|
||||
if [ (count $cmd) -ge 2 -a $cmd[1] = 'watson' ]
|
||||
if [ $argv[1] = $cmd[2] ]
|
||||
for i in $cmd
|
||||
if contains $i (__fish_watson_get_projects)
|
||||
return 1 # return 1 because we alredy have a project
|
||||
end
|
||||
end
|
||||
return 0 # we are using $argv as our command and the command does not contain any projects
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
# if a backend.url is set, use it in the command description
|
||||
if [ -e ~/.config/watson/config ]
|
||||
set url_string (command watson config backend.url 2> /dev/null)
|
||||
if test -n "$url_string"
|
||||
set url $url_string
|
||||
end
|
||||
else
|
||||
set url "a remote Crick server"
|
||||
end
|
||||
|
||||
# ungrouped
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a cancel -d "Cancel the last start command"
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a frames -d "Display the list of all frame IDs"
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a help -d "Display help information"
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a projects -d "Display the list of projects"
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a sync -d "sync your work with $url"
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a tags -d "Display the list of tags"
|
||||
|
||||
# add
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a add -d "Add time for project with tag(s) that was not tracked live"
|
||||
complete -f -c watson -n '__fish_watson_using_command add' -s f -l from -d "Start date for add"
|
||||
complete -f -c watson -n '__fish_watson_has_from add' -s t -l to -d "end date for add"
|
||||
complete -f -c watson -n '__fish_watson_using_command add' -s c -l confirm-new-project -d "Confirm addition of new project"
|
||||
complete -f -c watson -n '__fish_watson_using_command add' -s b -l confirm-new-tag -d "Confirm addition of new tag"
|
||||
|
||||
# aggregate
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a aggregate -d "Display a report of the time spent on each project aggregated by day"
|
||||
complete -f -c watson -n '__fish_watson_using_command aggregate' -s c -l current -d "include the running frame"
|
||||
complete -f -c watson -n '__fish_watson_using_command aggregate' -s C -l no-current -d "exclude the running frame (default)"
|
||||
complete -f -c watson -n '__fish_watson_using_command aggregate' -s f -l from -d "Start date for aggregate"
|
||||
complete -f -c watson -n '__fish_watson_has_from aggregate' -s t -l to -d "end date for aggregate"
|
||||
complete -f -c watson -n '__fish_watson_using_command aggregate' -s p -l project -d "restrict to project" -a "(__fish_watson_get_projects)"
|
||||
complete -f -c watson -n '__fish_watson_using_command aggregate' -s T -l tag -d "restrict to tag" -a "(__fish_watson_get_tags)"
|
||||
complete -f -c watson -n '__fish_watson_using_command aggregate' -s j -l json -d "output json"
|
||||
complete -f -c watson -n '__fish_watson_using_command aggregate' -s s -l csv -d "output csv"
|
||||
complete -f -c watson -n '__fish_watson_using_command aggregate' -s g -l pager -d "view through pager"
|
||||
complete -f -c watson -n '__fish_watson_using_command aggregate' -s G -l no-pager -d "don't vew through pager"
|
||||
|
||||
# config
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a config -d "Get and set configuration options"
|
||||
complete -f -c watson -n '__fish_watson_using_command config' -s e -l edit -d "Edit the config with an editor"
|
||||
|
||||
# edit
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a edit -d "Edit a frame"
|
||||
complete -f -c watson -n '__fish_watson_using_command edit' -a "(__fish_watson_get_frames)"
|
||||
|
||||
# log
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a log -d "Display sessions during the given timespan"
|
||||
complete -f -c watson -n '__fish_watson_using_command log' -s c -l current -d "include the running frame"
|
||||
complete -f -c watson -n '__fish_watson_using_command log' -s C -l no-current -d "exclude the running frame (default)"
|
||||
complete -f -c watson -n '__fish_watson_using_command log' -s f -l from -d "Start date for log"
|
||||
complete -f -c watson -n '__fish_watson_has_from log' -s t -l to -d "end date for log"
|
||||
complete -f -c watson -n '__fish_watson_using_command log' -s y -l year -d "show the last year"
|
||||
complete -f -c watson -n '__fish_watson_using_command log' -s m -l month -d "show the last month"
|
||||
complete -f -c watson -n '__fish_watson_using_command log' -s l -l luna -d "show the last lunar cycle"
|
||||
complete -f -c watson -n '__fish_watson_using_command log' -s w -l week -d "show week-to-day"
|
||||
complete -f -c watson -n '__fish_watson_using_command log' -s d -l day -d "show today"
|
||||
complete -f -c watson -n '__fish_watson_using_command log' -s a -l all -d "show all"
|
||||
complete -f -c watson -n '__fish_watson_using_command log' -s p -l project -d "restrict to project" -a "(__fish_watson_get_projects)"
|
||||
complete -f -c watson -n '__fish_watson_using_command log' -s T -l tag -d "restrict to tag" -a "(__fish_watson_get_tags)"
|
||||
complete -f -c watson -n '__fish_watson_using_command log' -s j -l json -d "output json"
|
||||
complete -f -c watson -n '__fish_watson_using_command log' -s s -l csv -d "output csv"
|
||||
complete -f -c watson -n '__fish_watson_using_command log' -s g -l pager -d "view through pager"
|
||||
complete -f -c watson -n '__fish_watson_using_command log' -s G -l no-pager -d "don't vew through pager"
|
||||
|
||||
# merge
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a merge -d "merge existing frames with conflicting ones"
|
||||
complete -f -c watson -n '__fish_watson_using_command merge' -s f -l force -d "silently merge"
|
||||
|
||||
# remove
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a remove -d "Remove a frame"
|
||||
complete -f -c watson -n '__fish_watson_using_command remove' -a "(__fish_watson_get_frames)"
|
||||
complete -f -c watson -n '__fish_watson_using_command remove' -s f -l force -d "silently remove"
|
||||
|
||||
# rename
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a rename -d "Rename a project or tag"
|
||||
complete -f -c watson -n '__fish_watson_using_command rename' -a "(__fish_watson_get_projects) (__fish_watson_get_tags)"
|
||||
|
||||
# report
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a report -d "Display a report of time spent"
|
||||
complete -f -c watson -n '__fish_watson_using_command report' -s c -l current -d "include the running frame"
|
||||
complete -f -c watson -n '__fish_watson_using_command report' -s C -l no-current -d "exclude the running frame (default)"
|
||||
complete -f -c watson -n '__fish_watson_using_command report' -s f -l from -d "Start date for report"
|
||||
complete -f -c watson -n '__fish_watson_has_from report' -s t -l to -d "end date for report"
|
||||
complete -f -c watson -n '__fish_watson_using_command report' -s y -l year -d "show the last year"
|
||||
complete -f -c watson -n '__fish_watson_using_command report' -s m -l month -d "show the last month"
|
||||
complete -f -c watson -n '__fish_watson_using_command report' -s l -l luna -d "show the last lunar cycle"
|
||||
complete -f -c watson -n '__fish_watson_using_command report' -s w -l week -d "show week-to-day"
|
||||
complete -f -c watson -n '__fish_watson_using_command report' -s d -l day -d "show today"
|
||||
complete -f -c watson -n '__fish_watson_using_command report' -s a -l all -d "show all"
|
||||
complete -f -c watson -n '__fish_watson_using_command report' -s p -l project -d "restrict to project" -a "(__fish_watson_get_projects)"
|
||||
complete -f -c watson -n '__fish_watson_using_command report' -s T -l tag -d "restrict to tag" -a "(__fish_watson_get_tags)"
|
||||
complete -f -c watson -n '__fish_watson_using_command report' -s j -l json -d "output json"
|
||||
complete -f -c watson -n '__fish_watson_using_command report' -s s -l csv -d "output csv"
|
||||
complete -f -c watson -n '__fish_watson_using_command report' -s g -l pager -d "view through pager"
|
||||
complete -f -c watson -n '__fish_watson_using_command report' -s G -l no-pager -d "don't vew through pager"
|
||||
|
||||
# restart
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a restart -d "Restart monitoring time for a stopped project"
|
||||
complete -f -c watson -n '__fish_watson_using_command restart' -s s -l stop -d "stop running project"
|
||||
complete -f -c watson -n '__fish_watson_using_command restart' -s S -l no-stop -d "do not stop running project"
|
||||
complete -f -c watson -n '__fish_watson_using_command restart' -a "(__fish_watson_get_frames)"
|
||||
|
||||
# start
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a start -d "Start monitoring time for a project"
|
||||
complete -f -c watson -n '__fish_watson_needs_project start' -a "(__fish_watson_get_projects)"
|
||||
complete -f -c watson -n '__fish_watson_has_project start' -a "+(__fish_watson_get_tags)"
|
||||
|
||||
# status
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a status -d "Display when the current project was started and time spent"
|
||||
complete -f -c watson -n '__fish_watson_using_command status' -s p -l project -d "only show project"
|
||||
complete -f -c watson -n '__fish_watson_using_command status' -s t -l tags -d "only show tags"
|
||||
complete -f -c watson -n '__fish_watson_using_command status' -s e -l elapsed -d "only show elapsed time"
|
||||
|
||||
# stop
|
||||
complete -f -c watson -n '__fish_watson_needs_sub' -a stop -d "Stop monitoring time for the current project"
|
||||
complete -f -c watson -n '__fish_watson_using_command stop' -l at -d "Stop frame at this time (YYYY-MM-DDT)?HH:MM(:SS)?"
|
||||
28
slackware/home/fish/.config/fish/conf.d/nvm.fish
Normal file
28
slackware/home/fish/.config/fish/conf.d/nvm.fish
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
function _nvm_install --on-event nvm_install
|
||||
set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
|
||||
set --universal nvm_data $XDG_DATA_HOME/nvm
|
||||
set --query nvm_mirror || set --universal nvm_mirror https://nodejs.org/dist
|
||||
|
||||
test ! -d $nvm_data && command mkdir -p $nvm_data
|
||||
echo "Downloading the Node distribution index..." 2>/dev/null
|
||||
_nvm_index_update $nvm_mirror $nvm_data/.index
|
||||
end
|
||||
|
||||
function _nvm_update --on-event nvm_update
|
||||
set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
|
||||
set --universal nvm_data $XDG_DATA_HOME/nvm
|
||||
set --query nvm_mirror || set --universal nvm_mirror https://nodejs.org/dist
|
||||
end
|
||||
|
||||
function _nvm_uninstall --on-event nvm_uninstall
|
||||
command rm -rf $nvm_data
|
||||
|
||||
set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version
|
||||
|
||||
set --names | string replace --filter --regex -- "^nvm" "set --erase nvm" | source
|
||||
functions --erase (functions --all | string match --entire --regex -- "^_nvm_")
|
||||
end
|
||||
|
||||
if status is-interactive && set --query nvm_default_version && ! set --query nvm_current_version
|
||||
nvm use $nvm_default_version >/dev/null
|
||||
end
|
||||
7
slackware/home/fish/.config/fish/conf.d/omf.fish
Normal file
7
slackware/home/fish/.config/fish/conf.d/omf.fish
Normal file
|
|
@ -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
|
||||
15
slackware/home/fish/.config/fish/config.fish
Normal file
15
slackware/home/fish/.config/fish/config.fish
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
set EDITOR vim
|
||||
set PAGER bat
|
||||
set BROWSER firefox
|
||||
|
||||
# if status --is-interactive
|
||||
# set BASE16_SHELL "$HOME/.config/base16-shell/"
|
||||
# source "$BASE16_SHELL/profile_helper.fish"
|
||||
# end
|
||||
|
||||
begin
|
||||
set --local AUTOJUMP_PATH $HOME/.config/fish/functions/autojump.fish
|
||||
if test -e $AUTOJUMP_PATH
|
||||
source $AUTOJUMP_PATH
|
||||
end
|
||||
end
|
||||
2
slackware/home/fish/.config/fish/fish_plugins
Normal file
2
slackware/home/fish/.config/fish/fish_plugins
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
jorgebucaran/fisher
|
||||
jorgebucaran/nvm.fish
|
||||
38
slackware/home/fish/.config/fish/fish_variables
Normal file
38
slackware/home/fish/.config/fish/fish_variables
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# This file contains fish universal variable definitions.
|
||||
# VERSION: 3.0
|
||||
SETUVAR __fish_initialized:3400
|
||||
SETUVAR _fish_abbr_mux:tmuxinator
|
||||
SETUVAR _fisher_jorgebucaran_2F_fisher_files:/Users/iankeane/\x2econfig/fish/functions/fisher\x2efish\x1e/Users/iankeane/\x2econfig/fish/completions/fisher\x2efish
|
||||
SETUVAR _fisher_jorgebucaran_2F_nvm_2E_fish_files:/Users/iankeane/\x2econfig/fish/functions/_nvm_index_update\x2efish\x1e/Users/iankeane/\x2econfig/fish/functions/_nvm_list\x2efish\x1e/Users/iankeane/\x2econfig/fish/functions/_nvm_version_activate\x2efish\x1e/Users/iankeane/\x2econfig/fish/functions/_nvm_version_deactivate\x2efish\x1e/Users/iankeane/\x2econfig/fish/functions/nvm\x2efish\x1e/Users/iankeane/\x2econfig/fish/conf\x2ed/nvm\x2efish\x1e/Users/iankeane/\x2econfig/fish/completions/nvm\x2efish
|
||||
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1ejorgebucaran/nvm\x2efish
|
||||
SETUVAR fish_color_autosuggestion:555\x1ebrblack
|
||||
SETUVAR fish_color_cancel:\x2dr
|
||||
SETUVAR fish_color_command:005fd7
|
||||
SETUVAR fish_color_comment:990000
|
||||
SETUVAR fish_color_cwd:green
|
||||
SETUVAR fish_color_cwd_root:red
|
||||
SETUVAR fish_color_end:009900
|
||||
SETUVAR fish_color_error:ff0000
|
||||
SETUVAR fish_color_escape:00a6b2
|
||||
SETUVAR fish_color_history_current:\x2d\x2dbold
|
||||
SETUVAR fish_color_host:normal
|
||||
SETUVAR fish_color_host_remote:yellow
|
||||
SETUVAR fish_color_normal:normal
|
||||
SETUVAR fish_color_operator:00a6b2
|
||||
SETUVAR fish_color_param:00afff
|
||||
SETUVAR fish_color_quote:999900
|
||||
SETUVAR fish_color_redirection:00afff
|
||||
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SETUVAR fish_color_status:red
|
||||
SETUVAR fish_color_user:brgreen
|
||||
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
||||
SETUVAR fish_key_bindings:fish_vi_key_bindings
|
||||
SETUVAR fish_pager_color_completion:\x1d
|
||||
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
|
||||
SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
||||
SETUVAR fish_pager_color_selected_background:\x2dr
|
||||
SETUVAR fish_user_paths:/home/green/scripts\x1e/home/green/\x2elocal/bin\x1e/home/green/\x2ecargo/bin\x1e/usr/games\x1e/Users/iankeane/\x2elocal/bin\x1e/Users/iankeane/\x2egem/ruby/3\x2e1\x2e0/bin\x1e/usr/local/Cellar/ruby/3\x2e1\x2e2/bin
|
||||
SETUVAR nvm_data:/Users/iankeane/\x2elocal/share/nvm
|
||||
SETUVAR nvm_mirror:https\x3a//nodejs\x2eorg/dist
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
function _nvm_index_update --argument-names mirror index
|
||||
if not command curl --location --silent $mirror/index.tab >$index.temp
|
||||
command rm -f $index.temp
|
||||
echo "nvm: Can't update index, host unavailable: \"$mirror\"" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
command awk -v OFS=\t '
|
||||
/v0.9.12/ { exit } # Unsupported
|
||||
NR > 1 {
|
||||
print $1 (NR == 2 ? " latest" : $10 != "-" ? " lts/" tolower($10) : "")
|
||||
}
|
||||
' $index.temp >$index
|
||||
|
||||
command rm -f $index.temp
|
||||
end
|
||||
11
slackware/home/fish/.config/fish/functions/_nvm_list.fish
Normal file
11
slackware/home/fish/.config/fish/functions/_nvm_list.fish
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
function _nvm_list
|
||||
set --local versions $nvm_data/*
|
||||
set --query versions[1] &&
|
||||
string match --entire --regex -- (string match --regex -- "v\d.+" $versions |
|
||||
string escape --style=regex |
|
||||
string join "|"
|
||||
) <$nvm_data/.index
|
||||
|
||||
command --all node |
|
||||
string match --quiet --invert --regex -- "^$nvm_data" && echo system
|
||||
end
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
function _nvm_version_activate --argument-names v
|
||||
set --global --export nvm_current_version $v
|
||||
set --prepend PATH $nvm_data/$v/bin
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
function _nvm_version_deactivate --argument-names v
|
||||
test "$nvm_current_version" = "$v" && set --erase nvm_current_version
|
||||
set --local index (contains --index -- $nvm_data/$v/bin $PATH) &&
|
||||
set --erase PATH[$index]
|
||||
end
|
||||
112
slackware/home/fish/.config/fish/functions/autojump.fish
Normal file
112
slackware/home/fish/.config/fish/functions/autojump.fish
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
set -gx AUTOJUMP_SOURCED 1
|
||||
|
||||
# set user installation path
|
||||
if test -d ~/.autojump
|
||||
set -x PATH ~/.autojump/bin $PATH
|
||||
end
|
||||
|
||||
# Set ostype, if not set
|
||||
if not set -q OSTYPE
|
||||
set -gx OSTYPE (bash -c 'echo ${OSTYPE}')
|
||||
end
|
||||
|
||||
|
||||
# enable tab completion
|
||||
complete -x -c j -a '(autojump --complete (commandline -t))'
|
||||
|
||||
|
||||
# set error file location
|
||||
if test (uname) = "Darwin"
|
||||
set -gx AUTOJUMP_ERROR_PATH ~/Library/autojump/errors.log
|
||||
else if test -d "$XDG_DATA_HOME"
|
||||
set -gx AUTOJUMP_ERROR_PATH $XDG_DATA_HOME/autojump/errors.log
|
||||
else
|
||||
set -gx AUTOJUMP_ERROR_PATH ~/.local/share/autojump/errors.log
|
||||
end
|
||||
|
||||
if test ! -d (dirname $AUTOJUMP_ERROR_PATH)
|
||||
mkdir -p (dirname $AUTOJUMP_ERROR_PATH)
|
||||
end
|
||||
|
||||
|
||||
# change pwd hook
|
||||
function __aj_add --on-variable PWD
|
||||
status --is-command-substitution; and return
|
||||
autojump --add (pwd) >/dev/null 2>>$AUTOJUMP_ERROR_PATH &
|
||||
end
|
||||
|
||||
|
||||
# misc helper functions
|
||||
function __aj_err
|
||||
# TODO(ting|#247): set error file location
|
||||
echo -e $argv 1>&2; false
|
||||
end
|
||||
|
||||
# default autojump command
|
||||
function j
|
||||
switch "$argv"
|
||||
case '-*' '--*'
|
||||
autojump $argv
|
||||
case '*'
|
||||
set -l output (autojump $argv)
|
||||
# Check for . and attempt a regular cd
|
||||
if [ $output = "." ]
|
||||
cd $argv
|
||||
else
|
||||
if test -d "$output"
|
||||
set_color red
|
||||
echo $output
|
||||
set_color normal
|
||||
cd $output
|
||||
else
|
||||
__aj_err "autojump: directory '"$argv"' not found"
|
||||
__aj_err "\n$output\n"
|
||||
__aj_err "Try `autojump --help` for more information."
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# jump to child directory (subdirectory of current path)
|
||||
function jc
|
||||
switch "$argv"
|
||||
case '-*'
|
||||
j $argv
|
||||
case '*'
|
||||
j (pwd) $argv
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# open autojump results in file browser
|
||||
function jo
|
||||
set -l output (autojump $argv)
|
||||
if test -d "$output"
|
||||
switch $OSTYPE
|
||||
case 'linux*'
|
||||
xdg-open (autojump $argv)
|
||||
case 'darwin*'
|
||||
open (autojump $argv)
|
||||
case cygwin
|
||||
cygstart "" (cygpath -w -a (pwd))
|
||||
case '*'
|
||||
__aj_err "Unknown operating system: \"$OSTYPE\""
|
||||
end
|
||||
else
|
||||
__aj_err "autojump: directory '"$argv"' not found"
|
||||
__aj_err "\n$output\n"
|
||||
__aj_err "Try `autojump --help` for more information."
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# open autojump results (child directory) in file browser
|
||||
function jco
|
||||
switch "$argv"
|
||||
case '-*'
|
||||
j $argv
|
||||
case '*'
|
||||
jo (pwd) $argv
|
||||
end
|
||||
end
|
||||
3
slackware/home/fish/.config/fish/functions/awsume.fish
Normal file
3
slackware/home/fish/.config/fish/functions/awsume.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
#AWSume alias to source the AWSume script
|
||||
alias awsume="source (which awsume.fish)"
|
||||
19
slackware/home/fish/.config/fish/functions/br.fish
Normal file
19
slackware/home/fish/.config/fish/functions/br.fish
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
# This script was automatically generated by the broot program
|
||||
# More information can be found in https://github.com/Canop/broot
|
||||
# This function starts broot and executes the command
|
||||
# it produces, if any.
|
||||
# It's needed because some shell commands, like `cd`,
|
||||
# have no useful effect if executed in a subshell.
|
||||
function br --wraps=broot
|
||||
set -l cmd_file (mktemp)
|
||||
if broot --outcmd $cmd_file $argv
|
||||
read --local --null cmd < $cmd_file
|
||||
rm -f $cmd_file
|
||||
eval $cmd
|
||||
else
|
||||
set -l code $status
|
||||
rm -f $cmd_file
|
||||
return $code
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
function dunsttest --wraps='notify-send -u low "test" && notify-send -u normal "test" && notify-send -u critical "test"' --description 'alias dunsttest notify-send -u low "test" && notify-send -u normal "test" && notify-send -u critical "test"'
|
||||
notify-send -u low "test" && notify-send -u normal "test" && notify-send -u critical "test" $argv;
|
||||
end
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
function fish_mode_prompt
|
||||
# NOOP - Disable vim mode indicator
|
||||
end
|
||||
48
slackware/home/fish/.config/fish/functions/fish_prompt.fish
Normal file
48
slackware/home/fish/.config/fish/functions/fish_prompt.fish
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
function fish_prompt
|
||||
set -l last_command_status $status
|
||||
|
||||
set -l symbol 'π'
|
||||
|
||||
set -l normal_color (set_color normal)
|
||||
set -l branch_color (set_color yellow)
|
||||
set -l meta_color (set_color red)
|
||||
set -l symbol_color (set_color blue -o)
|
||||
set -l error_color (set_color red -o)
|
||||
|
||||
if git_is_repo
|
||||
echo -n -s $branch_color (git_branch_name) $normal_color
|
||||
set -l git_meta ""
|
||||
if test (command git ls-files --others --exclude-standard | wc -w 2> /dev/null) -gt 0
|
||||
set git_meta "$git_meta?"
|
||||
end
|
||||
if test (command git rev-list --walk-reflogs --count refs/stash 2> /dev/null)
|
||||
set git_meta "$git_meta\$"
|
||||
end
|
||||
if git_is_touched
|
||||
git_is_dirty && set git_meta "$git_meta⨯"
|
||||
git_is_staged && set git_meta "$git_meta●"
|
||||
end
|
||||
set -l commit_count (command git rev-list --count --left-right (git remote)/(git_branch_name)"...HEAD" 2> /dev/null)
|
||||
if test $commit_count
|
||||
set -l behind (echo $commit_count | cut -f 1)
|
||||
set -l ahead (echo $commit_count | cut -f 2)
|
||||
if test $behind -gt 0
|
||||
set git_meta "$git_meta🠋"
|
||||
end
|
||||
if test $ahead -gt 0
|
||||
set git_meta "$git_meta🠉"
|
||||
end
|
||||
end
|
||||
if test $git_meta
|
||||
echo -n -s $meta_color " " $git_meta " " $normal_color
|
||||
else
|
||||
echo -n -s " "
|
||||
end
|
||||
end
|
||||
|
||||
if test $last_command_status -eq 0
|
||||
echo -n -s $symbol_color $symbol " " $normal_color
|
||||
else
|
||||
echo -n -s $error_color $symbol " " $normal_color
|
||||
end
|
||||
end
|
||||
211
slackware/home/fish/.config/fish/functions/fisher.fish
Normal file
211
slackware/home/fish/.config/fish/functions/fisher.fish
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
function fisher --argument-names cmd --description "A plugin manager for Fish"
|
||||
set --query fisher_path || set --local fisher_path $__fish_config_dir
|
||||
set --local fisher_version 4.3.1
|
||||
set --local fish_plugins $__fish_config_dir/fish_plugins
|
||||
|
||||
switch "$cmd"
|
||||
case -v --version
|
||||
echo "fisher, version $fisher_version"
|
||||
case "" -h --help
|
||||
echo "Usage: fisher install <plugins...> Install plugins"
|
||||
echo " fisher remove <plugins...> Remove installed plugins"
|
||||
echo " fisher update <plugins...> Update installed plugins"
|
||||
echo " fisher update Update all installed plugins"
|
||||
echo " fisher list [<regex>] List installed plugins matching regex"
|
||||
echo "Options:"
|
||||
echo " -v or --version Print version"
|
||||
echo " -h or --help Print this help message"
|
||||
echo "Variables:"
|
||||
echo " \$fisher_path Plugin installation path. Default: ~/.config/fish"
|
||||
case ls list
|
||||
string match --entire --regex -- "$argv[2]" $_fisher_plugins
|
||||
case install update remove
|
||||
isatty || read --local --null --array stdin && set --append argv $stdin
|
||||
|
||||
set --local install_plugins
|
||||
set --local update_plugins
|
||||
set --local remove_plugins
|
||||
set --local arg_plugins $argv[2..-1]
|
||||
set --local old_plugins $_fisher_plugins
|
||||
set --local new_plugins
|
||||
|
||||
if ! set --query argv[2]
|
||||
if test "$cmd" != update
|
||||
echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1
|
||||
else if test ! -e $fish_plugins
|
||||
echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1
|
||||
end
|
||||
set arg_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins)
|
||||
end
|
||||
|
||||
for plugin in $arg_plugins
|
||||
test -e "$plugin" && set plugin (realpath $plugin)
|
||||
contains -- "$plugin" $new_plugins || set --append new_plugins $plugin
|
||||
end
|
||||
|
||||
if set --query argv[2]
|
||||
for plugin in $new_plugins
|
||||
if contains -- "$plugin" $old_plugins
|
||||
test "$cmd" = remove &&
|
||||
set --append remove_plugins $plugin ||
|
||||
set --append update_plugins $plugin
|
||||
else if test "$cmd" = install
|
||||
set --append install_plugins $plugin
|
||||
else
|
||||
echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1
|
||||
end
|
||||
end
|
||||
else
|
||||
for plugin in $new_plugins
|
||||
contains -- "$plugin" $old_plugins &&
|
||||
set --append update_plugins $plugin ||
|
||||
set --append install_plugins $plugin
|
||||
end
|
||||
|
||||
for plugin in $old_plugins
|
||||
contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin
|
||||
end
|
||||
end
|
||||
|
||||
set --local pid_list
|
||||
set --local source_plugins
|
||||
set --local fetch_plugins $update_plugins $install_plugins
|
||||
echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal)
|
||||
|
||||
for plugin in $fetch_plugins
|
||||
set --local source (command mktemp -d)
|
||||
set --append source_plugins $source
|
||||
|
||||
command mkdir -p $source/{completions,conf.d,functions}
|
||||
|
||||
fish --command "
|
||||
if test -e $plugin
|
||||
command cp -Rf $plugin/* $source
|
||||
else
|
||||
set temp (command mktemp -d)
|
||||
set name (string split \@ $plugin) || set name[2] HEAD
|
||||
set url https://codeload.github.com/\$name[1]/tar.gz/\$name[2]
|
||||
|
||||
echo Fetching (set_color --underline)\$url(set_color normal)
|
||||
|
||||
if curl --silent \$url | tar -xzC \$temp -f - 2>/dev/null
|
||||
command cp -Rf \$temp/*/* $source
|
||||
else
|
||||
echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
|
||||
command rm -rf $source
|
||||
end
|
||||
command rm -rf \$temp
|
||||
end
|
||||
|
||||
set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files
|
||||
" &
|
||||
|
||||
set --append pid_list (jobs --last --pid)
|
||||
end
|
||||
|
||||
wait $pid_list 2>/dev/null
|
||||
|
||||
for plugin in $fetch_plugins
|
||||
if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source
|
||||
if set --local index (contains --index -- "$plugin" $install_plugins)
|
||||
set --erase install_plugins[$index]
|
||||
else
|
||||
set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for plugin in $update_plugins $remove_plugins
|
||||
if set --local index (contains --index -- "$plugin" $_fisher_plugins)
|
||||
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
|
||||
|
||||
if contains -- "$plugin" $remove_plugins
|
||||
for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
||||
emit {$name}_uninstall
|
||||
end
|
||||
printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var
|
||||
end
|
||||
|
||||
command rm -rf $$plugin_files_var
|
||||
functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
||||
|
||||
for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
||||
complete --erase --command $name
|
||||
end
|
||||
|
||||
set --erase _fisher_plugins[$index]
|
||||
set --erase $plugin_files_var
|
||||
end
|
||||
end
|
||||
|
||||
if set --query update_plugins[1] || set --query install_plugins[1]
|
||||
command mkdir -p $fisher_path/{functions,conf.d,completions}
|
||||
end
|
||||
|
||||
for plugin in $update_plugins $install_plugins
|
||||
set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)]
|
||||
set --local files $source/{functions,conf.d,completions}/*
|
||||
|
||||
if set --local index (contains --index -- $plugin $install_plugins)
|
||||
set --local user_files $fisher_path/{functions,conf.d,completions}/*
|
||||
set --local conflict_files
|
||||
|
||||
for file in (string replace -- $source/ $fisher_path/ $files)
|
||||
contains -- $file $user_files && set --append conflict_files $file
|
||||
end
|
||||
|
||||
if set --query conflict_files[1] && set --erase install_plugins[$index]
|
||||
echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2
|
||||
continue
|
||||
end
|
||||
end
|
||||
|
||||
for file in (string replace -- $source/ "" $files)
|
||||
command cp -Rf $source/$file $fisher_path/$file
|
||||
end
|
||||
|
||||
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
|
||||
set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files)
|
||||
|
||||
contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin
|
||||
contains -- $plugin $install_plugins && set --local event install || set --local event update
|
||||
|
||||
printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var
|
||||
|
||||
for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var)
|
||||
source $file
|
||||
if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file)
|
||||
emit {$name}_$event
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
command rm -rf $source_plugins
|
||||
|
||||
set --query _fisher_plugins[1] || set --erase _fisher_plugins
|
||||
set --query _fisher_plugins &&
|
||||
printf "%s\n" $_fisher_plugins >$fish_plugins ||
|
||||
command rm -f $fish_plugins
|
||||
|
||||
set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins)
|
||||
test "$total" != "0 0 0" && echo (string join ", " (
|
||||
test $total[1] = 0 || echo "Installed $total[1]") (
|
||||
test $total[2] = 0 || echo "Updated $total[2]") (
|
||||
test $total[3] = 0 || echo "Removed $total[3]")
|
||||
) plugin/s
|
||||
case \*
|
||||
echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1
|
||||
end
|
||||
end
|
||||
|
||||
## Migrations ##
|
||||
function _fisher_fish_postexec --on-event fish_postexec
|
||||
if functions --query _fisher_list
|
||||
fisher update >/dev/null 2>/dev/null
|
||||
set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
|
||||
test -e $XDG_DATA_HOME/fisher && command rm -rf $XDG_DATA_HOME/fisher
|
||||
functions --erase _fisher_list _fisher_plugin_parse
|
||||
set --erase fisher_data
|
||||
end
|
||||
functions --erase _fisher_fish_postexec
|
||||
end
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
function mediamount --wraps='mount_smbfs //wizard:Dexter706@tower/media mnt/media' --description 'alias mediamount=mount_smbfs //wizard:Dexter706@tower/media mnt/media'
|
||||
mount_smbfs //wizard:Dexter706@tower/media mnt/media $argv;
|
||||
end
|
||||
3
slackware/home/fish/.config/fish/functions/now.fish
Normal file
3
slackware/home/fish/.config/fish/functions/now.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
function now --wraps='date +%a%l:%M%p' --wraps=date\ \'+\%a\ \%l:\%M\%p\' --description alias\ now\ date\ \'+\%a\ \%l:\%M\%p\'
|
||||
date '+%a %l:%M%p' $argv;
|
||||
end
|
||||
206
slackware/home/fish/.config/fish/functions/nvm.fish
Normal file
206
slackware/home/fish/.config/fish/functions/nvm.fish
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
function nvm --argument-names cmd v --description "Node version manager"
|
||||
if test -z "$v" && contains -- "$cmd" install use
|
||||
for file in .nvmrc .node-version
|
||||
set file (_nvm_find_up $PWD $file) && read v <$file && break
|
||||
end
|
||||
if test -z "$v"
|
||||
echo "nvm: Invalid version or missing \".nvmrc\" file" >&2
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
switch "$cmd"
|
||||
case -v --version
|
||||
echo "nvm, version 2.2.6"
|
||||
case "" -h --help
|
||||
echo "Usage: nvm install <version> Download and activate the specified Node version"
|
||||
echo " nvm install Install version from nearest .nvmrc file"
|
||||
echo " nvm use <version> Activate a version in the current shell"
|
||||
echo " nvm use Activate version from nearest .nvmrc file"
|
||||
echo " nvm list List installed versions"
|
||||
echo " nvm list-remote List versions available to install"
|
||||
echo " nvm list-remote <regex> List versions matching a given regular expression"
|
||||
echo " nvm current Print the currently-active version"
|
||||
echo " nvm uninstall <version> Uninstall a version"
|
||||
echo "Options:"
|
||||
echo " -v or --version Print version"
|
||||
echo " -h or --help Print this help message"
|
||||
echo "Variables:"
|
||||
echo " nvm_arch Override architecture, e.g. x64-musl"
|
||||
echo " nvm_mirror Set the Node download mirror"
|
||||
echo " nvm_default_version Set the default version for new shells"
|
||||
case install
|
||||
_nvm_index_update $nvm_mirror $nvm_data/.index || return
|
||||
|
||||
string match --entire --regex -- (_nvm_version_match $v) <$nvm_data/.index | read v alias
|
||||
|
||||
if ! set --query v[1]
|
||||
echo "nvm: Invalid version number or alias: \"$argv[2..-1]\"" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
if test ! -e $nvm_data/$v
|
||||
set --local os (command uname -s | string lower)
|
||||
set --local ext tar.gz
|
||||
set --local arch (command uname -m)
|
||||
|
||||
switch $os
|
||||
case aix
|
||||
set arch ppc64
|
||||
case sunos
|
||||
case linux
|
||||
case darwin
|
||||
case {MSYS_NT,MINGW\*_NT}\*
|
||||
set os win
|
||||
set ext zip
|
||||
case \*
|
||||
echo "nvm: Unsupported operating system: \"$os\"" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
switch $arch
|
||||
case i\*86
|
||||
set arch x86
|
||||
case x86_64
|
||||
set arch x64
|
||||
case arm64
|
||||
string match --regex --quiet "v(?<major>\d+)" $v
|
||||
if test "$os" = darwin -a $major -lt 16
|
||||
set arch x64
|
||||
end
|
||||
case armv6 armv6l
|
||||
set arch armv6l
|
||||
case armv7 armv7l
|
||||
set arch armv7l
|
||||
case armv8 armv8l aarch64
|
||||
set arch arm64
|
||||
end
|
||||
|
||||
set --query nvm_arch && set arch $nvm_arch
|
||||
|
||||
set --local dir "node-$v-$os-$arch"
|
||||
set --local url $nvm_mirror/$v/$dir.$ext
|
||||
|
||||
command mkdir -p $nvm_data/$v
|
||||
|
||||
echo -e "Installing Node \x1b[1m$v\x1b[22m $alias"
|
||||
echo -e "Fetching \x1b[4m$url\x1b[24m\x1b[7m"
|
||||
|
||||
if ! command curl --progress-bar --location $url \
|
||||
| command tar --extract --gzip --directory $nvm_data/$v 2>/dev/null
|
||||
command rm -rf $nvm_data/$v
|
||||
echo -e "\033[F\33[2K\x1b[0mnvm: Invalid mirror or host unavailable: \"$url\"" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
echo -en "\033[F\33[2K\x1b[0m"
|
||||
|
||||
if test "$os" = win
|
||||
command mv $nvm_data/$v/$dir $nvm_data/$v/bin
|
||||
else
|
||||
command mv $nvm_data/$v/$dir/* $nvm_data/$v
|
||||
command rm -rf $nvm_data/$v/$dir
|
||||
end
|
||||
end
|
||||
|
||||
if test $v != "$nvm_current_version"
|
||||
set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version
|
||||
_nvm_version_activate $v
|
||||
end
|
||||
|
||||
printf "Now using Node %s (npm %s) %s\n" (_nvm_node_info)
|
||||
case use
|
||||
test $v = default && set v $nvm_default_version
|
||||
_nvm_list | string match --entire --regex -- (_nvm_version_match $v) | read v __
|
||||
|
||||
if ! set --query v[1]
|
||||
echo "nvm: Can't use Node \"$argv[2..-1]\", version must be installed first" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
if test $v != "$nvm_current_version"
|
||||
set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version
|
||||
test $v != system && _nvm_version_activate $v
|
||||
end
|
||||
|
||||
printf "Now using Node %s (npm %s) %s\n" (_nvm_node_info)
|
||||
case uninstall
|
||||
if test -z "$v"
|
||||
echo "nvm: Not enough arguments for command: \"$cmd\"" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
test $v = default && test ! -z "$nvm_default_version" && set v $nvm_default_version
|
||||
|
||||
_nvm_list | string match --entire --regex -- (_nvm_version_match $v) | read v __
|
||||
|
||||
if ! set -q v[1]
|
||||
echo "nvm: Node version not installed or invalid: \"$argv[2..-1]\"" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
printf "Uninstalling Node %s %s\n" $v (string replace ~ \~ "$nvm_data/$v/bin/node")
|
||||
|
||||
_nvm_version_deactivate $v
|
||||
|
||||
command rm -rf $nvm_data/$v
|
||||
case current
|
||||
_nvm_current
|
||||
case ls list
|
||||
_nvm_list | _nvm_list_format (_nvm_current) $argv[2]
|
||||
case lsr {ls,list}-remote
|
||||
_nvm_index_update $nvm_mirror $nvm_data/.index || return
|
||||
_nvm_list | command awk '
|
||||
FILENAME == "-" && (is_local[$1] = FNR == NR) { next } {
|
||||
print $0 (is_local[$1] ? " ✓" : "")
|
||||
}
|
||||
' - $nvm_data/.index | _nvm_list_format (_nvm_current) $argv[2]
|
||||
case \*
|
||||
echo "nvm: Unknown command or option: \"$cmd\" (see nvm -h)" >&2
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
function _nvm_find_up --argument-names path file
|
||||
test -e "$path/$file" && echo $path/$file || begin
|
||||
test "$path" != / || return
|
||||
_nvm_find_up (command dirname $path) $file
|
||||
end
|
||||
end
|
||||
|
||||
function _nvm_version_match --argument-names v
|
||||
string replace --regex -- '^v?(\d+|\d+\.\d+)$' 'v$1.' $v |
|
||||
string replace --filter --regex -- '^v?(\d+)' 'v$1' |
|
||||
string escape --style=regex ||
|
||||
string lower '\b'$v'(?:/\w+)?$'
|
||||
end
|
||||
|
||||
function _nvm_list_format --argument-names current regex
|
||||
command awk -v current="$current" -v regex="$regex" '
|
||||
$0 ~ regex {
|
||||
aliases[versions[i++] = $1] = $2 " " $3
|
||||
pad = (n = length($1)) > pad ? n : pad
|
||||
}
|
||||
END {
|
||||
if (!i) exit 1
|
||||
while (i--)
|
||||
printf((current == versions[i] ? " ▶ " : " ") "%"pad"s %s\n",
|
||||
versions[i], aliases[versions[i]])
|
||||
}
|
||||
'
|
||||
end
|
||||
|
||||
function _nvm_current
|
||||
command --search --quiet node || return
|
||||
set --query nvm_current_version && echo $nvm_current_version || echo system
|
||||
end
|
||||
|
||||
function _nvm_node_info
|
||||
set --local npm_path (string replace bin/npm-cli.js "" (realpath (command --search npm)))
|
||||
test -f $npm_path/package.json || set --local npm_version_default (command npm --version)
|
||||
command node --eval "
|
||||
console.log(process.version)
|
||||
console.log('$npm_version_default' ? '$npm_version_default': require('$npm_path/package.json').version)
|
||||
console.log(process.execPath.replace(require('os').homedir(), '~'))
|
||||
"
|
||||
end
|
||||
3
slackware/home/fish/.config/fish/functions/vim.fish
Normal file
3
slackware/home/fish/.config/fish/functions/vim.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
function vim --wraps=nvim --description 'alias vim nvim'
|
||||
nvim $argv;
|
||||
end
|
||||
3
slackware/home/fish/.config/fish/functions/w.fish
Normal file
3
slackware/home/fish/.config/fish/functions/w.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
function w --wraps=watson --description 'alias w=watson'
|
||||
watson $argv;
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue