summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.fish54
-rw-r--r--fish_plugins2
-rw-r--r--functions/:.fish1
-rw-r--r--functions/@.fish1
-rw-r--r--functions/ansiStrip.fish3
-rw-r--r--functions/cat.fish8
-rw-r--r--functions/cert.fish5
-rw-r--r--functions/curl_time.fish6
-rw-r--r--functions/dateiso.fish2
-rw-r--r--functions/dsi.fish9
-rw-r--r--functions/déco.fish2
-rw-r--r--functions/egrep.fish5
-rw-r--r--functions/fish_prompt.fish24
-rw-r--r--functions/fisher.fish430
-rw-r--r--functions/g-.fish1
-rw-r--r--functions/g.fish1
-rw-r--r--functions/gca.fish1
-rw-r--r--functions/gck.fish1
-rw-r--r--functions/gcl.fish1
-rw-r--r--functions/gds.fish1
-rw-r--r--functions/gll.fish1
-rw-r--r--functions/gmfip.fish1
-rw-r--r--functions/gmfip6.fish1
-rw-r--r--functions/gp.fish1
-rw-r--r--functions/gpf.fish1
-rw-r--r--functions/gpl.fish1
-rw-r--r--functions/gplf.fish1
-rw-r--r--functions/groot.fish1
-rw-r--r--functions/gsh.fish1
-rw-r--r--functions/humanize_duration.fish19
-rw-r--r--functions/ipv6-ctrl.fish9
-rw-r--r--functions/kfish.fish1
-rw-r--r--functions/kvi.fish1
-rw-r--r--functions/less.fish4
-rw-r--r--functions/lksp.fish10
-rw-r--r--functions/ll.fish4
-rw-r--r--functions/load-em.fish8
-rw-r--r--functions/lw.fish2
-rw-r--r--functions/passc.fish2
-rw-r--r--functions/pdfpextr.fish15
-rw-r--r--functions/pkill.fish1
-rw-r--r--functions/pp.fish10
-rw-r--r--functions/qreboot.fish2
-rw-r--r--functions/reCo.fish2
-rw-r--r--functions/rsync.fish2
-rw-r--r--functions/sslcheckdate.fish5
-rw-r--r--functions/timestamp.fish4
-rw-r--r--functions/v.fish1
-rw-r--r--functions/vim.fish1
-rw-r--r--functions/ydl.fish2
-rw-r--r--functions/ydx.fish2
51 files changed, 203 insertions, 471 deletions
diff --git a/config.fish b/config.fish
index ddd84c5..480eb3f 100644
--- a/config.fish
+++ b/config.fish
@@ -1,15 +1,14 @@
-
if status is-interactive
- if which khal 2> /dev/null > /dev/null
+ if type khal 2> /dev/null > /dev/null
khal calendar 2> /dev/null
end
end
-if which roxterm 2> /dev/null > /dev/null
+if type roxterm 2> /dev/null > /dev/null
set -x TERMINAL roxterm
end
-if which nvim 2> /dev/null > /dev/null
+if type nvim 2> /dev/null > /dev/null
set -x VISUAL nvim
set -x EDITOR nvim
set -x SYSTEMD_EDITOR nvim
@@ -19,19 +18,34 @@ else
set -x SYSTEMD_EDITOR vim
end
-if which ruby 2> /dev/null > /dev/null
+if type ruby 2> /dev/null > /dev/null
set RUBY_PATH (ruby -e 'print Gem.user_dir')/bin
end
+if test -e /home/ache/.elan/
+ set LEAN_PATH /home/ache/.elan/bin
+end
+
+
+
set -x NPM_PACKAGES "$HOME/.npm-packages"
set -x GOPATH "$HOME/.go"
set -x NODE_PATH "$NPM_PACKAGES/lib/node_modules:$NODE_PATH"
set -x RUST_PATH "$HOME/.cargo"
+set -x DEVKITPRO_DIR "/opt/devkitpro"
set -x EMSCRIPTEN_PATH "/usr/lib/emscripten"
set -x JUPYTERLAB_DIR "$HOME/.local/share/jupyterlab"
+set -x DOTNET_TOOLS_PATH "$HOME/.dotnet/tools"
set -x GPG_TTY (tty)
+if [ -d "$HOME/.local/bin" ]
+ set -x PATH $PATH "$HOME/.local/bin"
+end
+if [ -d "/opt/cuda/" ]
+ set -x CUDA_HOME "/opt/cuda"
+end
+
if [ -d "$NPM_PACKAGES/bin" ]
set -x PATH $PATH "$NPM_PACKAGES/bin"
end
@@ -47,8 +61,24 @@ end
if [ -d "$EMSCRIPTEN_PATH" ]
set -x PATH $PATH "$EMSCRIPTEN_PATH"
end
+if [ -d "$DOTNET_TOOLS_PATH" ]
+ set -x PATH $PATH "$DOTNET_TOOLS_PATH"
+end
-if which fcitx 2> /dev/null > /dev/null
+
+
+if [ -d "$LEAN_PATH" ]
+ set -x PATH $PATH "$LEAN_PATH"
+end
+if [ -d "$DEVKITPRO_DIR" ]
+ set -x DEVKITPRO '/opt/devkitpro'
+ set -x DEVKITARM '/opt/devkitpro/devkitARM'
+ set -x DEVKITPPC '/opt/devkitpro/devkitPPC'
+ set -x DEVKIT_PATH "$DEVKITPRO_DIR/tools/bin"
+ set -x PATH $PATH "$DEVKITPRO_PATH"
+end
+
+if type fcitx 2> /dev/null > /dev/null
set -x GTK_IM_MODULE "fcitx"
set -x QT_IM_MODULE "fcitx"
set -x XMODIFIERS "@im=fcitx"
@@ -57,9 +87,15 @@ if [ -d "/opt/android-sdk" ]
set -x ANDROID_HOME /opt/android-sdk/
end
-[ -z "$DISPLAY" ] ; and [ "$XDG_VTNR" = "1" ] ; and exec startx
+## Pyenv
+set -Ux PYENV_ROOT $HOME/.pyenv
+fish_add_path $PYENV_ROOT/bin
+[ -z "$DISPLAY" ] ; and [ "$XDG_VTNR" = "1" ] ; and exec startx
+if [ -e ".ssh/id_main_key" ]
+ eval (keychain --agents ssh,gpg .ssh/id_main_key --eval D9778431CDCABBB1 E15360EAE11E2A34 -q --noask)
+end
# alias gobjc='gcc -L /usr/lib/GNUstep/Libraries/gnustep-base -lgnustep-base -fconstant-string-class=NSConstantString'
# alias smpd='ssh achessh@ache.one -fp 21 ssh ache@localhost -p 60065 -L 8091:localhost:8091 -fN'
@@ -67,7 +103,11 @@ end
set -x fish_emoji_width 2
+load-em
if test -e ~/.dircolors
eval (dircolors -c ~/.dircolors)
end
+
+# opam configuration
+source /home/ache/.opam/opam-init/init.fish > /dev/null 2> /dev/null; or true
diff --git a/fish_plugins b/fish_plugins
new file mode 100644
index 0000000..8164e11
--- /dev/null
+++ b/fish_plugins
@@ -0,0 +1,2 @@
+jorgebucaran/fisher
+acomagu/fish-async-prompt
diff --git a/functions/:.fish b/functions/:.fish
new file mode 100644
index 0000000..a2c9b03
--- /dev/null
+++ b/functions/:.fish
@@ -0,0 +1 @@
+alias ':'='math'
diff --git a/functions/@.fish b/functions/@.fish
new file mode 100644
index 0000000..68fbba4
--- /dev/null
+++ b/functions/@.fish
@@ -0,0 +1 @@
+alias '@'='math --base=16'
diff --git a/functions/ansiStrip.fish b/functions/ansiStrip.fish
new file mode 100644
index 0000000..000306d
--- /dev/null
+++ b/functions/ansiStrip.fish
@@ -0,0 +1,3 @@
+function ansiStrip --description "Keep only ascii characters from the stream"
+ sed 's/\x1b\[[0-9;]*m//g'
+end
diff --git a/functions/cat.fish b/functions/cat.fish
new file mode 100644
index 0000000..f58224e
--- /dev/null
+++ b/functions/cat.fish
@@ -0,0 +1,8 @@
+function cat -d "Print a file nicely"
+ if isatty stdout
+ bat $argv
+ else
+ set -l catBin $(type --no-functions --path cat)
+ $catBin $argv
+ end
+end
diff --git a/functions/cert.fish b/functions/cert.fish
new file mode 100644
index 0000000..b909faa
--- /dev/null
+++ b/functions/cert.fish
@@ -0,0 +1,5 @@
+function cert -d "Retrieve the SSL certificat of a HTTPS website from the servername"
+ # PEM format
+ echo "Certificat of $argv[1] on port 443 (PEM format)"
+ openssl s_client -servername $argv[1] -connect $argv[1]:443 2>/dev/null </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
+end
diff --git a/functions/curl_time.fish b/functions/curl_time.fish
new file mode 100644
index 0000000..972ced0
--- /dev/null
+++ b/functions/curl_time.fish
@@ -0,0 +1,6 @@
+function curl_time --wraps=curl --description "Get timming information from curl"
+ for url in $argv
+ echo "reaching: $url"
+ curl -L -w "time_namelookup: %{time_namelookup}\ntime_connect: %{time_connect}\ntime_appconnect: %{time_appconnect}\ntime_pretransfer: %{time_pretransfer}\ntime_redirect: %{time_redirect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" -o /dev/null $url
+ end
+end
diff --git a/functions/dateiso.fish b/functions/dateiso.fish
new file mode 100644
index 0000000..304d753
--- /dev/null
+++ b/functions/dateiso.fish
@@ -0,0 +1,2 @@
+alias 'dateiso'='date --iso-8601=seconds'
+# Can also be taped `date -Is`
diff --git a/functions/dsi.fish b/functions/dsi.fish
new file mode 100644
index 0000000..d6217fc
--- /dev/null
+++ b/functions/dsi.fish
@@ -0,0 +1,9 @@
+function dsi --description 'Stop docker image by name' --wraps docker
+ sudo docker stop $(sudo docker ps | awk -v i="$argv" '{if($2~i){print$1}}')
+end
+
+# From:
+# dsi() { docker stop $(docker ps -a | awk -v i="^$1.*" '{if($2~i){print$1}}'); }
+#
+# Source:
+# https://stackoverflow.com/questions/32073971/stopping-docker-containers-by-image-name-ubuntu
diff --git a/functions/déco.fish b/functions/déco.fish
index 7bd02e6..9a0cdad 100644
--- a/functions/déco.fish
+++ b/functions/déco.fish
@@ -1 +1 @@
-alias déco='sudo pkill dhcpcd; sudo pkill wpa_supplicant;sudo ip route flush via all;sudo pkill ssh'
+alias déco='sudo pkill dhcpcd; sudo pkill wpa_supplicant;sudo ip route flush via all'
diff --git a/functions/egrep.fish b/functions/egrep.fish
index 271b6ce..f8d8040 100644
--- a/functions/egrep.fish
+++ b/functions/egrep.fish
@@ -1 +1,4 @@
-alias egrep='egrep --color=auto'
+#Greg with regex and color
+function egrep --description 'Grep with regex and color' --wraps egrep
+ egrep --color=auto
+end
diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish
index ffd7da2..05ff668 100644
--- a/functions/fish_prompt.fish
+++ b/functions/fish_prompt.fish
@@ -103,10 +103,27 @@ function prompt_user -d "Display current user if different from $default_user"
end
end
+function prompt_cloud -d "Display a Cloud if AWS connection detected"
+ set -g HOSTNAME_PROMPT ""
+ if [ "$AWS_PROFILE" != "" ]
+ prompt_segment 494949 DDDDDD "☸️ $AWS_PROFILE"
+ else
+ if [ "$AWS_DEFAULT_PROFILE" != "" ]
+ prompt_segment 494949 BBBBBB "🌩 $AWS_DEFAULT_PROFILE"
+ end
+ end
+end
+
function get_hostname -d "Set current hostname to prompt variable $HOSTNAME_PROMPT if connected via SSH or is root"
set -g HOSTNAME_PROMPT ""
if [ "$theme_hostname" = "always" -o \( "$theme_hostname" != "never" -a \( -n "$SSH_CLIENT" -o "$USER" = "root" \) \) ]
- set -g HOSTNAME_PROMPT (hostname)
+ if type hostnamectl 2> /dev/null > /dev/null
+ set -g HOSTNAME_PROMPT (hostnamectl hostname)
+ else if type hostname 2< /dev/null > /dev/null
+ set -g HOSTNAME_PROMPT (hostname)
+ else
+ set -g HOSTNAME_PROMPT (cat /etc/hostname)
+ end
end
end
@@ -159,14 +176,14 @@ function prompt_git -d "Display the current git state"
if [ -e .git ]
set ref (command git symbolic-ref HEAD 2> /dev/null)
if [ $status -gt 0 ]
- set -l branch (command git show-ref --head -s --abbrev |head -n1 2> /dev/null)
+ set -l branch (command git show-ref --head -s --abbrev 2> /dev/null |head -n1 2> /dev/null)
set ref "➦ $branch "
end
set branch_symbol \uE0A0
set -l branch (echo $ref | sed "s-refs/heads/-$branch_symbol -")
set dirty ''
- set gstatus ( git status --porcelain -b | git_status_summary )
+ set gstatus ( git status --porcelain -b 2> /dev/null | git_status_summary )
# Check for commit ahead
set ahead (echo $gstatus | cut -d ';' -f 1)
@@ -285,5 +302,6 @@ function fish_prompt
prompt_user
prompt_dir
available git; and prompt_git
+ prompt_cloud
prompt_finish
end
diff --git a/functions/fisher.fish b/functions/fisher.fish
deleted file mode 100644
index 4759857..0000000
--- a/functions/fisher.fish
+++ /dev/null
@@ -1,430 +0,0 @@
-set -g fisher_version 3.2.9
-
-function fisher -a cmd -d "fish package manager"
- set -q XDG_CACHE_HOME; or set XDG_CACHE_HOME ~/.cache
- set -q XDG_CONFIG_HOME; or set XDG_CONFIG_HOME ~/.config
-
- set -g fish_config $XDG_CONFIG_HOME/fish
- set -g fisher_cache $XDG_CACHE_HOME/fisher
- set -g fisher_config $XDG_CONFIG_HOME/fisher
-
- set -q fisher_path; or set -g fisher_path $fish_config
-
- 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
-
- 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 "$fisher_path/fishfile"
- set -l file (_fisher_fmt <$fisher_path/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 packages"
- complete -xc fisher -n __fish_use_subcommand -a rm -d "Remove packages"
- complete -xc fisher -n __fish_use_subcommand -a ls -d "List installed packages 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_config/*/*/*
- command readlink $pkg; or echo $pkg
- end
-end
-
-function _fisher_fmt
- command sed "s|^[[:space:]]*||;s|^$fisher_config/||;s|^~|$HOME|;s|^\.\/*|$PWD/|;s|^https*:/*||;s|^github\.com/||;s|/*\$||"
-end
-
-function _fisher_help
- echo "usage: fisher add <package...> Add packages"
- echo " fisher rm <package...> Remove packages"
- echo " fisher Update all packages"
- echo " fisher ls [<regex>] List installed packages 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 jethrokuan/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"
- echo " fisher ls fish-\*"
-end
-
-function _fisher_self_update -a file
- set -l url "https://raw.githubusercontent.com/jorgebucaran/fisher/master/fisher.fish"
- echo "fetching $url" >&2
- command curl -s "$url?nocache" >$file.
-
- set -l next_version (command awk '{ print $4 } { exit }' <$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_config $fisher_path/{functions,completions,conf.d}/fisher.fish $fisher_path/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)
- set -l fishfile $fisher_path/fishfile
-
- 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_config
- command mkdir -p $fisher_config
-
- 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 packages" >&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 " package" (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"\" -- package 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 {
- if (split(PKG, tmp, /@+|:/) > 2) {
- if (tmp[4]) sub("@"tmp[4], "", PKG)
- print PKG "\t" tmp[2]"/"tmp[1]"/"tmp[3] "\t" (tmp[4] ? tmp[4] : "master")
- } else {
- pkg = split(PKG, _, "/") <= 2 ? "github.com/"tmp[1] : tmp[1]
- tag = tmp[2] ? tmp[2] : "master"
- print (\
- 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 \
- ) "\t" pkg
- }
- }
- ' | read -l url pkg branch
-
- if test ! -d "$fisher_config/$pkg"
- fish -c "
- echo fetching $url >&2
- command mkdir -p $fisher_config/$pkg $fisher_cache/(command dirname $pkg)
- if test ! -z \"$branch\"
- command git clone $url $fisher_config/$pkg --branch $branch --depth 1 2>/dev/null
- or echo fisher: cannot clone \"$url\" -- is this a valid url\? >&2
- else if command curl $curl_opts -Ss -w \"\" $url 2>&1 | command tar -xzf- -C $fisher_config/$pkg 2>/dev/null
- command rm -Rf $fisher_cache/$pkg
- command mv -f $fisher_config/$pkg/* $fisher_cache/$pkg
- command rm -Rf $fisher_config/$pkg
- command cp -Rf {$fisher_cache,$fisher_config}/$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_config/$pkg/..
- else
- command rm -Rf $fisher_config/$pkg
- echo fisher: cannot add \"$pkg\" -- is this a valid package\? >&2
- end
- " >/dev/null &
- set pkg_jobs $pkg_jobs (_fisher_jobs --last)
- set next_pkgs $next_pkgs "$fisher_config/$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_config/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
diff --git a/functions/g-.fish b/functions/g-.fish
new file mode 100644
index 0000000..88fdf5e
--- /dev/null
+++ b/functions/g-.fish
@@ -0,0 +1 @@
+alias g-='git checkout -'
diff --git a/functions/g.fish b/functions/g.fish
deleted file mode 100644
index cfd2b64..0000000
--- a/functions/g.fish
+++ /dev/null
@@ -1 +0,0 @@
-alias g='cd ~/git'
diff --git a/functions/gca.fish b/functions/gca.fish
new file mode 100644
index 0000000..ab6d37a
--- /dev/null
+++ b/functions/gca.fish
@@ -0,0 +1 @@
+alias gca='git commit --amend'
diff --git a/functions/gck.fish b/functions/gck.fish
new file mode 100644
index 0000000..d1ea84d
--- /dev/null
+++ b/functions/gck.fish
@@ -0,0 +1 @@
+alias gck='git checkout'
diff --git a/functions/gcl.fish b/functions/gcl.fish
new file mode 100644
index 0000000..6a81be4
--- /dev/null
+++ b/functions/gcl.fish
@@ -0,0 +1 @@
+alias gcl='git clone'
diff --git a/functions/gds.fish b/functions/gds.fish
new file mode 100644
index 0000000..95cf83e
--- /dev/null
+++ b/functions/gds.fish
@@ -0,0 +1 @@
+alias gds='git diff --staged'
diff --git a/functions/gll.fish b/functions/gll.fish
new file mode 100644
index 0000000..2897824
--- /dev/null
+++ b/functions/gll.fish
@@ -0,0 +1 @@
+alias gll='git pull'
diff --git a/functions/gmfip.fish b/functions/gmfip.fish
index 4d4cc81..adddba9 100644
--- a/functions/gmfip.fish
+++ b/functions/gmfip.fish
@@ -1,2 +1 @@
alias gmfip='curl "https://ipv4.wtfismyip.com/text"'
-alias gmfip6='curl "https://wtfismyip.com/text"'
diff --git a/functions/gmfip6.fish b/functions/gmfip6.fish
new file mode 100644
index 0000000..af3ee74
--- /dev/null
+++ b/functions/gmfip6.fish
@@ -0,0 +1 @@
+alias gmfip6='curl "https://wtfismyip.com/text"'
diff --git a/functions/gp.fish b/functions/gp.fish
new file mode 100644
index 0000000..1c2bf91
--- /dev/null
+++ b/functions/gp.fish
@@ -0,0 +1 @@
+alias gp='git push'
diff --git a/functions/gpf.fish b/functions/gpf.fish
new file mode 100644
index 0000000..4fdd4ca
--- /dev/null
+++ b/functions/gpf.fish
@@ -0,0 +1 @@
+alias gpf='git push --force'
diff --git a/functions/gpl.fish b/functions/gpl.fish
new file mode 100644
index 0000000..6b4067d
--- /dev/null
+++ b/functions/gpl.fish
@@ -0,0 +1 @@
+alias gpl='git pull'
diff --git a/functions/gplf.fish b/functions/gplf.fish
new file mode 100644
index 0000000..facbcde
--- /dev/null
+++ b/functions/gplf.fish
@@ -0,0 +1 @@
+alias gplf='git pull --force'
diff --git a/functions/groot.fish b/functions/groot.fish
new file mode 100644
index 0000000..2bb58fb
--- /dev/null
+++ b/functions/groot.fish
@@ -0,0 +1 @@
+alias groot="cd (git rev-parse --show-toplevel)"
diff --git a/functions/gsh.fish b/functions/gsh.fish
new file mode 100644
index 0000000..62805a1
--- /dev/null
+++ b/functions/gsh.fish
@@ -0,0 +1 @@
+alias gsh='git show'
diff --git a/functions/humanize_duration.fish b/functions/humanize_duration.fish
deleted file mode 100644
index eeb999f..0000000
--- a/functions/humanize_duration.fish
+++ /dev/null
@@ -1,19 +0,0 @@
-function humanize_duration -d "Make a time interval human readable"
- command awk '
- function hmTime(time, stamp) {
- split("h:m:s:ms", units, ":")
- for (i = 2; i >= -1; i--) {
- if (t = int( i < 0 ? time % 1000 : time / (60 ^ i * 1000) % 60 )) {
- stamp = stamp t units[sqrt((i - 2) ^ 2) + 1] " "
- }
- }
- if (stamp ~ /^ *$/) {
- return "0ms"
- }
- return substr(stamp, 1, length(stamp) - 1)
- }
- {
- print hmTime($0)
- }
- '
-end
diff --git a/functions/ipv6-ctrl.fish b/functions/ipv6-ctrl.fish
new file mode 100644
index 0000000..fee246a
--- /dev/null
+++ b/functions/ipv6-ctrl.fish
@@ -0,0 +1,9 @@
+function ipv6-ctrl --description 'Disable or enable IPv6 support.'
+ if [ $(sysctl -n net.ipv6.conf.all.disable_ipv6) -eq "0" ];
+ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
+ sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
+ else;
+ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
+ sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0
+ end
+end
diff --git a/functions/kfish.fish b/functions/kfish.fish
new file mode 100644
index 0000000..9dc9942
--- /dev/null
+++ b/functions/kfish.fish
@@ -0,0 +1 @@
+alias kfish='fish_default_key_bindings'
diff --git a/functions/kvi.fish b/functions/kvi.fish
new file mode 100644
index 0000000..df7f7a3
--- /dev/null
+++ b/functions/kvi.fish
@@ -0,0 +1 @@
+alias kvi='fish_vi_key_bindings'
diff --git a/functions/less.fish b/functions/less.fish
new file mode 100644
index 0000000..5b43521
--- /dev/null
+++ b/functions/less.fish
@@ -0,0 +1,4 @@
+# Support for escape sequences.
+alias less='less -R'
+
+# Each line is assumed to start without color.
diff --git a/functions/lksp.fish b/functions/lksp.fish
new file mode 100644
index 0000000..50bf30e
--- /dev/null
+++ b/functions/lksp.fish
@@ -0,0 +1,10 @@
+# Compute link speed of every interfaces
+function lksp
+ for link in /sys/class/net/*
+ if cat $link/speed 2> /dev/null 1>&2
+ echo (basename $link)": " (cat $link/speed) "Mb/s"
+ else
+ echo (basename $link)": - Mb/s"
+ end
+ end
+end
diff --git a/functions/ll.fish b/functions/ll.fish
index 2a824a1..04f5333 100644
--- a/functions/ll.fish
+++ b/functions/ll.fish
@@ -1,3 +1,3 @@
-function ll -d "ls long mode"
- ls -AlF $argv
+function ll -d "ls long mode with eza"
+ eza --long --all --classify $argv
end
diff --git a/functions/load-em.fish b/functions/load-em.fish
new file mode 100644
index 0000000..bde7153
--- /dev/null
+++ b/functions/load-em.fish
@@ -0,0 +1,8 @@
+function load-em --description 'Loads Fish shell function descriptions.'
+# Load function information so it shows up in auto completion
+# Original from https://github.com/fish-shell/fish-shell/issues/1915#issuecomment-72315918
+
+ for i in (functions | tr , ' ')
+ functions $i > /dev/null
+ end
+end
diff --git a/functions/lw.fish b/functions/lw.fish
index 713aab7..bfbec49 100644
--- a/functions/lw.fish
+++ b/functions/lw.fish
@@ -1 +1 @@
-lw='lxc-wrapper'
+alias lw='lxc-wrapper'
diff --git a/functions/passc.fish b/functions/passc.fish
index 82dacfa..0701730 100644
--- a/functions/passc.fish
+++ b/functions/passc.fish
@@ -1 +1 @@
-alias pass='pass -c'
+alias passc='pass -c'
diff --git a/functions/pdfpextr.fish b/functions/pdfpextr.fish
new file mode 100644
index 0000000..a550bb3
--- /dev/null
+++ b/functions/pdfpextr.fish
@@ -0,0 +1,15 @@
+function pdfpextr -a pStart pEnd filename
+ # this function uses 3 arguments:
+ # $1 is the first page of the range to extract
+ # $2 is the last page of the range to extract
+ # $3 is the input file
+ # output file will be named "inputfile_pXX-pYY.pdf"
+ set -l fileOut (string split -r -m1 . $filename)[1]_p{$pStart}-p{$pEnd}.pdf
+ printf $fileOut
+
+ gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \
+ -dFirstPage=$pStart \
+ -dLastPage=$pEnd \
+ -sOutputFile=$fileOut \
+ "$filename"
+end
diff --git a/functions/pkill.fish b/functions/pkill.fish
new file mode 100644
index 0000000..40ab79d
--- /dev/null
+++ b/functions/pkill.fish
@@ -0,0 +1 @@
+alias pkill='pkill -9'
diff --git a/functions/pp.fish b/functions/pp.fish
new file mode 100644
index 0000000..5e2f91b
--- /dev/null
+++ b/functions/pp.fish
@@ -0,0 +1,10 @@
+alias pping='prettyping'
+
+function pp
+ if test -z "$argv[1]"
+ set listargs "1.1" $argv[2..]
+ else
+ set listargs $argv
+ end
+ pping $listargs
+end
diff --git a/functions/qreboot.fish b/functions/qreboot.fish
index 9046812..09b0eb7 100644
--- a/functions/qreboot.fish
+++ b/functions/qreboot.fish
@@ -1 +1 @@
-alias qreboot='sudo sync;sudo kexec -l /boot/vmlinuz-linux --initrd=/boot/initramfs-linux.img --reuse-cmdline; sudo kexec -e'
+alias qreboot='sudo sync;sudo kexec -l /boot/vmlinuz-linux --initrd=/boot/initramfs-linux.img --reuse-cmdline; sudo systemctl kexec'
diff --git a/functions/reCo.fish b/functions/reCo.fish
new file mode 100644
index 0000000..fd70cb3
--- /dev/null
+++ b/functions/reCo.fish
@@ -0,0 +1,2 @@
+# TODO: Improove the logic here
+alias reCo='sudo pkill dhcpcd && sudo pkill wpa_supplicant && coW'
diff --git a/functions/rsync.fish b/functions/rsync.fish
index 3c9646b..408ded7 100644
--- a/functions/rsync.fish
+++ b/functions/rsync.fish
@@ -1 +1 @@
-alias rsync='rsync -ah --progress'
+alias rsync='rsync -ah --progress --info=progress2'
diff --git a/functions/sslcheckdate.fish b/functions/sslcheckdate.fish
new file mode 100644
index 0000000..3bd6228
--- /dev/null
+++ b/functions/sslcheckdate.fish
@@ -0,0 +1,5 @@
+function sslcheckdate --description "Check the validity date of a distant SSL server"
+ # PEM format
+ echo "Validity dates of certificat of $argv[1] on port 443 (PEM format)"
+ echo "Q" | openssl s_client -servername $argv[1] -connect $argv[1]:443 2>/dev/null | openssl x509 -noout -dates
+end
diff --git a/functions/timestamp.fish b/functions/timestamp.fish
new file mode 100644
index 0000000..6ea08e2
--- /dev/null
+++ b/functions/timestamp.fish
@@ -0,0 +1,4 @@
+function timestamp --wraps "date" --description "Return current unix timestamp"
+ # The Unix timestamp is the number of seconds from 01 January 1970 (the unix epoch date)
+ date "%s"
+end
diff --git a/functions/v.fish b/functions/v.fish
new file mode 100644
index 0000000..0f497f8
--- /dev/null
+++ b/functions/v.fish
@@ -0,0 +1 @@
+alias v nvim
diff --git a/functions/vim.fish b/functions/vim.fish
new file mode 100644
index 0000000..b78352a
--- /dev/null
+++ b/functions/vim.fish
@@ -0,0 +1 @@
+alias vim nvim
diff --git a/functions/ydl.fish b/functions/ydl.fish
index 5052a73..e2acb11 100644
--- a/functions/ydl.fish
+++ b/functions/ydl.fish
@@ -1 +1 @@
-alias ydl='youtube-dl -ki ' # Youtube-dl alias
+alias ydl='yt-dlp -i --fragment-retries 100 --sleep-requests 0.5 --abort-on-unavailable-fragment' # Youtube-dl alias
diff --git a/functions/ydx.fish b/functions/ydx.fish
index 070c6d9..c50c756 100644
--- a/functions/ydx.fish
+++ b/functions/ydx.fish
@@ -1 +1 @@
-alias ydx='youtube-dl -xi --audio-format mp3 ' # Youtube-dl alias
+alias ydx='yt-dlp -xi --audio-format mp3 ' # Youtube-dl alias