Skip to content

Instantly share code, notes, and snippets.

@FdelMazo
Last active April 3, 2024 23:31
Show Gist options
  • Save FdelMazo/868b261c064e8c0c0e7862f968c4a389 to your computer and use it in GitHub Desktop.
Save FdelMazo/868b261c064e8c0c0e7862f968c4a389 to your computer and use it in GitHub Desktop.
Append me to .zshrc (and others)
[user]
email = fdelmazo@fi.uba.ar
name = Federico del Mazo
signingKey = /home/delmazo/.ssh/id_rsa.pub
[gpg]
format = ssh
[rebase]
autosquash = true
updateRefs = true
[diff]
algorithm = histogram
colormoved = default
[merge]
conflictstyle = zdiff3
[branch]
sort = -committerdate
# git clone https://github.com/keis/git-fixup.git && cd git-fixup && sudo make install && sudo make install-zsh && cd .. && rm -rf git-fixup
[fixup]
commit = true
rebase = true
menu = fzf --height '60%' \
--bind 'tab:toggle-preview' \
--preview 'git show --color {+1}' \
--preview-window=up:80% \
--prompt 'Select commit: '
[commit]
gpgsign = true
[core]
editor = vim
[pull]
rebase = true
[alias]
# https://softwaredoug.com/blog/2022/11/09/idiot-proof-git-aliases.html
pr = "!f() { \
open \"$(git ls-remote --get-url $(git config --get branch.$(git rev-parse --abbrev-ref HEAD).remote) \
| sed 's|git@github.com:\\(.*\\)$|https://github.com/\\1|' \
| sed 's|\\.git$||'; \
)/compare/$(\
git config --get branch.$(git rev-parse --abbrev-ref HEAD).merge | cut -d '/' -f 3- \
)?expand=1\"; \
}; f"
hub = "!f() { \
open \"$(git ls-remote --get-url \
| sed 's|git@github.com:\\(.*\\)$|https://github.com/\\1|' \
| sed 's|\\.git$||'; \
)\"; \
}; f"
# https://stackoverflow.com/a/52025740
parent = "!git show-branch | grep '*' | grep -v \"$(git rev-parse --abbrev-ref HEAD)\" | head -n1 | sed 's/.*\\[\\(.*\\)\\].*/\\1/' | sed 's/[\\^~].*//' #"
# https://stackoverflow.com/a/5816177
find = "!f() { git log -S $1 --source --all; }; f"
# sudo apt install tig xclip
# bind the `c` key on tig to automatically copy the selected commit sha to the clipboard
bind generic c @sh -c "echo -n %(commit) | cut -c -7 | xclip -r -selection c"
# bind the backspace to be the opposite of enter on diff view (enter -> scroll down / backspace -> scroll up)
bind diff <BackSpace> scroll-line-up
# wrap long lines on diff view
set wrap-lines = yes
set number
filetype indent plugin on
# sudo apt install fzf lolcat
# pip install obliquestrategies
# zsh plugins
# git clone https://github.com/ergenekonyigit/lambda-gitster.git && cp lambda-gitster/lambda-gitster.zsh-theme ~/.oh-my-zsh/custom/themes && rm -rf lambda-gitster
# git clone https://github.com/Aloxaf/fzf-tab ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-tab
# git clone https://gist.github.com/475ee7768efc03727f21.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/git-auto-status
# git clone https://github.com/agkozak/zsh-z ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-z
# git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# nvm
# wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
# "open in vscode"
# wget https://raw.githubusercontent.com/mhsattarian/nemo-open-in-vscode/master/vscode.nemo_action -O ~/.local/share/nemo/actions/vscode.nemo_action
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$HOME/.local/bin:$PATH
ZSH_THEME="lambda-gitster"
zstyle ':omz:plugins:nvm' lazy yes
plugins=(
fzf-tab
git
git-auto-fetch
last-working-dir
git-auto-status
sudo
zsh-syntax-highlighting
zsh-autosuggestions
zsh-z
nvm
)
alias cdd="cd ~/Desktop"
alias xx='xdg-open '
alias python='python3 '
alias pp='python '
typeset -A ZSH_HIGHLIGHT_PATTERNS
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets regexp)
obliquestrategies | lolcat
# No olvidar borrar el sourcing de ohmyzsh anterior!!!
# Solo tiene que haber uno en todo el archivo
source $ZSH/oh-my-zsh.sh
# Asegurarse de que esto este post source oh-my-zsh.sh
source /usr/share/doc/fzf/examples/key-bindings.zsh
# Highlight commit messages up to the first 50 characters
ZSH_HIGHLIGHT_REGEXP+=("(gcmsg|git commit -m) \"[^\"]{0,50}(\"|)" "fg=cyan")
ZSH_HIGHLIGHT_REGEXP+=("(gcmsg|git commit -m) '[^']{0,50}('|)" "fg=cyan")
# https://askubuntu.com/questions/643142/is-it-possible-to-enter-password-for-sudo-only-once-and-configure-it-to-not-req
# https://askubuntu.com/questions/181349/making-a-backtick-produce-just-a-backtick
# https://askubuntu.com/questions/1028439/ssh-config-visual-host-key-yes-no-option
# Force pip install to be used on venvs
export PIP_REQUIRE_VIRTUALENV=true
# No olvidar borrar las lineas que te agrega nvm cuando lo instalas!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment