Skip to content

Instantly share code, notes, and snippets.

@qrg
Last active June 22, 2021 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qrg/7feb910e222bfeb5bf20ea92b5e2fcb9 to your computer and use it in GitHub Desktop.
Save qrg/7feb910e222bfeb5bf20ea92b5e2fcb9 to your computer and use it in GitHub Desktop.
# remove greeting message
set fish_greeting
# show cwd as full path in a prompt
set --global --export fish_prompt_pwd_dir_length 0
# enviroment variables
# ------------------------------------------------------------------------------
set --global --export LANG 'ja_JP.UTF-8'
set --global --export LESSCHARSET utf-8
# man setlocale
set --global --export LC_ALL 'en_US.UTF-8'
set --global --export LC_COLLATE 'ja_JP.UTF-8' # 正規表現のマッチング (範囲表現と等価クラスのマッチングを決定する) と文字列の照合 (collation)
set --global --export LC_CTYPE 'ja_JP.UTF-8' # 正規表現のマッチング、文字の分類、文字の変換、大文字小文字比較、 ワイド文字関数
set --global --export LC_MESSAGES 'ja_JP.UTF-8' # 地域化可能な自然言語メッセージ
set --global --export LC_MONETARY 'ja_JP.UTF-8' # 通貨の書式
set --global --export LC_NUMERIC 'ja_JP.UTF-8' # 数値の書式 (小数点や 3 桁ごとの区切り)
set --global --export LC_TIME 'en_US.UTF-8' # 時刻と日付けの書式
set --global --export EDITOR code
set --global --export GPG_TTY (tty)
set --global --export MANWIDTH 80
# colorful man pages
# ------------------------------------------------------------------------------
if type -q source-highlight
set --global --export LESS -R
set --global --export LESSOPEN '| /usr/local/bin/src-hilite-lesspipe.sh %s'
end
set --global --export MANPAGER 'less -R'
set --global --export LESS_TERMCAP_mb (tput bold; tput setaf 2) # green
set --global --export LESS_TERMCAP_md (tput bold; tput setaf 6) # cyan
set --global --export LESS_TERMCAP_me (tput sgr0)
set --global --export LESS_TERMCAP_so (tput bold; tput setaf 3; tput setab 4) # yellow on blue
set --global --export LESS_TERMCAP_se (tput rmso; tput sgr0)
set --global --export LESS_TERMCAP_us (tput smul; tput bold; tput setaf 7) # white
set --global --export LESS_TERMCAP_ue (tput rmul; tput sgr0)
set --global --export LESS_TERMCAP_mr (tput rev)
set --global --export LESS_TERMCAP_mh (tput dim)
set --global --export LESS_TERMCAP_ZN (tput ssubm)
set --global --export LESS_TERMCAP_ZV (tput rsubm)
set --global --export LESS_TERMCAP_ZO (tput ssupm)
set --global --export LESS_TERMCAP_ZW (tput rsupm)
# PATH
# ------------------------------------------------------------------------------
set --global --export PATH "$HOME/scripts" "$HOME/.local/bin" /usr/local/opt/curl/bin /usr/local/bin /usr/local/sbin $PATH
# macvim kaoriya
if test -e "/Applications/MacVim.app/Contents/MacOS"
set PATH "/Applications/MacVim.app/Contents/MacOS" $PATH
end
# direnv
if type -q direnv
eval (direnv hook fish)
end
# yarn
if type -q yarn
set PATH (yarn global bin) $PATH
end
# nodenv
if test -e "$HOME/.nodenv"
set PATH "$HOME/.nodenv/bin" "$HOME/.nodenv/shims" $PATH
status --is-interactive; and source (nodenv init -|psub)
if type -q brew
if test -e (brew --prefix node-build-update-defs)
set --global --export NODE_BUILD_DEFINITIONS (brew --prefix node-build-update-defs)"/share/node-build"
end
end
end
# rbenv
if test -e "$HOME/.rbenv"
set PATH "$HOME/.rbenv/shims" $PATH
status --is-interactive; and source (rbenv init -|psub)
# To link Rubies to Homebrew's OpenSSL 1.1 (which is upgraded)
set --global --export PATH "/usr/local/opt/openssl@1.1/bin" $PATH
set --global --export RUBY_CONFIGURE_OPTS '--with-openssl-dir=/usr/local/opt/openssl@1.1'
set --global --export LDFLAGS "-L/usr/local/opt/openssl@1.1/lib"
set --global --export CPPFLAGS "-I/usr/local/opt/openssl@1.1/include"
set --global --export PKG_CONFIG_PATH "/usr/local/opt/openssl@1.1/lib/pkgconfig"
end
# golang
if test -e "$HOME/go"
set --global --export GOPATH "$HOME/go"
set PATH "$GOPATH/bin" $PATH
end
# rust
if test -e "$HOME/.cargo"
set PATH "$HOME/.cargo/bin" $PATH
end
# tmuxinator
if test -e "$HOME/.tmuxinator/scripts/tmuxinator"
source "$HOME/.tmuxinator/scripts/tmuxinator"
end
# git diff-hightlight
if test -e /usr/local/share/git-core/contrib/diff-highlight
set PATH /usr/local/share/git-core/contrib/diff-highlight $PATH
end
# docker-sync
if type -q ruby && type -q gem
set PATH "(ruby -r rubygems -e 'puts Gem.user_dir')/bin" $PATH
end
# starship
# ------------------------------------------------------------------------------
# if type -q starship
# starship init fish | source
# end
# Homebrew
# ------------------------------------------------------------------------------
switch (uname)
case Darwin
set --global --export HOMEBREW_CASK_OPTS "--appdir=$HOME/Applications --fontdir=$HOME/Library/Fonts"
set --global --export HOMEBREW_INSTALL_CLEANUP 1
set --global --export HOMEBREW_GITHUB_API_TOKEN c02e81be452bf7794bdceb7bea152e8592c0b434
# https://formulae.brew.sh/formula/gnutls
set --global --export GUILE_TLS_CERTIFICATE_DIRECTORY /usr/local/etc/gnutls/
end
# aliases
# ------------------------------------------------------------------------------
abbr --add rm 'rm -iv' # -i, --interactive prompt before any removal
abbr --add cp 'cp -iv' # -i, --interactive prompt before overwrite
abbr --add mv 'mv -iv' # -i, --interactive prompt before overwrite
abbr --add mkdir 'mkdir -v'
abbr --add rmdir 'rmdir -v'
switch (uname)
case Darwin
abbr --add ls 'ls -G'
abbr --add ll 'ls -lG'
abbr --add la 'ls -lapG'
case '*'
abbr --add ls 'ls --color=auto'
abbr --add ll 'ls -l --color=auto'
abbr --add la 'ls -lap --color=auto'
end
abbr --add chown 'chown -v'
abbr --add chmod 'chmod -v'
abbr --add pd popd
abbr --add tree 'tree -Dghpua'
abbr --add cal 'env LANG=en_US.UTF-8 cal -3'
abbr --add man 'env LANG=ja_JP.UTF-8 man'
# enable aliases with sudo
abbr --add sudo 'sudo env PATH=$PATH'
abbr --add wget 'wget -cvS'
# -c, --continue
# Continue getting a partially-downloaded file.
# only works with FTP servers and with HTTP servers that support the "Range" header.
# -S, --server-response
# Print the headers sent by HTTP servers and responses sent by FTP servers.
abbr --add vi nvim
if test -d '/Applications/MacVim.app/Contents/MacOS'
abbr --add vi nvim
abbr --add vim nvim
end
abbr --add readus 'find . -regex "./node_modules/[^/]*/README.*" -type f | fzf --preview="less {}" --preview-window=right:60% --ansi --bind "enter:execute(open -a \"Marked 2\" {})" --delimiter=/ --with-nth=3 --header="open README"'
abbr --add rg 'rg --hidden --follow --glob "!({.git,node_modules}/*|*.lock)"'
abbr --add tmux 'tmux -2'
abbr --add mysql 'mysql --pager="less -S"'
abbr --add mn 'memo new'
abbr --add ml 'memo list'
abbr --add me 'memo edit'
# Git --------------------------------------------------------------------------
abbr --add g git
abbr --add gs 'git status'
#abbr --add gll 'git log --color-words --color --graph --name-status --abbrev-commit --decorate --branches'
abbr --add gl 'git log --pretty=format:"%C(red reverse)%d%Creset%C(white reverse) %h% Creset %C(green reverse) %an %Creset %C(cyan)%ar%Creset%n%C(white bold)%w(80)%s%Creset%n%n%w(80,2,2)%b" --graph --name-status'
abbr --add glmin 'git log --graph --pretty=format:"%Cred%h%Creset -%C(yellow reverse)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit'
abbr --add ga 'git add'
abbr --add gc 'git commit -v'
abbr --add gca 'git commit -v --amend'
abbr --add gco 'git checkout'
abbr --add gd 'git diff'
abbr --add gdh 'git diff HEAD'
abbr --add gds 'git diff --cached'
abbr --add gdt 'git difftool -y'
abbr --add gbr 'git branch'
abbr --add gbra 'git branch -a'
abbr --add gsb 'git show-branch'
abbr --add ghelp 'git help'
abbr --add gpull 'git pull'
abbr --add gpush "git push (git branch -a | grep -E '^\*' | sed -e 's/^\* //')"
# key bindings -----------------------------------------------------------------
if type -q push_line
bind \eq push_line
end
if type -q peco_select_git_branch
bind \cxgb peco_select_git_branch
end
# https://github.com/franciscolourenco/done
set -U __done_min_cmd_duration 5000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment