From 9db2037c26e5f5d1240eba1fbc11e02d29a6ec5e Mon Sep 17 00:00:00 2001 From: Kevin Mok Date: Mon, 5 Feb 2018 16:20:14 -0500 Subject: [PATCH] Added snippets to help with math lectures - snippets: Roman d, axes - Vim: set fold to markers by default, jump to middle of line mapping --- .vimrc | 3 ++- UltiSnips/all.snippets | 9 +++++++++ UltiSnips/sh.snippets | 8 -------- UltiSnips/texmath.snippets | 20 ++++++++++++++++++-- aliases/.209_aliases | 10 ++++++---- aliases/.bash_aliases | 13 +++++++++---- aliases/.my_pc_aliases | 2 +- aliases/.school_aliases | 1 + 8 files changed, 46 insertions(+), 20 deletions(-) delete mode 100644 UltiSnips/sh.snippets diff --git a/.vimrc b/.vimrc index 3d9a00c..2ebd9a2 100644 --- a/.vimrc +++ b/.vimrc @@ -10,6 +10,7 @@ set shiftwidth=4 set autoindent set mouse=c set clipboard=unnamedplus +set foldmethod=marker autocmd VimResized * wincmd = autocmd BufNewFile,BufRead .*_aliases set syntax=sh @@ -62,7 +63,7 @@ map O let mapleader="\" nnoremap e o -nnoremap ff :set foldmethod=marker nnoremap f za +nnoremap m :call cursor(0, len(getline('.'))/2) nnoremap p :LLPStartPreview nnoremap s :set syn=sh diff --git a/UltiSnips/all.snippets b/UltiSnips/all.snippets index 1de0f8b..fb71ed2 100644 --- a/UltiSnips/all.snippets +++ b/UltiSnips/all.snippets @@ -15,3 +15,12 @@ endsnippet snippet ltx "LaTeX" i LaTeX endsnippet + +snippet evr "Var with escaped quotes" w +\"$${1:var}\" +endsnippet + +snippet vr "Var with quotes" w +"$${1:var}" +endsnippet + diff --git a/UltiSnips/sh.snippets b/UltiSnips/sh.snippets deleted file mode 100644 index 4e87e22..0000000 --- a/UltiSnips/sh.snippets +++ /dev/null @@ -1,8 +0,0 @@ -snippet evr "Var with escaped quotes" i -\"$${1:var}\" -endsnippet - -snippet vr "Var with quotes" i -"$${1:var}" -endsnippet - diff --git a/UltiSnips/texmath.snippets b/UltiSnips/texmath.snippets index 5120925..b0ba40a 100644 --- a/UltiSnips/texmath.snippets +++ b/UltiSnips/texmath.snippets @@ -1,9 +1,13 @@ -snippet al "Align (math)" b +snippet ali "Align (math)" b \begin{align*} - $0 \\\\ + $1 &= $2 \\\\ \end{align*} endsnippet +snippet al "Align line" b +&= $2 \\\\ +endsnippet + snippet pwf "Piecewise function" b \[ ${1:name} = \left. @@ -45,3 +49,15 @@ endsnippet snippet thus "Therefore" b $\therefore$ endsnippet + +snippet rd "Roman d" i +\mathrm{d}${1:x} $2 +endsnippet + +snippet xax "x-axis" i +$x$-axis +endsnippet + +snippet yax "y-axis" i +$y$-axis +endsnippet diff --git a/aliases/.209_aliases b/aliases/.209_aliases index 6d3fe8c..8f1a970 100644 --- a/aliases/.209_aliases +++ b/aliases/.209_aliases @@ -1,8 +1,10 @@ alias ll="ls -l" -alias 209="$cd_school/209" -alias 9r="$cd_school/209/mokkar" -alias l4="$cd_school/209/mokkar/lab4" -alias a1="$cd_school/209/mokkar/a1" + +cd_209="d ~/Documents/School/209"; +alias 209="$cd_209" +alias 9r="$cd_209/mokkar" +alias l5="$cd_209/mokkar/lab5" +alias a2="$cd_209/mokkar/a2" # alias cdf="ssh -t mokkar@cdf.utoronto.ca '. ./.bashrc; bash -l'" alias cdf="echo \". ./.bashrc\"&& ssh mokkar@cdf.utoronto.ca" mkex() { chmod 700 $1 ; } diff --git a/aliases/.bash_aliases b/aliases/.bash_aliases index 60369bf..0188f68 100644 --- a/aliases/.bash_aliases +++ b/aliases/.bash_aliases @@ -22,10 +22,6 @@ d() { cd "$@" && ls -a ; } cd_up() { d $(printf "%0.s../" $(seq 1 $1 )) ; } alias "d."="cd_up" alias cdd="d ~/Downloads" -alias dsnp="d ~/.vim/plugged/vim-snippets/UltiSnips/" -alias csnp="d ~/.vim/UltiSnips/" -vdsnp() { vi ~/.vim/plugged/vim-snippets/UltiSnips/"$1".snippets ; } -vsnp() { vi ~/.vim/UltiSnips/"$1".snippets ; } # apps ok() { okular $1 ; } @@ -43,3 +39,12 @@ alias r=". ~/.bashrc" # redshift rs(){ redshift -O $(($1 * 1000)) ; } alias rx="redshift -x" + +# UltiSnips +alias dsnp="d ~/.vim/plugged/vim-snippets/UltiSnips/" +alias csnp="d ~/.vim/UltiSnips/" + +alias vsptm="vi ~/.vim/UltiSnips/texmath.snippets" +vdsnp() { vi ~/.vim/plugged/vim-snippets/UltiSnips/"$1".snippets ; } +vsnp() { vi ~/.vim/UltiSnips/"$1".snippets ; } + diff --git a/aliases/.my_pc_aliases b/aliases/.my_pc_aliases index 2e1d99d..2ec9ba4 100644 --- a/aliases/.my_pc_aliases +++ b/aliases/.my_pc_aliases @@ -1,5 +1,5 @@ if [ "$(whoami)" == "kevin" ]; then - alias vbn="cvlc --loop ~/Downloads/brown-noise.mp3" + alias vbn="cvlc --loop --alsa-gain 1 ~/Downloads/brown-noise.mp3" alias mt="ok ~/Documents/School/calc-textbook.pdf" alias clc="gcalccmd" diff --git a/aliases/.school_aliases b/aliases/.school_aliases index ae0241c..381bc3d 100644 --- a/aliases/.school_aliases +++ b/aliases/.school_aliases @@ -28,4 +28,5 @@ cptp() { # 136 alias 136="$cd_school/136" +alias 136l="$cd_school/136/lecture" alias pr2="$cd_school/136/par/2"