Forked vim-snippets and transferred snippets
I wanted to alter the default snippets so I thought I might as well move all mine into there as well, instead of keeping track of changes in 2 repositories. Also, having become comfortable with Vim folding, I thought it'd be more organized to consolidate similar alias files (i.e. 209 -> school, laptop/my_pc -> pc) and then add folding to the top-level files.
This commit is contained in:
27
.vimrc
27
.vimrc
@@ -1,3 +1,4 @@
|
|||||||
|
" set x=y {{{ "
|
||||||
set relativenumber
|
set relativenumber
|
||||||
set background=dark
|
set background=dark
|
||||||
" set t_Co=256
|
" set t_Co=256
|
||||||
@@ -11,14 +12,13 @@ set autoindent
|
|||||||
set mouse=c
|
set mouse=c
|
||||||
set clipboard=unnamedplus
|
set clipboard=unnamedplus
|
||||||
set foldmethod=marker
|
set foldmethod=marker
|
||||||
|
" }}} set x=y "
|
||||||
|
|
||||||
autocmd VimResized * wincmd =
|
autocmd VimResized * wincmd =
|
||||||
autocmd BufNewFile,BufRead .*_aliases set syntax=sh
|
autocmd BufNewFile,BufRead .*_aliases set syntax=sh
|
||||||
|
|
||||||
" 'h/u3/c7/05/mokkar/.vim/plugged'
|
" vim-plug {{{ "
|
||||||
" '~/.vim/plugged'
|
" plug auto-install
|
||||||
|
|
||||||
" plug
|
|
||||||
if empty(glob('~/.vim/autoload/plug.vim'))
|
if empty(glob('~/.vim/autoload/plug.vim'))
|
||||||
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
||||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
@@ -36,23 +36,26 @@ Plug '907th/vim-auto-save'
|
|||||||
Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
|
Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
|
||||||
Plug 'lervag/vimtex'
|
Plug 'lervag/vimtex'
|
||||||
Plug 'Valloric/YouCompleteMe'
|
Plug 'Valloric/YouCompleteMe'
|
||||||
Plug 'honza/vim-snippets'
|
Plug 'Kevin-Mok/vim-snippets'
|
||||||
Plug 'SirVer/ultisnips'
|
Plug 'SirVer/ultisnips'
|
||||||
Plug 'ervandew/supertab'
|
Plug 'ervandew/supertab'
|
||||||
|
" }}} vim-plug "
|
||||||
|
|
||||||
|
" YCM/UltiSnips {{{ "
|
||||||
" make YCM compatible with UltiSnips (using supertab)
|
" make YCM compatible with UltiSnips (using supertab)
|
||||||
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
|
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
|
||||||
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
|
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
|
||||||
let g:SuperTabDefaultCompletionType = '<C-n>'
|
let g:SuperTabDefaultCompletionType = '<C-n>'
|
||||||
|
|
||||||
" better key bindings for UltiSnipsExpandTrigger
|
" better key bindings for UltiSnipsExpandTrigger
|
||||||
let g:UltiSnipsExpandTrigger = "<tab>"
|
let g:UltiSnipsExpandTrigger = "<tab>"
|
||||||
let g:UltiSnipsJumpForwardTrigger = "<tab>"
|
let g:UltiSnipsJumpForwardTrigger = "<tab>"
|
||||||
let g:UltiSnipsJumpBackwardTrigger = "<C-tab>"
|
let g:UltiSnipsJumpBackwardTrigger = "<C-tab>"
|
||||||
|
" }}} YCM/UltiSnips "
|
||||||
|
|
||||||
call plug#end()
|
call plug#end()
|
||||||
colorscheme gotham256
|
colorscheme gotham256
|
||||||
|
|
||||||
|
" Mappings {{{ "
|
||||||
map <F3> :wa<CR>
|
map <F3> :wa<CR>
|
||||||
map <F4> :wqa<CR>
|
map <F4> :wqa<CR>
|
||||||
map <F5> :qa!<CR>
|
map <F5> :qa!<CR>
|
||||||
@@ -64,6 +67,18 @@ map <S-Enter> O<ESC>
|
|||||||
let mapleader="\<Space>"
|
let mapleader="\<Space>"
|
||||||
nnoremap <leader>e o<ESC>
|
nnoremap <leader>e o<ESC>
|
||||||
nnoremap <leader>f za
|
nnoremap <leader>f za
|
||||||
|
nnoremap <leader>ff :set foldmethod=marker<CR> zM
|
||||||
nnoremap <leader>m :call cursor(0, len(getline('.'))/2)<CR>
|
nnoremap <leader>m :call cursor(0, len(getline('.'))/2)<CR>
|
||||||
nnoremap <leader>p :LLPStartPreview<CR>
|
nnoremap <leader>p :LLPStartPreview<CR>
|
||||||
|
nnoremap <leader>r :.,.+s///g<left><left><left><left><left>
|
||||||
nnoremap <leader>s :set syn=sh<CR>
|
nnoremap <leader>s :set syn=sh<CR>
|
||||||
|
" }}} Mappings "
|
||||||
|
|
||||||
|
" Local Mappings {{{ "
|
||||||
|
let maplocalleader="-"
|
||||||
|
autocmd Filetype c inoremap <localleader>s struct pixel
|
||||||
|
|
||||||
|
autocmd Filetype tex inoremap <localleader>t $T$
|
||||||
|
autocmd Filetype tex inoremap <localleader>x $x$-axis
|
||||||
|
autocmd Filetype tex inoremap <localleader>y $y$-axis
|
||||||
|
" }}} Local Mappings "
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
copy_on_selection = True
|
copy_on_selection = True
|
||||||
cursor_color = "#b9b9b9"
|
cursor_color = "#b9b9b9"
|
||||||
custom_command = env TERM=xterm-256color bash
|
custom_command = env TERM=xterm-256color bash
|
||||||
font = Monospace 9
|
font = Monospace 8.5
|
||||||
foreground_color = "#0077ff"
|
foreground_color = "#0077ff"
|
||||||
palette = "#000000:#aa0000:#00aa00:#aa5500:#0000aa:#aa00aa:#00aaaa:#aaaaaa:#555555:#ff5555:#55ff55:#ffff55:#5555ff:#ff55ff:#55ffff:#ffffff"
|
palette = "#000000:#aa0000:#00aa00:#aa5500:#0000aa:#aa00aa:#00aaaa:#aaaaaa:#555555:#ff5555:#55ff55:#ffff55:#5555ff:#ff55ff:#55ffff:#ffffff"
|
||||||
scrollbar_position = hidden
|
scrollbar_position = hidden
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
snippet alias "Custom alias"
|
|
||||||
alias ${1:name}="${2:cmd}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet 1lf "One-line function"
|
|
||||||
${1:name}() { ${2:cmd} ; }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mlf "Multi-line function"
|
|
||||||
${1:name}() {
|
|
||||||
${2:cmd}
|
|
||||||
}
|
|
||||||
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
|
|
||||||
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
snippet forg "Generic for"
|
|
||||||
for (int i = 0; i < ${1:count}; i++) {
|
|
||||||
${2}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mlc "malloc" i
|
|
||||||
= malloc(sizeof(${1:type}) * ${2:amt});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet stl "strlen"
|
|
||||||
strlen(${1:var})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet scp "strcpy"
|
|
||||||
strcpy(${1:dest}, ${2:str});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cmt "Line comment" b
|
|
||||||
/* ${1:text} */
|
|
||||||
endsnippet
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
snippet ts "Tabstop" i
|
|
||||||
${${1:number}:${2:default}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "b(egin)?" "begin{} / end{}" br
|
|
||||||
\begin{${1:something}}
|
|
||||||
${0:${VISUAL}}
|
|
||||||
\end{$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
snippet bf "Boldface" i
|
|
||||||
\textbf{$0}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet geq "Geq eqn" i
|
|
||||||
$\geq $0$
|
|
||||||
endsnippet
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
snippet ali "Align (math)" b
|
|
||||||
\begin{align*}
|
|
||||||
$1 &= $2 \\\\
|
|
||||||
\end{align*}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet al "Align line" b
|
|
||||||
&= $2 \\\\
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pwf "Piecewise function" b
|
|
||||||
\[
|
|
||||||
${1:name} = \left.
|
|
||||||
\begin{cases}
|
|
||||||
${2:equation}, & ${3:condition} \\\\
|
|
||||||
\end{cases}
|
|
||||||
\right\\}
|
|
||||||
\]
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet int "Integral" i
|
|
||||||
\int_{${1:lower}}^{${2:upper}} \, \mathrm{d}${3:x}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ie "I-L equation" i
|
|
||||||
$$1$ $2
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet le "Lined equation" b
|
|
||||||
$$$1$$
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sqrt "Square root" i
|
|
||||||
\sqrt{$1}$2
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ex "cdot" i
|
|
||||||
\cdot
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet et "I-L var T" i
|
|
||||||
$T$
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dlty "I-L Delta y" i
|
|
||||||
$\Delta y$
|
|
||||||
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
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
alias ll="ls -l"
|
|
||||||
|
|
||||||
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 ; }
|
|
||||||
|
|
||||||
## compilation functions
|
|
||||||
|
|
||||||
# compile without running
|
|
||||||
c9() { gcc -Wall -std=gnu99 -g -o "${1%.*}.out" "$1" -lm ; }
|
|
||||||
|
|
||||||
# compile without running
|
|
||||||
c9a() {
|
|
||||||
for file in *; do
|
|
||||||
if [[ $file = *.c ]]; then
|
|
||||||
gcc -Wall -std=gnu99 -g -o "${file%.*}".out "$file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# compile and run
|
|
||||||
c9r() { gc9 $1 && ./"${1%.*}.out" ; }
|
|
||||||
|
|
||||||
# compile and run with input
|
|
||||||
c9i() { gc9 $1 && ./"${1%.*}.out" < $2 ; }
|
|
||||||
|
|
||||||
# compile and run with input file
|
|
||||||
run() {
|
|
||||||
while read line; do
|
|
||||||
# ./$1.out $line
|
|
||||||
echo ./$1.out $line
|
|
||||||
done < $1.in
|
|
||||||
}
|
|
||||||
|
|
||||||
# temp
|
|
||||||
c4g() {
|
|
||||||
gcc -Wall -std=gnu99 -g -o greeting.out greeting.c
|
|
||||||
./greeting.out "Good morning" "Emmanuel"
|
|
||||||
}
|
|
||||||
|
|
||||||
# compile a1p2 and test with simple case
|
|
||||||
ca12() {
|
|
||||||
gcc -Wall -std=gnu99 -g -o validate_sin.out validate_sin.c sin_helpers.c
|
|
||||||
./validate_sin.out 810620716
|
|
||||||
}
|
|
||||||
|
|
||||||
# compile a1p1 and test with simple case
|
|
||||||
ca1() {
|
|
||||||
gcc -Wall -std=gnu99 -g -o count_large.out count_large.c
|
|
||||||
# ll | ./count_large.out 4000
|
|
||||||
./count_large.out 0 rw------- < ll.txt
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
|
# Initialize Other Alias Files {{{ #
|
||||||
alias_folder="~/linux-config/aliases"
|
alias_folder="~/linux-config/aliases"
|
||||||
alias_type="school git pc laptop 209 my_pc"
|
alias_type="school git pc"
|
||||||
for type in $alias_type; do
|
for type in $alias_type; do
|
||||||
. ~/linux-config/aliases/."$type"_aliases
|
. ~/linux-config/aliases/."$type"_aliases
|
||||||
done
|
done
|
||||||
|
# }}}
|
||||||
|
|
||||||
# system
|
# System {{{ #
|
||||||
alias l='ls -a'
|
alias l='ls -a'
|
||||||
alias ll='ls -alF'
|
alias ll='ls -alF'
|
||||||
alias cs='printf "\033c"'
|
alias cs='printf "\033c"'
|
||||||
@@ -15,18 +17,19 @@ alias s="systemctl suspend"
|
|||||||
alias hst="history"
|
alias hst="history"
|
||||||
alias topo="top -o %MEM"
|
alias topo="top -o %MEM"
|
||||||
alias rmsw="rm .sw*"
|
alias rmsw="rm .sw*"
|
||||||
|
# }}} System #
|
||||||
|
|
||||||
# directories
|
# Directories {{{ #
|
||||||
# unalias c
|
# unalias c
|
||||||
d() { cd "$@" && ls -a ; }
|
d() { cd "$@" && ls -a ; }
|
||||||
cd_up() { d $(printf "%0.s../" $(seq 1 $1 )) ; }
|
cd_up() { d $(printf "%0.s../" $(seq 1 $1 )) ; }
|
||||||
alias "d."="cd_up"
|
alias "d."="cd_up"
|
||||||
alias cdd="d ~/Downloads"
|
alias cdd="d ~/Downloads"
|
||||||
|
# }}} #
|
||||||
|
|
||||||
# apps
|
|
||||||
ok() { okular $1 ; }
|
ok() { okular $1 ; }
|
||||||
|
|
||||||
## config
|
# Config {{{ #
|
||||||
alias lc="d ~/linux-config/"
|
alias lc="d ~/linux-config/"
|
||||||
alias vv="vi ~/.vimrc"
|
alias vv="vi ~/.vimrc"
|
||||||
alias r=". ~/.bashrc"
|
alias r=". ~/.bashrc"
|
||||||
@@ -34,17 +37,17 @@ alias r=". ~/.bashrc"
|
|||||||
alias lca="d ~/linux-config/aliases"
|
alias lca="d ~/linux-config/aliases"
|
||||||
alias vb="vi $alias_folder/.bash_aliases"
|
alias vb="vi $alias_folder/.bash_aliases"
|
||||||
alias vs="vi $alias_folder/.school_aliases"
|
alias vs="vi $alias_folder/.school_aliases"
|
||||||
alias vs9="vi $alias_folder/.209_aliases"
|
alias vsg="vi $alias_folder/.git_aliases"
|
||||||
|
alias vsp="vi $alias_folder/.pc_aliases"
|
||||||
|
# }}} Config #
|
||||||
|
|
||||||
# redshift
|
# redshift
|
||||||
rs(){ redshift -O $(($1 * 1000)) ; }
|
rs(){ redshift -O $(($1 * 1000)) ; }
|
||||||
alias rx="redshift -x"
|
alias rx="redshift -x"
|
||||||
|
|
||||||
# UltiSnips
|
# UltiSnips {{{ #
|
||||||
alias dsnp="d ~/.vim/plugged/vim-snippets/UltiSnips/"
|
usnp_dir="~/.vim/plugged/vim-snippets/UltiSnips"
|
||||||
alias csnp="d ~/.vim/UltiSnips/"
|
alias snp="d $usnp_dir"
|
||||||
|
vsnp() { vi ~/.vim/plugged/vim-snippets/UltiSnips/"$1".snippets ; }
|
||||||
alias vsptm="vi ~/.vim/UltiSnips/texmath.snippets"
|
alias tmsp="vi $usnp_dir/texmath.snippets"
|
||||||
vdsnp() { vi ~/.vim/plugged/vim-snippets/UltiSnips/"$1".snippets ; }
|
# }}} #
|
||||||
vsnp() { vi ~/.vim/UltiSnips/"$1".snippets ; }
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# Aliases {{{
|
||||||
# . ~/.secure
|
# . ~/.secure
|
||||||
alias gs="git status -u"
|
alias gs="git status -u"
|
||||||
alias gpl="git pull --rebase"
|
alias gpl="git pull --rebase"
|
||||||
@@ -17,8 +18,11 @@ alias gst="git stash"
|
|||||||
alias gstp="git stash pop"
|
alias gstp="git stash pop"
|
||||||
alias gclear="git stash clear"
|
alias gclear="git stash clear"
|
||||||
alias egc="vim -c \"set syn=gitcommit\" -c \"set tw=72\" commit-msg.txt"
|
alias egc="vim -c \"set syn=gitcommit\" -c \"set tw=72\" commit-msg.txt"
|
||||||
|
# Aliases }}}
|
||||||
|
|
||||||
|
# Functions {{{
|
||||||
gcho() { git checkout $1 ; }
|
gcho() { git checkout $1 ; }
|
||||||
|
gcln() { git clone $1 ; }
|
||||||
gremotes() {
|
gremotes() {
|
||||||
git remote set-url --add --push origin $1
|
git remote set-url --add --push origin $1
|
||||||
git remote set-url --add --push origin $2
|
git remote set-url --add --push origin $2
|
||||||
@@ -31,3 +35,4 @@ gmrgr() {
|
|||||||
git merge --allow-unrelated-histories $1/master
|
git merge --allow-unrelated-histories $1/master
|
||||||
git remote remove $1
|
git remote remove $1
|
||||||
}
|
}
|
||||||
|
# Functions }}}
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
if [ "$(hostname)" == "X1-Carbon" ]; then
|
|
||||||
# key swaps
|
|
||||||
xmodmap -e "keycode 9 = Escape"
|
|
||||||
xmodmap -e "keycode 22 = Home"
|
|
||||||
xmodmap -e "keycode 119 = End"
|
|
||||||
xmodmap -e "keycode 110 = Delete"
|
|
||||||
xmodmap -e "keycode 115 = BackSpace"
|
|
||||||
fi
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
if [ "$(whoami)" == "kevin" ]; then
|
|
||||||
alias vbn="cvlc --loop --alsa-gain 1 ~/Downloads/brown-noise.mp3"
|
|
||||||
|
|
||||||
alias mt="ok ~/Documents/School/calc-textbook.pdf"
|
|
||||||
alias clc="gcalccmd"
|
|
||||||
alias 36t="ok ~/Documents/School/236-textbook.pdf"
|
|
||||||
fi
|
|
||||||
@@ -1,3 +1,14 @@
|
|||||||
|
# Both PC/Laptop {{{
|
||||||
|
if [ "$(whoami)" == "kevin" ]; then
|
||||||
|
alias vbn="cvlc --loop --alsa-gain 1 ~/Downloads/brown-noise.mp3"
|
||||||
|
|
||||||
|
alias mt="ok ~/Documents/School/calc-textbook.pdf"
|
||||||
|
alias clc="gcalccmd"
|
||||||
|
alias 36t="ok ~/Documents/School/236-textbook.pdf"
|
||||||
|
fi
|
||||||
|
# Both PC/Laptop }}}
|
||||||
|
|
||||||
|
# NZXT {{{
|
||||||
if [ "$(hostname)" == "NZXT" ]; then
|
if [ "$(hostname)" == "NZXT" ]; then
|
||||||
rt() {
|
rt() {
|
||||||
output="HDMI-0"
|
output="HDMI-0"
|
||||||
@@ -33,3 +44,15 @@ if [ "$(hostname)" == "NZXT" ]; then
|
|||||||
alias rcg="d ~/Documents/coding/random-color-generator"
|
alias rcg="d ~/Documents/coding/random-color-generator"
|
||||||
alias dcr="d ~/Documents/coding/dcr-logger"
|
alias dcr="d ~/Documents/coding/dcr-logger"
|
||||||
fi
|
fi
|
||||||
|
# NZXT }}}
|
||||||
|
|
||||||
|
# Laptop {{{
|
||||||
|
if [ "$(hostname)" == "X1-Carbon" ]; then
|
||||||
|
# key swaps
|
||||||
|
xmodmap -e "keycode 9 = Escape"
|
||||||
|
xmodmap -e "keycode 22 = Home"
|
||||||
|
xmodmap -e "keycode 119 = End"
|
||||||
|
xmodmap -e "keycode 110 = Delete"
|
||||||
|
xmodmap -e "keycode 115 = BackSpace"
|
||||||
|
fi
|
||||||
|
# Laptop }}}
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
in_lab=false
|
in_lab=false
|
||||||
cd_school="d ~/Documents/School/notes";
|
cd_school="d ~/Documents/School/notes";
|
||||||
|
|
||||||
|
# Lab Setup/Aliases {{{
|
||||||
if [ $(whoami) == "mokkar" ]; then
|
if [ $(whoami) == "mokkar" ]; then
|
||||||
TERM=xterm-256color
|
TERM=xterm-256color
|
||||||
xmodmap -e "clear Lock"
|
xmodmap -e "clear Lock"
|
||||||
in_lab=true
|
in_lab=true
|
||||||
cd_school="d ~";
|
cd_school="d ~";
|
||||||
fi
|
|
||||||
|
|
||||||
if $in_lab; then
|
|
||||||
ff() { firefox $1 ; }
|
ff() { firefox $1 ; }
|
||||||
zip() { tar -zcvf $1.tar.gz $1/ ; }
|
zip() { tar -zcvf $1.tar.gz $1/ ; }
|
||||||
alias nau="nautilus ."
|
alias nau="nautilus ."
|
||||||
fi
|
fi
|
||||||
|
# }}}
|
||||||
|
|
||||||
# general
|
# General {{{
|
||||||
alias sch="$cd_school"
|
alias sch="$cd_school"
|
||||||
alias 236="$cd_school/236"
|
alias 236="$cd_school/236"
|
||||||
alias psy="$cd_school/psy"
|
alias psy="$cd_school/psy"
|
||||||
@@ -25,8 +26,53 @@ cptp() {
|
|||||||
date=`date +%-m-%d`
|
date=`date +%-m-%d`
|
||||||
mv cp-template.tex "$date".tex
|
mv cp-template.tex "$date".tex
|
||||||
}
|
}
|
||||||
|
# }}}
|
||||||
|
|
||||||
# 136
|
# 136 {{{
|
||||||
alias 136="$cd_school/136"
|
alias 136="$cd_school/136"
|
||||||
alias 136l="$cd_school/136/lecture"
|
alias 136l="$cd_school/136/lecture"
|
||||||
alias pr2="$cd_school/136/par/2"
|
alias pr2="$cd_school/136/par/2"
|
||||||
|
# }}}
|
||||||
|
|
||||||
|
# 209 {{{
|
||||||
|
alias ll="ls -l"
|
||||||
|
|
||||||
|
# General {{{
|
||||||
|
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 ; }
|
||||||
|
# }}}
|
||||||
|
|
||||||
|
# {{{ Compilation Functions
|
||||||
|
# compile without running
|
||||||
|
c9() { gcc -Wall -std=gnu99 -g -o "${1%.*}.out" "$1" -lm ; }
|
||||||
|
|
||||||
|
# compile all without running
|
||||||
|
c9a() {
|
||||||
|
for file in *; do
|
||||||
|
if [[ $file = *.c ]]; then
|
||||||
|
gcc -Wall -std=gnu99 -g -o "${file%.*}".out "$file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# compile and run
|
||||||
|
c9r() { gc9 $1 && ./"${1%.*}.out" ; }
|
||||||
|
|
||||||
|
# compile and run with input
|
||||||
|
c9i() { gc9 $1 && ./"${1%.*}.out" < $2 ; }
|
||||||
|
|
||||||
|
# compile and run with input file
|
||||||
|
run() {
|
||||||
|
while read line; do
|
||||||
|
# ./$1.out $line
|
||||||
|
echo ./$1.out $line
|
||||||
|
done < $1.in
|
||||||
|
}
|
||||||
|
# }}}
|
||||||
|
# }}}
|
||||||
|
|||||||
Reference in New Issue
Block a user