Browse Source

PrettyXML (Vim), Stardew Valley aliases (Ubuntu)

red-hat-laptop
Kevin Mok 7 years ago
parent
commit
81c4390b33
  1. 23
      aliases/zsh_aliases
  2. 2
      dotfiles/gitconfig
  3. 31
      dotfiles/vimrc
  4. 2
      dotfiles/zshrc

23
aliases/zsh_aliases

@ -17,6 +17,7 @@ export KEYTIMEOUT=1
# search history
bindkey '\e[A' history-beginning-search-backward
bindkey '\e[B' history-beginning-search-forward
function src() { source $1 ; }
alias cs='printf "\033c"'
alias hst="history"
@ -63,6 +64,7 @@ alias "f."="f .."
alias "f.2"="f ..."
alias fd="f ~/Downloads"
function mvd() { mv $1 ~/Downloads ; }
alias fds="f ~/Downloads/sch"
alias doc="f ~/Documents"
alias cfg="f ~/.config"
@ -145,7 +147,7 @@ function py() { python $1 ; }
# device specific {{{ #
# NZXT {{{
if [ "$(hostname)" = "NZXT" ]; then
if [ "$(hostname)" = "nzxt" ]; then
# rotate monitor {{{ #
function rt() {
@ -223,11 +225,10 @@ if [ "$(hostname)" = "NZXT" ]; then
# }}} resume #
# }}} various coding projs #
fi
# NZXT }}}
# laptop {{{
if [[ "$(hostname)" = "X1-Carbon" ]]; then
elif [[ "$(hostname)" = "X1-Carbon" ]]; then
alias gbl="xbacklight -get"
function bl() { xbacklight -set $(echo "scale=2;$1*10" | bc) ; }
@ -238,9 +239,22 @@ if [[ "$(hostname)" = "X1-Carbon" ]]; then
alias plz="f ~/platterz2018/ocr-reader/app/src/main/java/com/google/android/gms/samples/vision/ocrreader"
alias ans="f /usr/local/android-studio/bin/"
fi
# laptop }}}
# ubuntu {{{
elif [ "$(hostname)" = "nzxt-ubuntu" ]; then
# Stardew Valley {{{
alias sdv="f ~/Documents/sdv-save"
function svmd() { f ~/.local/share/Steam/steamapps/common/Stardew\ Valley/Mods ; }
function svm() { mv $1 ~/.local/share/Steam/steamapps/common/Stardew\ Valley/Mods ; }
# }}}
fi
# }}}
# }}} device specific #
# git {{{ #
@ -255,6 +269,7 @@ alias gac="git add -A . && git commit"
# diff/log {{{ #
alias gd="git diff -w"
alias gdc="git diff --cached"
alias gds="git diff --stat"
alias gl="git log"
alias gsl="git shortlog"
# }}} diff/log #

2
dotfiles/gitconfig

@ -5,3 +5,5 @@
ui = auto
[core]
editor = nvim
[push]
default = simple

31
dotfiles/vimrc

@ -231,3 +231,34 @@ autocmd Filetype tex inoremap <localleader>tx $t(x)$
" }}} tex "
" }}} Local Mappings "
" format XML {{{
function! DoPrettyXML()
" save the filetype so we can restore it later
let l:origft = &ft
set ft=
" delete the xml header if it exists. This will
" permit us to surround the document with fake tags
" without creating invalid xml.
1s/<?xml .*?>//e
" insert fake tags around the entire document.
" This will permit us to pretty-format excerpts of
" XML that may contain multiple top-level elements.
0put ='<PrettyXML>'
$put ='</PrettyXML>'
silent %!xmllint --format -
" xmllint will insert an <?xml?> header. it's easy enough to delete
" if you don't want it.
" delete the fake tags
2d
$d
" restore the 'normal' indentation, which is one extra level
" too deep due to the extra tags we wrapped around the document.
silent %<
" back to home
1
" restore the filetype
exe "set ft=" . l:origft
endfunction
command! PrettyXML call DoPrettyXML()
" }}}

2
dotfiles/zshrc

@ -108,4 +108,6 @@ then
xinput disable "ELAN Touchscreen"
# enable horizontal scrolling
synclient HorizTwoFingerScroll=1
else
xmodmap ~/.Xmodmap
fi
Loading…
Cancel
Save