2021-05-02 07:50:01 +02:00
|
|
|
set PATH {$HOME}/.nix-profile/bin {$HOME}/.cargo/bin {$HOME}/.cabal/bin {$HOME}/.local/bin $PATH
|
2020-12-11 12:11:51 +01:00
|
|
|
set -gx TERM xterm-kitty
|
2020-01-02 03:36:00 +01:00
|
|
|
set -gx NIX_PATH {$HOME}/.nix-defexpr/channels
|
|
|
|
|
|
|
|
export MANPAGER='nvim +Man!'
|
|
|
|
export NIX_SSL_CERT_FILE='/etc/ssl/certs/ca-certificates.crt'
|
|
|
|
|
2021-01-09 12:40:24 +01:00
|
|
|
if [ -n "$NVIM_LISTEN_ADDRESS" ]
|
|
|
|
export VISUAL="floaterm"
|
|
|
|
export EDITOR="floaterm"
|
|
|
|
else
|
|
|
|
export VISUAL="nvim"
|
|
|
|
export EDITOR="nvim"
|
|
|
|
end
|
|
|
|
|
2020-01-02 03:36:00 +01:00
|
|
|
alias b="cd .."
|
|
|
|
alias c="clear"
|
|
|
|
alias v="nvim"
|
|
|
|
alias tksa="tmux kill-session -a"
|
|
|
|
alias tks="tmux kill-server"
|
2020-01-03 10:55:45 +01:00
|
|
|
alias tat="tmux attach -t "
|
|
|
|
alias tls="tmux ls"
|
2020-01-02 03:36:00 +01:00
|
|
|
alias vf="v (fzf)"
|
|
|
|
alias cs="cscope -bqR"
|
|
|
|
alias cat="bat"
|
|
|
|
alias t="tokei ."
|
|
|
|
alias gst="gst-inspect-1.0"
|
|
|
|
alias gsl="gst-launch-1.0"
|
2020-01-05 14:19:37 +01:00
|
|
|
alias sds="systemctl status "
|
|
|
|
alias sde="systemctl enable "
|
|
|
|
alias sdd="systemctl disable "
|
2021-01-28 12:11:06 +01:00
|
|
|
alias sfc="source ~/.config/fish/config.fish"
|
2020-01-13 15:04:08 +01:00
|
|
|
|
2020-12-21 16:09:08 +01:00
|
|
|
# emacs org
|
|
|
|
alias e="emacsclient"
|
|
|
|
alias ej="emacsclient ~/org/journal.org"
|
|
|
|
alias en="emacsclient ~/org/notes.org"
|
|
|
|
alias ep="emacsclient ~/org/projects.org"
|
|
|
|
alias et="emacsclient ~/org/todo.org"
|
|
|
|
|
2020-01-13 15:04:08 +01:00
|
|
|
# Git helpers
|
|
|
|
alias vg="vgrep"
|
|
|
|
alias vs="vgrep -s"
|
2021-04-07 16:56:07 +02:00
|
|
|
|
|
|
|
# Open fugitive with nvim directly
|
2021-04-22 13:58:49 +02:00
|
|
|
alias gn="nvim +Git +only"
|
2020-04-03 08:25:08 +02:00
|
|
|
|
|
|
|
# Branch (b)
|
|
|
|
alias gb='git branch'
|
|
|
|
alias gba='git branch --all --verbose'
|
|
|
|
alias gbc='git checkout -b'
|
|
|
|
alias gbd='git branch --delete'
|
|
|
|
alias gbD='git branch --delete --force'
|
|
|
|
alias gbl='git branch --verbose'
|
|
|
|
alias gbL='git branch --all --verbose'
|
|
|
|
alias gbm='git branch --move'
|
|
|
|
alias gbM='git branch --move --force'
|
|
|
|
alias gbr='git branch --move'
|
|
|
|
alias gbR='git branch --move --force'
|
|
|
|
alias gbs='git show-branch'
|
|
|
|
alias gbS='git show-branch --all'
|
|
|
|
alias gbv='git branch --verbose'
|
|
|
|
alias gbV='git branch --verbose --verbose'
|
|
|
|
alias gbx='git branch --delete'
|
|
|
|
alias gbX='git branch --delete --force'
|
|
|
|
|
|
|
|
# Commit (c)
|
|
|
|
alias gc='git commit --verbose'
|
|
|
|
alias gca='git commit --verbose --all'
|
|
|
|
alias gcm='git commit --message'
|
2020-05-20 08:12:04 +02:00
|
|
|
alias gcS='git commit -s --verbose'
|
|
|
|
alias gcSa='git commit -s --verbose --all'
|
|
|
|
alias gcSm='git commit -s --message'
|
2020-04-03 08:25:08 +02:00
|
|
|
alias gcam='git commit --all --message'
|
|
|
|
alias gco='git checkout'
|
|
|
|
alias gcO='git checkout --patch'
|
|
|
|
alias gcf='git commit --amend --reuse-message HEAD'
|
|
|
|
alias gcSf='git commit -S --amend --reuse-message HEAD'
|
|
|
|
alias gcF='git commit --verbose --amend'
|
|
|
|
alias gcSF='git commit -S --verbose --amend'
|
|
|
|
alias gcp='git cherry-pick --ff'
|
|
|
|
alias gcP='git cherry-pick --no-commit'
|
|
|
|
alias gcr='git revert'
|
|
|
|
alias gcR='git reset HEAD^'
|
|
|
|
alias gcs='git show'
|
|
|
|
alias gcsS='git show --pretty=short --show-signature'
|
|
|
|
alias gcl='git-commit-lost'
|
|
|
|
alias gcy='git cherry -v --abbrev'
|
|
|
|
alias gcY='git cherry -v'
|
|
|
|
|
|
|
|
# Conflict (C)
|
|
|
|
alias gCl='git --no-pager diff --name-only --diff-filter=U'
|
|
|
|
alias gCa='git add (gCl)'
|
|
|
|
alias gCe='git mergetool (gCl)'
|
|
|
|
alias gCo='git checkout --ours --'
|
|
|
|
alias gCO='gCo (gCl)'
|
|
|
|
alias gCt='git checkout --theirs --'
|
|
|
|
alias gCT='gCt (gCl)'
|
|
|
|
|
|
|
|
# Data (d)
|
|
|
|
alias gd='git ls-files'
|
|
|
|
alias gdc='git ls-files --cached'
|
|
|
|
alias gdx='git ls-files --deleted'
|
|
|
|
alias gdm='git ls-files --modified'
|
|
|
|
alias gdu='git ls-files --other --exclude-standard'
|
|
|
|
alias gdk='git ls-files --killed'
|
|
|
|
|
|
|
|
# Fetch (f)
|
|
|
|
alias gf='git fetch'
|
|
|
|
alias gfa='git fetch --all'
|
|
|
|
alias gfc='git clone'
|
|
|
|
alias gfcr='git clone --recurse-submodules'
|
|
|
|
alias gfm='git pull'
|
|
|
|
alias gfr='git pull --rebase'
|
|
|
|
|
|
|
|
# Grep (g)
|
|
|
|
alias gg='git grep'
|
|
|
|
alias ggi='git grep --ignore-case'
|
|
|
|
alias ggl='git grep --files-with-matches'
|
|
|
|
alias ggL='git grep --files-without-matches'
|
|
|
|
alias ggv='git grep --invert-match'
|
|
|
|
alias ggw='git grep --word-regexp'
|
|
|
|
|
|
|
|
# Index (i)
|
|
|
|
alias gia='git add'
|
2021-01-28 08:12:57 +01:00
|
|
|
alias giA='git add .'
|
|
|
|
alias gip='git add --patch'
|
2020-04-03 08:25:08 +02:00
|
|
|
alias giu='git add --update'
|
|
|
|
alias gid='git diff --no-ext-diff --cached'
|
|
|
|
alias giD='git diff --no-ext-diff --cached --word-diff'
|
|
|
|
alias gii='git update-index --assume-unchanged'
|
|
|
|
alias giI='git update-index --no-assume-unchanged'
|
|
|
|
alias gir='git reset'
|
|
|
|
alias giR='git reset --patch'
|
|
|
|
alias gix='git rm -r --cached'
|
|
|
|
alias giX='git rm -rf --cached'
|
|
|
|
|
|
|
|
# Log (l)
|
|
|
|
alias gl='git log --topo-order --pretty=medium'
|
|
|
|
alias glf='git log --topo-order --stat --pretty=fuller'
|
|
|
|
alias gls='git log --topo-order --stat --pretty=medium'
|
|
|
|
alias gld='git log --topo-order --stat --patch --full-diff --pretty=medium'
|
|
|
|
alias glo='git log --topo-order --pretty=oneline'
|
|
|
|
alias glg='git log --topo-order --all --graph --pretty=oneline'
|
|
|
|
alias glc='git shortlog --summary --numbered'
|
|
|
|
alias glS='git log --show-signature'
|
|
|
|
|
|
|
|
# Merge (m)
|
|
|
|
alias gm='git merge'
|
|
|
|
alias gmC='git merge --no-commit'
|
|
|
|
alias gmF='git merge --no-ff'
|
|
|
|
alias gma='git merge --abort'
|
|
|
|
alias gmt='git mergetool'
|
|
|
|
|
|
|
|
# Push (p)
|
|
|
|
alias gp='git push'
|
|
|
|
alias gpf='git push --force-with-lease'
|
|
|
|
alias gpF='git push --force'
|
|
|
|
alias gpa='git push --all'
|
|
|
|
alias gpA='git push --all && git push --tags'
|
|
|
|
alias gpt='git push --tags'
|
|
|
|
alias gpc='git push --set-upstream origin (git-branch-current 2> /dev/null)'
|
|
|
|
alias gpp='git pull origin (git-branch-current 2> /dev/null) && git push origin (git-branch-current 2> /dev/null)'
|
|
|
|
|
|
|
|
# Rebase (r)
|
|
|
|
alias gr='git rebase'
|
|
|
|
alias gra='git rebase --abort'
|
|
|
|
alias grc='git rebase --continue'
|
|
|
|
alias gri='git rebase --interactive'
|
|
|
|
alias grs='git rebase --skip'
|
|
|
|
|
|
|
|
# Remote (R)
|
|
|
|
alias gR='git remote'
|
|
|
|
alias gRl='git remote --verbose'
|
|
|
|
alias gRa='git remote add'
|
|
|
|
alias gRx='git remote rm'
|
|
|
|
alias gRm='git remote rename'
|
|
|
|
alias gRu='git remote update'
|
|
|
|
alias gRp='git remote prune'
|
|
|
|
alias gRs='git remote show'
|
|
|
|
alias gRb='git-hub-browse'
|
|
|
|
|
|
|
|
# Stash (s)
|
|
|
|
alias gs='git stash'
|
|
|
|
alias gsa='git stash apply'
|
|
|
|
alias gsx='git stash drop'
|
|
|
|
alias gsX='git-stash-clear-interactive'
|
|
|
|
alias gsl='git stash list'
|
|
|
|
alias gsL='git-stash-dropped'
|
|
|
|
alias gsd='git stash show --patch --stat'
|
|
|
|
alias gsp='git stash pop'
|
|
|
|
alias gsr='git-stash-recover'
|
|
|
|
alias gss='git stash save --include-untracked'
|
|
|
|
alias gsS='git stash save --patch --no-keep-index'
|
|
|
|
alias gsw='git stash save --include-untracked --keep-index'
|
|
|
|
|
|
|
|
# Submodule (S)
|
|
|
|
alias gS='git submodule'
|
|
|
|
alias gSa='git submodule add'
|
|
|
|
alias gSf='git submodule foreach'
|
|
|
|
alias gSi='git submodule init'
|
|
|
|
alias gSI='git submodule update --init --recursive'
|
|
|
|
alias gSl='git submodule status'
|
|
|
|
alias gSm='git-submodule-move'
|
|
|
|
alias gSs='git submodule sync'
|
|
|
|
alias gSu='git submodule foreach git pull origin master'
|
|
|
|
alias gSx='git-submodule-remove'
|
|
|
|
|
|
|
|
# Tag (t)
|
|
|
|
alias gt='git tag'
|
|
|
|
alias gtl='git tag -l'
|
|
|
|
alias gts='git tag -s'
|
|
|
|
alias gtv='git verify-tag'
|
|
|
|
|
|
|
|
# Working Copy (w)
|
2020-05-19 12:12:03 +02:00
|
|
|
alias gwS='git status --ignore-submodules=none --short'
|
|
|
|
alias gws='git status --ignore-submodules=none'
|
2020-04-03 08:25:08 +02:00
|
|
|
alias gwd='git diff --no-ext-diff'
|
|
|
|
alias gwD='git diff --no-ext-diff --word-diff'
|
|
|
|
alias gwr='git reset --soft'
|
|
|
|
alias gwR='git reset --hard'
|
|
|
|
alias gwc='git clean -n'
|
|
|
|
alias gwC='git clean -f'
|
|
|
|
alias gwx='git rm -r'
|
|
|
|
alias gwX='git rm -rf'
|
|
|
|
|
2020-01-13 15:04:08 +01:00
|
|
|
# Open modified files
|
2020-05-03 18:16:52 +02:00
|
|
|
# ACMRU = Added || Copied || Modified || Renamed || Unmerged
|
2020-01-13 15:04:08 +01:00
|
|
|
# Edit all uncommitted files that have changes since the last commit (be they staged or unstaged)
|
|
|
|
alias vd="nvim (git diff HEAD --name-only --diff-filter=ACMR)"
|
|
|
|
# Edit all staged files that have changes since the last commit
|
|
|
|
alias vds="nvim (git diff --staged --name-only --diff-filter=ACMR)"
|
|
|
|
# Edit all files that were altered in the last commit
|
|
|
|
alias vdc="nvim (git diff HEAD^ --name-only --diff-filter=ACMR)"
|
|
|
|
# Edit files changed since master
|
|
|
|
alias vdm="nvim (git diff master --name-only --diff-filter=ACMR)"
|
2020-05-03 18:16:52 +02:00
|
|
|
# Edit files unmerged
|
|
|
|
alias vdu="nvim (git diff --name-only --diff-filter=U | uniq)"
|
|
|
|
# Add unmerged files
|
|
|
|
alias vdua="git add (git diff --name-only --diff-filter=U)"
|
2020-05-19 14:06:02 +02:00
|
|
|
|
|
|
|
# Git fzf helper functions
|
|
|
|
# https://github.com/junegunn/fzf/wiki/Examples-(fish)
|
2021-01-28 07:40:02 +01:00
|
|
|
function fco -d "Checkout a branch using fzf"
|
2020-05-19 14:06:02 +02:00
|
|
|
git branch --all | grep -v HEAD | string trim | fzf | read -l result; and git checkout "$result"
|
|
|
|
end
|
|
|
|
|
2021-01-28 07:40:02 +01:00
|
|
|
function fcoc -d "Checkout a commit using fzf"
|
2020-05-19 14:06:02 +02:00
|
|
|
git log --pretty=oneline --abbrev-commit --reverse | fzf --tac +s -e | awk '{print $1;}' | read -l result; and git checkout "$result"
|
|
|
|
end
|
|
|
|
|
|
|
|
# https://gist.github.com/gabesoft/b6e5e959c4cb11ed257d41edb07d47cb
|
|
|
|
# Modify to use --exact flag for fzf and delta as pager
|
|
|
|
function fbr --description "Git browse commits"
|
|
|
|
set -l log_line_to_hash "echo {} | grep -o '[a-f0-9]\{7\}' | head -1"
|
|
|
|
set -l view_commit "$log_line_to_hash | xargs -I % sh -c 'git show --color=always % | delta | less -R'"
|
|
|
|
set -l copy_commit_hash "$log_line_to_hash | xclip"
|
|
|
|
set -l git_checkout "$log_line_to_hash | xargs -I % sh -c 'git checkout %'"
|
|
|
|
set -l open_cmd "open"
|
|
|
|
|
|
|
|
if test (uname) = Linux
|
|
|
|
set open_cmd "xdg-open"
|
|
|
|
end
|
|
|
|
|
|
|
|
set github_open "$log_line_to_hash | xargs -I % sh -c '$open_cmd https://github.\$(git config remote.origin.url | cut -f2 -d. | tr \':\' /)/commit/%'"
|
|
|
|
|
|
|
|
git log --color=always --format='%C(auto)%h%d %s %C(green)%C(bold)%cr% C(blue)%an' | \
|
|
|
|
fzf --exact --no-sort --reverse --tiebreak=index --no-multi --ansi \
|
|
|
|
--preview="$view_commit" \
|
|
|
|
--header="ENTER to view, CTRL-Y to copy hash, CTRL-O to open on GitHub, CTRL-X to checkout, CTRL-C to exit" \
|
|
|
|
--bind "enter:execute:$view_commit" \
|
|
|
|
--bind "ctrl-y:execute:$copy_commit_hash" \
|
|
|
|
--bind "ctrl-x:execute:$git_checkout" \
|
|
|
|
--bind "ctrl-o:execute:$github_open"
|
|
|
|
end
|
2020-07-01 15:52:10 +02:00
|
|
|
|
2021-01-28 07:40:02 +01:00
|
|
|
function fcf --description "Git commit fixup using fzf"
|
|
|
|
git commit --fixup (git log --pretty=oneline --abbrev-commit --color=always | fzf --ansi | cut -d ' ' -f1)
|
|
|
|
end
|
|
|
|
|
|
|
|
function fcr --description "Git reset to a selected commit using fzf"
|
|
|
|
git reset $argv (git log --pretty=oneline --abbrev-commit --color=always | fzf --ansi +s | awk '{print $1}')
|
|
|
|
end
|
|
|
|
|
|
|
|
function fcR --description "Git revert a selected commit using fzf"
|
|
|
|
git revert (git log --pretty=oneline --abbrev-commit --color=always | fzf --ansi +s | awk '{print $1}')
|
|
|
|
end
|
|
|
|
|
|
|
|
function frbi --description "Git interactive rebase using fzf"
|
|
|
|
git rebase -i (git log --pretty=oneline --abbrev-commit --color=always | fzf --ansi | cut -d ' ' -f1)
|
|
|
|
end
|
|
|
|
|
|
|
|
function ffa --description "Git add files using fzf"
|
|
|
|
git add -- (git ls-files --modified --others --exclude-standard | fzf -m --preview 'bat --color=always {}')
|
|
|
|
end
|
|
|
|
|
|
|
|
function ffco --description "Git checkout a file using fzf"
|
|
|
|
git checkout $argv -- (git ls-files --modified --exclude-standard | fzf -m)
|
|
|
|
end
|
|
|
|
|
|
|
|
function ffrs --description "Git restore a staged file using fzf"
|
|
|
|
git restore --staged $argv -- (git diff --name-only --staged | fzf -m)
|
|
|
|
end
|
|
|
|
|
|
|
|
function ffr --description "Git restore a file using fzf"
|
|
|
|
git restore $argv -- (git ls-files --modified --exclude-standard | fzf -m)
|
|
|
|
end
|
|
|
|
|
2021-07-10 07:43:56 +02:00
|
|
|
function grf --description "Search within a file with grep with context"
|
|
|
|
grep --color=always -C 10 --group-separator="---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------" $argv | less -R
|
|
|
|
end
|
|
|
|
|
|
|
|
function rgf --description "Search within a file with ripgrep"
|
|
|
|
rg --color always $argv | nvim -R +AnsiEsc
|
|
|
|
end
|
|
|
|
|
|
|
|
function rgc --description "Search within a file with ripgrep with context"
|
|
|
|
rg --color always -C 10 --context-separator="---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------" $argv | nvim -R +AnsiEsc
|
|
|
|
end
|
|
|
|
|
2020-07-01 15:52:10 +02:00
|
|
|
fzf_key_bindings
|
2021-02-04 10:01:00 +01:00
|
|
|
|
|
|
|
starship init fish | source
|
2021-03-05 17:26:54 +01:00
|
|
|
fnm env | source
|