Ori.livneh has submitted this change and it was merged. Change subject: Fixes for ori's dotfiles ......................................................................
Fixes for ori's dotfiles * sys.setdefaultencoding() is not present in Python 3, so if calling that raises an attribute error, ignore it. * Misc. fixups for bash scripts. Change-Id: I52826f452a5f59c903a5329c76a489baa9e8b8af --- M modules/admin/files/home/ori/.bash_profile M modules/admin/files/home/ori/.pythonrc M modules/admin/files/home/ori/.vimrc 3 files changed, 46 insertions(+), 12 deletions(-) Approvals: Ori.livneh: Verified; Looks good to me, approved diff --git a/modules/admin/files/home/ori/.bash_profile b/modules/admin/files/home/ori/.bash_profile index d7caed2..50c8006 100644 --- a/modules/admin/files/home/ori/.bash_profile +++ b/modules/admin/files/home/ori/.bash_profile @@ -10,10 +10,15 @@ # Colors # -RESET="$(tput sgr0)" -BRIGHT="$(tput bold)" -GREY="$(tput setaf 7)" BLACK="$(tput setaf 0)" +BRIGHT="$(tput bold)" +GREY58="$(tput setaf 246)" +GREY="$(tput setaf 7)" +LIGHTSTEELBLUE3="$(tput setaf 146)" +RED="$(tput setaf 1)" +RESET="$(tput sgr0)" +SKYBLUE3="$(tput setaf 74)" +UNDERLINE="$(tput smul)" HOSTCOLOR="$(tput setaf $(($(cksum<<<$HOSTNAME|cut -d' ' -f-1)%6+1)))" @@ -22,7 +27,7 @@ # export VISUAL="vim" EDITOR="vim" TERM="xterm-256color" -export LC_ALL="en_US.UTF-8" LANG="en_US" +export LC_ALL="en_US.UTF-8" LANG="en_US" LC_COLLATE="C" export HISTCONTROL="ignoreboth" HISTFILESIZE=2000 HISTSIZE=1000 export BLOCKSIZE=1024 CLICOLOR=1 export PS1='\[$BRIGHT\]\[$BLACK\][\[$HOSTCOLOR\]${HOSTNAME}\[$GREY\]:\[$RESET\]\[$GREY\]\w\[$BRIGHT\]\[$BLACK\]]\[$RESET\] $ ' @@ -31,8 +36,7 @@ export PYTHONSTARTUP="${HOME}/.pythonrc" export PROMPT_COMMAND="history -a; history -n" export HHVM="$(pidof -s /usr/bin/hhvm 2>/dev/null)" -export LC_COLLATE="C" -export LESS="FIKMQRX" +export LESS="FIKMQRX" GROFF_NO_SGR=1 @@ -51,7 +55,7 @@ # Shortcuts # -alias ls="ls --color" ....="cd ../.." ...="cd .." cd..="cd .." g="git" +alias ls="ls --color" ....="cd ../.." ...="cd .." cd..="cd .." g="git" doh='sudo $(fc -ln -1)' =() { py "$*"; } mkpass() { head -c 32 /dev/urandom | base64 | tr -cd [:alnum:]; } puppet() { sudo puppet "$@"; } @@ -65,9 +69,9 @@ perf() { sudo perf "$@"; } gdbh() { sudo gdb -p "$(pidof -s hhvm)"; } redis-cli() { command redis-cli -a "$(grep -Po '(?<=masterauth )\S+' /etc/redis/redis.conf)" "$@"; } -fields() { awk 'END { for (i = 1; i <= NF; i++) printf("%s : %s\n", i, $i) }' "$@"; } +fields() { tail -1 "${@:---}" | awk 'END { for (i = 1; i <= NF; i++) printf("%s : %s\n", i, $i) }' ; } field() { awk -v field="$1" '{print $(field)}'; } -lat() { ls -lat "$@" | head; } +lat() { ls -lat *"${@:+.}${@}" | head; } sudo() { command sudo -E "$@"; } ptop() { @@ -76,6 +80,17 @@ sudo perf "${args[@]}" "$@" } +man() { + env LESS_TERMCAP_mb="${BRIGHT}${RED}" \ + LESS_TERMCAP_md="${BRIGHT}${SKYBLUE3}" \ + LESS_TERMCAP_me="${RESET}" \ + LESS_TERMCAP_se="${RESET}" \ + LESS_TERMCAP_so="${GREY58}" \ + LESS_TERMCAP_ue="${RESET}" \ + LESS_TERMCAP_us="${UNDERLINE}${LIGHTSTEELBLUE3}" \ + man "$@" +} + # # z - https://github.com/rupa/z diff --git a/modules/admin/files/home/ori/.pythonrc b/modules/admin/files/home/ori/.pythonrc index 1a19c6e..203a834 100644 --- a/modules/admin/files/home/ori/.pythonrc +++ b/modules/admin/files/home/ori/.pythonrc @@ -1,7 +1,10 @@ # -*- coding: utf-8 -*- -import sys -reload(sys) -sys.setdefaultencoding('utf-8') +try: + import sys + reload(sys) + sys.setdefaultencoding('utf-8') +except: + pass import datetime import json diff --git a/modules/admin/files/home/ori/.vimrc b/modules/admin/files/home/ori/.vimrc index cac0b3ee..0143726 100644 --- a/modules/admin/files/home/ori/.vimrc +++ b/modules/admin/files/home/ori/.vimrc @@ -14,6 +14,8 @@ set showmatch " Briefly jump to a paren once it's balanced set matchtime=2 " (for only .2 seconds). set autochdir " vim's cwd follows editor +set shortmess+=I " no message on startup + " Emacs keybidings for command mode cnoremap <C-A> <Home> @@ -23,6 +25,8 @@ " j/k navigate visual lines noremap j gj noremap k gk +nnoremap Q <nop> + " Tap space to clear highlighting nmap ,i :set list!<CR> @@ -126,3 +130,15 @@ colorscheme ir_black highlight clear SignColumn + +if has("user_commands") + command! -bang -nargs=? -complete=file E e<bang> <args> + command! -bang -nargs=? -complete=file W w<bang> <args> + command! -bang -nargs=? -complete=file Wq wq<bang> <args> + command! -bang -nargs=? -complete=file WQ wq<bang> <args> + command! -bang Wa wa<bang> + command! -bang WA wa<bang> + command! -bang Q q<bang> + command! -bang QA qa<bang> + command! -bang Qa qa<bang> +endif -- To view, visit https://gerrit.wikimedia.org/r/214106 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I52826f452a5f59c903a5329c76a489baa9e8b8af Gerrit-PatchSet: 2 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Ori.livneh <o...@wikimedia.org> Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits