commit
9e667412ad
1 changed files with 371 additions and 0 deletions
@ -0,0 +1,371 @@ |
|||||||
|
#+TITLE: My .zshrc file |
||||||
|
#+AUTHOR: Jacopo De Simoi |
||||||
|
|
||||||
|
#+HUGO_BASE_DIR: /ssh:jacopods.ddns.net:gists/ |
||||||
|
#+HUGO_SECTION: zshrc |
||||||
|
#+OPTIONS: creator:t toc:nil |
||||||
|
|
||||||
|
* zshrc :@zsh: |
||||||
|
All posts in here will have the category set to /zsh/. |
||||||
|
** zshrc |
||||||
|
:PROPERTIES: |
||||||
|
:EXPORT_FILE_NAME: zshrc-file |
||||||
|
:EXPORT_DATE: 2020-08-05 |
||||||
|
:EXPORT_HUGO_MENU: :menu "main" |
||||||
|
:END: |
||||||
|
This is my ~.zshrc~ |
||||||
|
#+BEGIN_SRC sh :tangle ".zshrc" |
||||||
|
kde-current-activity () { |
||||||
|
qdbus org.kde.ActivityManager /ActivityManager/Activities org.kde.ActivityManager.Activities.CurrentActivity |
||||||
|
} |
||||||
|
|
||||||
|
kde-current-activity-name () { |
||||||
|
qdbus org.kde.ActivityManager /ActivityManager/Activities org.kde.ActivityManager.Activities.ActivityName `kde-current-activity` |
||||||
|
} |
||||||
|
|
||||||
|
# # if on TTY, change the colors to solarized |
||||||
|
# # FIXME: this is not cleared after exiting… |
||||||
|
# if [ "$TERM" = "linux" ]; then |
||||||
|
# echo -en "\e]PB657b83" # S_base00 |
||||||
|
# echo -en "\e]PA586e75" # S_base01 |
||||||
|
# echo -en "\e]P0073642" # S_base02 |
||||||
|
# echo -en "\e]P62aa198" # S_cyan |
||||||
|
# echo -en "\e]P8002b36" # S_base03 |
||||||
|
# echo -en "\e]P2859900" # S_green |
||||||
|
# echo -en "\e]P5d33682" # S_magenta |
||||||
|
# echo -en "\e]P1dc322f" # S_red |
||||||
|
# echo -en "\e]PC839496" # S_base0 |
||||||
|
# echo -en "\e]PE93a1a1" # S_base1 |
||||||
|
# echo -en "\e]P9cb4b16" # S_orange |
||||||
|
# echo -en "\e]P7eee8d5" # S_base2 |
||||||
|
# echo -en "\e]P4268bd2" # S_blue |
||||||
|
# echo -en "\e]P3b58900" # S_yellow |
||||||
|
# echo -en "\e]PFfdf6e3" # S_base3 |
||||||
|
# echo -en "\e]PD6c71c4" # S_violet |
||||||
|
# clear # against bg artifacts |
||||||
|
# fi |
||||||
|
|
||||||
|
# try without |
||||||
|
#DBUS_SESSION_BUS_ADDRESS=$(cat ~/.dbus.kde.address) |
||||||
|
|
||||||
|
kde-cd-build () { |
||||||
|
cd $(pwd | sed -e 's+scratch/src/kde+scratch/src/kde/build+') |
||||||
|
} |
||||||
|
|
||||||
|
kde-cd-src () { |
||||||
|
cd $(pwd | sed -e 's+scratch/src/kde/build+scratch/src/kde+') |
||||||
|
} |
||||||
|
|
||||||
|
run-task () { |
||||||
|
adb shell am broadcast --user 0 -a net.dinglish.tasker.run_task -e task "$1" |
||||||
|
} |
||||||
|
|
||||||
|
ifttt () { |
||||||
|
curl -X POST https://maker.ifttt.com/trigger/$1/with/key/JLJw_lpzFTzDQetjix9Hr |
||||||
|
} |
||||||
|
|
||||||
|
ANDROID_A3=A3201809076708 |
||||||
|
ANDROID_BLU=6LFUQ86DYLOFCANR |
||||||
|
ANDROID_IP=192.168.0.22 |
||||||
|
|
||||||
|
android-remote-keyboard() |
||||||
|
{ |
||||||
|
# should set this up in a tmux session |
||||||
|
adb -s $ANDROID_A3 shell ime set de.onyxbits.remotekeyboard/.RemoteKeyboardService; |
||||||
|
adb -s $ANDROID_A3 forward tcp:6023 tcp:2323; |
||||||
|
sleep 1; |
||||||
|
telnet 127.0.0.1 6023 |
||||||
|
} |
||||||
|
android-remote-keyboard-wifi() |
||||||
|
{ |
||||||
|
# should set this up in a tmux session |
||||||
|
adb -s $ANDROID_IP:5555 shell ime set de.onyxbits.remotekeyboard/.RemoteKeyboardService; |
||||||
|
adb -s $ANDROID_IP:5555 forward tcp:6023 tcp:2323; |
||||||
|
sleep 1; |
||||||
|
telnet 127.0.0.1 6023 |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
android-remote-keyboard-blu() |
||||||
|
{ |
||||||
|
# should set this up in a tmux session |
||||||
|
adb -s $ANDROID_BLU shell ime set de.onyxbits.remotekeyboard/.RemoteKeyboardService; |
||||||
|
adb -s $ANDROID_BLU forward tcp:6028 tcp:2323; |
||||||
|
sleep 1; |
||||||
|
telnet 127.0.0.1 6028 |
||||||
|
} |
||||||
|
|
||||||
|
setup-ipwebcam() |
||||||
|
{ |
||||||
|
adb -s $ANDROID_BLU forward tcp:8097 tcp:8080 |
||||||
|
ffmpeg -i http://localhost:8097/video -map 0:v -pix_fmt yuv420p -f v4l2 /dev/video2 |
||||||
|
adb -s $ANDROID_BLU forward --remove tcp:8097 |
||||||
|
} |
||||||
|
|
||||||
|
wttr() |
||||||
|
{ |
||||||
|
local location=Toronto |
||||||
|
[[ $(tput cols) -le 124 ]] && local narrow=n; |
||||||
|
curl -H "Accept-Language: ${LANG%_*}" wttr.in/"${1:-$location}?T$narrow" |
||||||
|
} |
||||||
|
|
||||||
|
SOLARIZED="true" |
||||||
|
|
||||||
|
# Emacs stuff |
||||||
|
eca() |
||||||
|
{ |
||||||
|
if [[ "$SSH_CONNECTION" != '' ]]; then |
||||||
|
EMACS_ARGUMENTS="-t" |
||||||
|
else |
||||||
|
EMACS_ARGUMENTS="-n" |
||||||
|
fi |
||||||
|
/home/jacopods/.emacs.d/emacsclient-activities $EMACS_ARGUMENTS $@ |
||||||
|
} |
||||||
|
|
||||||
|
function vterm_printf(){ |
||||||
|
if [ -n "$TMUX" ]; then |
||||||
|
# Tell tmux to pass the escape sequences through |
||||||
|
# (Source: http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324) |
||||||
|
printf "\ePtmux;\e\e]%s\007\e\\" "$1" |
||||||
|
elif [ "${TERM%%-*}" = "screen" ]; then |
||||||
|
# GNU screen (screen, screen-256color, screen-256color-bce) |
||||||
|
printf "\eP\e]%s\007\e\\" "$1" |
||||||
|
else |
||||||
|
printf "\e]%s\e\\" "$1" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
# Path to your oh-my-zsh configuration. |
||||||
|
ZSH=$HOME/.oh-my-zsh |
||||||
|
|
||||||
|
# Set name of the theme to load. |
||||||
|
# Look in ~/.oh-my-zsh/themes/ |
||||||
|
ZSH_THEME="gentoo-wilder" |
||||||
|
|
||||||
|
# Set to this to use case-sensitive completion |
||||||
|
CASE_SENSITIVE="true" |
||||||
|
|
||||||
|
# Uncomment this to disable bi-weekly auto-update checks |
||||||
|
# DISABLE_AUTO_UPDATE="true" |
||||||
|
|
||||||
|
# Uncomment to change how often before auto-updates occur? (in days) |
||||||
|
# export UPDATE_ZSH_DAYS=13 |
||||||
|
|
||||||
|
# Uncomment following line if you want to disable colors in ls |
||||||
|
# DISABLE_LS_COLORS="true" |
||||||
|
|
||||||
|
# Uncomment following line if you want to disable autosetting terminal title. |
||||||
|
DISABLE_AUTO_TITLE="true" |
||||||
|
|
||||||
|
# Uncomment following line if you want to disable command autocorrection |
||||||
|
# DISABLE_CORRECTION="true" |
||||||
|
|
||||||
|
# Uncomment following line if you want red dots to be displayed while waiting for completion |
||||||
|
# COMPLETION_WAITING_DOTS="true" |
||||||
|
|
||||||
|
# Uncomment following line if you want to disable marking untracked files under |
||||||
|
# VCS as dirty. This makes repository status check for large repositories much, |
||||||
|
# much faster. |
||||||
|
eval `dircolors ~/.dir_colors` |
||||||
|
DISABLE_UNTRACKED_FILES_DIRTY="true" |
||||||
|
|
||||||
|
setopt AUTO_PUSHD |
||||||
|
setopt PUSHD_MINUS |
||||||
|
setopt BASH_AUTO_LIST |
||||||
|
setopt RM_STAR_WAIT |
||||||
|
|
||||||
|
setopt AUTO_NAME_DIRS |
||||||
|
setopt CDABLE_VARS |
||||||
|
# Uncomment following line if you want to shown in the command execution time stamp |
||||||
|
# in the history command output. The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"| |
||||||
|
# yyyy-mm-dd |
||||||
|
# HIST_STAMPS="mm/dd/yyyy" |
||||||
|
|
||||||
|
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) |
||||||
|
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ |
||||||
|
# Example format: plugins=(rails git textmate ruby lighthouse) |
||||||
|
plugins=(git colorize wd history-substring-search) |
||||||
|
|
||||||
|
source $ZSH/oh-my-zsh.sh |
||||||
|
#source $ZSH/z.sh |
||||||
|
|
||||||
|
if [[ "$TERM" == "dumb" ]] |
||||||
|
then |
||||||
|
unsetopt zle |
||||||
|
unsetopt prompt_cr |
||||||
|
unsetopt prompt_subst |
||||||
|
unfunction precmd |
||||||
|
unfunction preexec |
||||||
|
PS1='$ ' |
||||||
|
fi |
||||||
|
|
||||||
|
# try to use system colors for completion |
||||||
|
zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}" |
||||||
|
|
||||||
|
# reset default oh-my-zsh matcher-list |
||||||
|
zstyle ':completion:*' matcher-list '' |
||||||
|
|
||||||
|
# smart: ignore parent directory when completing ../<TAB> |
||||||
|
|
||||||
|
zstyle ':completion:*:(cd|mv|cp):*' ignore-parents parent pwd |
||||||
|
zstyle ':completion:*:(rm|kill|diff):*' ignore-line yes |
||||||
|
|
||||||
|
|
||||||
|
# User configuration |
||||||
|
|
||||||
|
#export PATH="/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.3:/usr/x86_64-pc-linux-gnu/gnat-gcc-bin/4.3:/usr/libexec/gnat-gcc/x86_64-pc-linux-gnu/4.3:/usr/games/bin:/usr/games/bin:/usr/games/bin:/usr/games/bin" |
||||||
|
|
||||||
|
export PATH="/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/games/bin" |
||||||
|
|
||||||
|
# editor stuff |
||||||
|
#export ALTERNATE_EDITOR="/usr/bin/emacs" |
||||||
|
|
||||||
|
export EMACS="/home/jacopods/.emacs.d/emacsclient-activities -n" |
||||||
|
export EDITOR=$EMACS |
||||||
|
export VISUAL=$EMACS |
||||||
|
export GIT_EDITOR="/home/jacopods/.emacs.d/emacsclient-activities" |
||||||
|
export SUDO_EDITOR=$EMACS |
||||||
|
|
||||||
|
git-create-thinkspoon-remote () { |
||||||
|
REPO_NAME=$(basename "`pwd`") |
||||||
|
source ~/scripts/git-init-thinkspoon.sh "$REPO_NAME.git" |
||||||
|
git remote add thinkspoon "git@thinkspoon.local:repos/$REPO_NAME.git" |
||||||
|
} |
||||||
|
|
||||||
|
git-current-branch () { |
||||||
|
git status -b | head -n 1 | awk {'print $3'} |
||||||
|
} |
||||||
|
############################################################################## |
||||||
|
## Aliases |
||||||
|
############################################################################## |
||||||
|
|
||||||
|
alias emacs="eca" |
||||||
|
alias e="eca" |
||||||
|
alias E=sudoedit |
||||||
|
alias mplayer="mpv" |
||||||
|
alias mpv="mpv --no-audio-display" |
||||||
|
alias top="urxvt -e htop &" |
||||||
|
alias mk="~/scripts/latex-mk $@" |
||||||
|
alias neofetch="~/clones/neofetch/neofetch --source ~/clones/neofetch/ascii/gentoo-one --separator ' ⎯⎯' --bold off --colors 4 12 5 3 12 6 | sed -e 's/bree/Bree/' | sed -e 's/2560x/2560×/'" |
||||||
|
alias dock="~/scripts/dock-a3.sh" |
||||||
|
###### |
||||||
|
## Time management |
||||||
|
##### |
||||||
|
alias pomo="/home/jacopods/.local/bin/termdown 25m -aW -f 3x5 -c 180 -b -q 10 -s $@" |
||||||
|
alias heirloom="/home/jacopods/.local/bin/termdown -s 37m -aW -f 3x5 -c 300 -b -q 10 $@" |
||||||
|
alias pomodorino="/home/jacopods/.local/bin/termdown 14m -aW -f 3x5 -c 120 -b -q 10 -s $@" |
||||||
|
alias pomodoro=pomo |
||||||
|
alias pomo-break="/home/jacopods/.local/bin/termdown 5m -aW -f 3x5 -c 60 -b -q 10 $@" |
||||||
|
alias pomodorino-break="/home/jacopods/.local/bin/termdown 2m30s -aW -f 3x5 -c 45 -b -q 10 $@" |
||||||
|
|
||||||
|
alias kb=/home/jacopods/hack/kb/kb |
||||||
|
alias unlock-android='~/scripts/unlock-android.sh' #$(cat ~/scripts/unlock-android.gpg | gpg 2>/dev/null)' |
||||||
|
alias kbd-android="" |
||||||
|
alias K=/home/jacopods/tmp/keymaps/remap-keyboard |
||||||
|
|
||||||
|
alias hangouts="chromium hangouts.google.com" |
||||||
|
alias quercus="/usr/lib/kf5/bin/falkon q.utoronto.ca" |
||||||
|
alias gmail="chromium www.gmail.com" |
||||||
|
|
||||||
|
#alias portal="chromium portal.utoronto.ca" |
||||||
|
alias ls=' exa' |
||||||
|
alias sl=' exa' # a frequent typo |
||||||
|
alias c=' cd' |
||||||
|
alias cd=' cd' |
||||||
|
alias o5="okular" #QT_PLUGIN_PATH=/usr/lib/kf5/lib64/plugins /usr/lib/kf5/bin/okular >/dev/null 2>/dev/null" |
||||||
|
alias o="okular" #QT_PLUGIN_PATH=/usr/lib/kf5/lib64/plugins /usr/lib/kf5/bin/okular >/dev/null 2>/dev/null" |
||||||
|
#alias ncmpcpp="~/clones/ncmpcpp/src/ncmpcpp" |
||||||
|
alias f="QT_PLUGIN_PATH=/usr/lib/kf5/lib64/plugins /usr/lib/kf5/bin/falkon >/dev/null 2>/dev/null" |
||||||
|
alias k5="QT_PLUGIN_PATH=/usr/lib/kf5/lib64/plugins /usr/lib/kf5/bin/konqueror >/dev/null 2>/dev/null" |
||||||
|
alias plasmashell-master="QT_PLUGIN_PATH=/usr/lib/kf5/lib64/plugins /usr/lib/kf5/bin/plasmashell >/dev/null 2>/dev/null" |
||||||
|
alias skype="skypeforlinux" |
||||||
|
alias ta="tmux attach" |
||||||
|
alias acroread="env WINEPREFIX=$HOME/.wine32 WINEARCH='win32' wine ~/.wine32/drive_c/Program\ Files/Adobe/Reader\ 11.0/Reader/AcroRd32.exe >/dev/null 2>/dev/null" |
||||||
|
|
||||||
|
run-silent() { |
||||||
|
"$@" 2>/dev/null |
||||||
|
} |
||||||
|
|
||||||
|
alias git-init-coxeter="source ~/scripts/git-init-coxeter.sh" |
||||||
|
|
||||||
|
#alias emacs=emacsclient --alternate-editor="" -c -n |
||||||
|
alias -s pdf='run-silent okular' |
||||||
|
alias -s djvu='run-silent okular' |
||||||
|
alias -s tex=emacs |
||||||
|
alias betty=~/tmp/betty/main.rb |
||||||
|
|
||||||
|
alias d.u='ssh dropbox.utoronto "~/dropbox.py"' |
||||||
|
|
||||||
|
alias -g C='| xclip' |
||||||
|
|
||||||
|
# rationalise-dot; useful for cd ......./whatever |
||||||
|
rationalise-dot() { |
||||||
|
if [[ $LBUFFER = *.. ]]; then |
||||||
|
LBUFFER+=/.. |
||||||
|
else |
||||||
|
LBUFFER+=. |
||||||
|
fi |
||||||
|
} |
||||||
|
zle -N rationalise-dot |
||||||
|
bindkey . rationalise-dot |
||||||
|
|
||||||
|
bindkey -s '^X^G' 'magit\n' |
||||||
|
bindkey -s '^[(' '()^B' |
||||||
|
bindkey -s '^[{' '{}^B' |
||||||
|
|
||||||
|
# this function is a poor-man eselect for configuration files |
||||||
|
# it mv's filename to filename_ or viceversa |
||||||
|
uv() { |
||||||
|
if [[ -f $1 ]]; then |
||||||
|
if [[ ${1:(-1)} == '_' ]]; then |
||||||
|
mv -i $1 ${1%_} |
||||||
|
else |
||||||
|
mv -i $1 $1_ |
||||||
|
fi |
||||||
|
else |
||||||
|
echo $0: \'$1\': no such file or directory |
||||||
|
return 1 |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
magit() { |
||||||
|
# TODO: add parameter just in case |
||||||
|
e -e "(magit-status \"$(pwd)\")" |
||||||
|
} |
||||||
|
|
||||||
|
agenda() { |
||||||
|
# TODO: add parameter just in case |
||||||
|
e -e "(org-agenda-list)" |
||||||
|
} |
||||||
|
|
||||||
|
kill-emacs() { |
||||||
|
e -e "(kill-emacs)" |
||||||
|
} |
||||||
|
|
||||||
|
# Make ctrl-Backspace work |
||||||
|
bindkey "\e[9;5~" backward-delete-word |
||||||
|
|
||||||
|
hash -d Papers="/home/jacopods/work/Papers" |
||||||
|
hash -d Books="/home/jacopods/work/Books" |
||||||
|
hash -d kde="/scratch/kde/src" |
||||||
|
hash -d kde5="/scratch/kde/src5" |
||||||
|
|
||||||
|
autoload zmv |
||||||
|
|
||||||
|
# export MANPATH="/usr/local/man:$MANPATH" |
||||||
|
|
||||||
|
# # Preferred editor for local and remote sessions |
||||||
|
# if [[ -n $SSH_CONNECTION ]]; then |
||||||
|
# export EDITOR='vim' |
||||||
|
# else |
||||||
|
# export EDITOR='mvim' |
||||||
|
# fi |
||||||
|
|
||||||
|
# Compilation flags |
||||||
|
# export ARCHFLAGS="-arch x86_64" |
||||||
|
|
||||||
|
# ssh |
||||||
|
# export SSH_KEY_PATH="~/.ssh/dsa_id" |
||||||
|
|
||||||
|
#+END_SRC |
||||||
Loading…
Reference in new issue