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:
2018-02-06 18:32:15 -05:00
parent 9db2037c26
commit 568aa72b5b
14 changed files with 117 additions and 224 deletions

View File

@@ -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
}

View File

@@ -1,10 +1,12 @@
# Initialize Other Alias Files {{{ #
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
. ~/linux-config/aliases/."$type"_aliases
done
# }}}
# system
# System {{{ #
alias l='ls -a'
alias ll='ls -alF'
alias cs='printf "\033c"'
@@ -15,18 +17,19 @@ alias s="systemctl suspend"
alias hst="history"
alias topo="top -o %MEM"
alias rmsw="rm .sw*"
# }}} System #
# directories
# Directories {{{ #
# unalias c
d() { cd "$@" && ls -a ; }
cd_up() { d $(printf "%0.s../" $(seq 1 $1 )) ; }
alias "d."="cd_up"
alias cdd="d ~/Downloads"
# }}} #
# apps
ok() { okular $1 ; }
## config
# Config {{{ #
alias lc="d ~/linux-config/"
alias vv="vi ~/.vimrc"
alias r=". ~/.bashrc"
@@ -34,17 +37,17 @@ alias r=". ~/.bashrc"
alias lca="d ~/linux-config/aliases"
alias vb="vi $alias_folder/.bash_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
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 ; }
# UltiSnips {{{ #
usnp_dir="~/.vim/plugged/vim-snippets/UltiSnips"
alias snp="d $usnp_dir"
vsnp() { vi ~/.vim/plugged/vim-snippets/UltiSnips/"$1".snippets ; }
alias tmsp="vi $usnp_dir/texmath.snippets"
# }}} #

View File

@@ -1,3 +1,4 @@
# Aliases {{{
# . ~/.secure
alias gs="git status -u"
alias gpl="git pull --rebase"
@@ -17,8 +18,11 @@ alias gst="git stash"
alias gstp="git stash pop"
alias gclear="git stash clear"
alias egc="vim -c \"set syn=gitcommit\" -c \"set tw=72\" commit-msg.txt"
# Aliases }}}
# Functions {{{
gcho() { git checkout $1 ; }
gcln() { git clone $1 ; }
gremotes() {
git remote set-url --add --push origin $1
git remote set-url --add --push origin $2
@@ -31,3 +35,4 @@ gmrgr() {
git merge --allow-unrelated-histories $1/master
git remote remove $1
}
# Functions }}}

View File

@@ -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

View File

@@ -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

View File

@@ -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
rt() {
output="HDMI-0"
@@ -33,3 +44,15 @@ if [ "$(hostname)" == "NZXT" ]; then
alias rcg="d ~/Documents/coding/random-color-generator"
alias dcr="d ~/Documents/coding/dcr-logger"
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 }}}

View File

@@ -1,19 +1,20 @@
in_lab=false
cd_school="d ~/Documents/School/notes";
# Lab Setup/Aliases {{{
if [ $(whoami) == "mokkar" ]; then
TERM=xterm-256color
xmodmap -e "clear Lock"
in_lab=true
cd_school="d ~";
fi
if $in_lab; then
ff() { firefox $1 ; }
zip() { tar -zcvf $1.tar.gz $1/ ; }
alias nau="nautilus ."
fi
# }}}
# general
# General {{{
alias sch="$cd_school"
alias 236="$cd_school/236"
alias psy="$cd_school/psy"
@@ -25,8 +26,53 @@ cptp() {
date=`date +%-m-%d`
mv cp-template.tex "$date".tex
}
# }}}
# 136
# 136 {{{
alias 136="$cd_school/136"
alias 136l="$cd_school/136/lecture"
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
}
# }}}
# }}}