2020-11-15 16:19:29 +00:00
|
|
|
#!/bin/fish
|
2020-04-27 06:47:36 +00:00
|
|
|
|
2020-10-28 17:17:35 +00:00
|
|
|
if status is-interactive
|
2020-11-15 16:19:29 +00:00
|
|
|
# === default programs
|
2021-09-16 10:18:10 +00:00
|
|
|
set -gx EDITOR vim
|
2020-10-31 17:36:22 +00:00
|
|
|
|
2020-11-15 16:19:29 +00:00
|
|
|
# === fzf configuration
|
2020-12-21 09:17:20 +00:00
|
|
|
set -gx FZF_DEFAULT_COMMAND 'ag -g ""'
|
|
|
|
set -gx FZF_COMPLETE 0
|
|
|
|
set -gx FZF_FIND_FILE_COMMAND 'ag -g ""'
|
|
|
|
set -gx FZF_OPEN_COMMAND 'ag -g ""'
|
|
|
|
set -gx FZF_DEFAULT_OPTS '--height 40% --preview "bat --style=numbers --color=always --line-range :500 {}"'
|
2020-11-15 16:19:29 +00:00
|
|
|
|
|
|
|
# === less configuration
|
2020-10-31 17:36:22 +00:00
|
|
|
# no line-wrapping, good for `docker ps`
|
2021-09-30 05:54:42 +00:00
|
|
|
#set -gx LESS "-SRXF"
|
|
|
|
set -gx LESS "-SRX" # for nnn help to how, remove F
|
2020-11-15 16:19:29 +00:00
|
|
|
|
|
|
|
# === nvm configuration
|
2020-10-31 17:36:22 +00:00
|
|
|
set -gx nvm_mirror http://npm.taobao.org/mirrors/node
|
2020-11-15 16:19:29 +00:00
|
|
|
|
|
|
|
# === `ls` configuration
|
2020-10-31 17:36:22 +00:00
|
|
|
# change OTHER-WRITABLE color for `ls` command
|
|
|
|
set -gx LS_COLORS 'ow=34;42;40'
|
2020-11-15 16:19:29 +00:00
|
|
|
|
2021-09-30 05:54:42 +00:00
|
|
|
# === nnn configuration
|
|
|
|
set -gx NNN_PLUG 'c:fzcd;m:nmount;x:!chmod +x $nnn;d:dragdrop'
|
|
|
|
|
2020-11-19 09:29:17 +00:00
|
|
|
# === bat configuration
|
2021-01-17 07:30:01 +00:00
|
|
|
set -gx BAT_THEME 'OneHalfDark'
|
2020-11-19 09:29:17 +00:00
|
|
|
set -gx MANPAGER "sh -c 'col -bx | bat -l man -p'"
|
2020-11-15 16:19:29 +00:00
|
|
|
|
|
|
|
# === dict.sh configuration
|
2020-11-09 08:45:28 +00:00
|
|
|
set -gx D_SELECTOR 'plainsel'
|
2020-10-31 17:36:22 +00:00
|
|
|
|
2020-11-15 16:19:29 +00:00
|
|
|
# === fish git prompt configuration
|
2020-10-31 17:36:22 +00:00
|
|
|
# tune git icon for nerdfont
|
|
|
|
set -g __fish_git_prompt_char_upstream_ahead '>'
|
|
|
|
set -g __fish_git_prompt_char_upstream_behind '<'
|
|
|
|
set -g __fish_git_prompt_char_upstream_prefix ''
|
|
|
|
set -g __fish_git_prompt_char_stagedstate '●'
|
|
|
|
set -g __fish_git_prompt_char_dirtystate '*'
|
|
|
|
set -g __fish_git_prompt_char_untrackedfiles '+'
|
|
|
|
set -g __fish_git_prompt_char_conflictedstate 'x'
|
|
|
|
set -g __fish_git_prompt_char_cleanstate '✔ '
|
|
|
|
|
2020-11-15 16:19:29 +00:00
|
|
|
# === alias
|
2020-10-28 17:17:35 +00:00
|
|
|
alias k="kubectl"
|
|
|
|
alias kcc="k config get-contexts"
|
|
|
|
alias kcu="k config use-context"
|
|
|
|
alias kgd="k get deployment"
|
|
|
|
alias ked="k edit deployment"
|
|
|
|
alias kgp="k get pod -o 'custom-columns=NAME:.metadata.name,IMG:.spec.containers[*].image,STATUS:.status.phase'"
|
|
|
|
alias kl="k logs -f --all-containers"
|
|
|
|
alias issh='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
|
|
|
|
alias iscp='scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
|
2020-11-15 16:19:29 +00:00
|
|
|
alias dt='date "+%Y%m%d-%H%M%S"'
|
2021-09-28 13:47:40 +00:00
|
|
|
alias cnpm="npm --registry=https://registry.npmmirror.com \
|
|
|
|
--cache=$HOME/.npm/.cache/cnpm \
|
|
|
|
--disturl=https://npmmirror.com/dist \
|
|
|
|
--userconfig=$HOME/.cnpmrc"
|
2020-11-15 16:19:29 +00:00
|
|
|
|
|
|
|
# === PATH and file sourcing
|
2021-08-09 12:12:06 +00:00
|
|
|
append_paths ~/go/bin \
|
|
|
|
~/bin \
|
|
|
|
~/.local/bin \
|
|
|
|
~/.yarn/bin \
|
|
|
|
~/.config/yarn/global/node_modules/.bin \
|
|
|
|
~/dotfiles/bin \
|
|
|
|
~/dotfiles/devops/bin \
|
|
|
|
~/Nextcloud/bin \
|
|
|
|
/usr/local/go/bin
|
2020-11-15 16:19:29 +00:00
|
|
|
source_files /usr/share/autojump/autojump.fish /usr/local/share/autojump/autojump.fish \
|
2021-02-25 02:34:15 +00:00
|
|
|
~/.jabba/jabba.fish \
|
2021-06-27 07:32:49 +00:00
|
|
|
~/.asdf/asdf.fish \
|
2020-11-15 16:19:29 +00:00
|
|
|
~/.profile.fish
|
|
|
|
|
|
|
|
# === auto cd into last activated directory
|
2021-03-31 06:40:41 +00:00
|
|
|
test "$PWD" = "$HOME" && cd $last_pwd
|
2021-08-27 06:53:22 +00:00
|
|
|
|
2021-09-23 09:14:29 +00:00
|
|
|
function loadenv
|
|
|
|
while read -l line
|
|
|
|
set -l line (string trim $line)
|
|
|
|
if [ -z "$line" ]
|
|
|
|
continue
|
|
|
|
end
|
|
|
|
if string match -q '#*' $line
|
|
|
|
continue
|
|
|
|
end
|
|
|
|
set -l kv (string split -m 1 = -- $line)
|
|
|
|
set -gx $kv
|
|
|
|
end < $argv[1]
|
|
|
|
end
|
|
|
|
|
2021-08-27 06:53:22 +00:00
|
|
|
function readenv --on-variable PWD
|
|
|
|
if test -r .env
|
2021-09-23 09:14:29 +00:00
|
|
|
loadenv .env
|
2021-08-27 06:53:22 +00:00
|
|
|
end
|
|
|
|
end
|
2020-10-28 17:17:35 +00:00
|
|
|
end
|
2020-04-27 06:47:36 +00:00
|
|
|
|