Browse Source

Merge with UltiSnips repo (added fnct to merge)

- UltiSnips: Moved alias snippets from sh to all.

- Aliases: Snippet, commit message.
- Vim: Map fold method, preview and line break to leader keys.
red-hat-laptop
Kevin Mok 7 years ago
parent
commit
f481b453aa
  1. 6
      .vimrc
  2. 17
      UltiSnips/all.snippets
  3. 21
      UltiSnips/c.snippets
  4. 8
      UltiSnips/sh.snippets
  5. 10
      UltiSnips/snippets.snippets
  6. 7
      UltiSnips/tex.snippets
  7. 23
      UltiSnips/texmath.snippets
  8. 1
      X1-Carbon-terminator
  9. 11
      aliases/.209_aliases
  10. 17
      aliases/.bash_aliases
  11. 14
      aliases/.git_aliases
  12. 4
      aliases/.my_pc_aliases
  13. 8
      aliases/.school_aliases

6
.vimrc

@ -55,13 +55,13 @@ colorscheme gotham256
map <F3> :wa<CR>
map <F4> :wqa<CR>
map <F5> :qa!<CR>
map <F6> :LLPStartPreview<CR>
map <F7> :AutoSaveToggle<CR>
set pastetoggle=<F9>
map <F10> :PlugInstall<CR>
map <C-Enter> o<ESC>
map <S-Enter> O<ESC>
let mapleader="\<Space>"
" nnoremap <leader>Enter oit<Tab>
nnoremap <leader>e o<ESC>
nnoremap <leader>f :set foldmethod=marker<CR>
nnoremap <leader>p :LLPStartPreview<CR>
nnoremap <leader>s :set syn=sh<CR>

17
UltiSnips/all.snippets

@ -0,0 +1,17 @@
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

21
UltiSnips/c.snippets

@ -0,0 +1,21 @@
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

8
UltiSnips/sh.snippets

@ -0,0 +1,8 @@
snippet evr "Var with escaped quotes" i
\"$${1:var}\"
endsnippet
snippet vr "Var with quotes" i
"$${1:var}"
endsnippet

10
UltiSnips/snippets.snippets

@ -0,0 +1,10 @@
snippet ts "Tabstop" i
${${1:number}:${2:default}}
endsnippet
snippet "b(egin)?" "begin{} / end{}" br
\begin{${1:something}}
${0:${VISUAL}}
\end{$1}
endsnippet

7
UltiSnips/tex.snippets

@ -0,0 +1,7 @@
snippet bf "Boldface" i
\textbf{$0}
endsnippet
snippet geq "Geq eqn" i
$\geq $0$
endsnippet

23
UltiSnips/texmath.snippets

@ -0,0 +1,23 @@
snippet al "Align (math)" b
\begin{align*}
$0
\end{align*}
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 "In-line equation" i
$$1$$2
endsnippet

1
X1-Carbon-terminator

@ -38,6 +38,5 @@
font = Monospace 11
foreground_color = "#0077ff"
palette = "#000000:#aa0000:#00aa00:#aa5500:#0000aa:#aa00aa:#00aaaa:#aaaaaa:#555555:#ff5555:#55ff55:#ffff55:#5555ff:#ff55ff:#55ffff:#ffffff"
scrollbar_position = hidden
use_custom_command = True
use_system_font = False

11
aliases/.209_aliases

@ -30,8 +30,15 @@ c9i() { gc9 $1 && ./"${1%.*}.out" < $2 ; }
# compile and run with input file
run() {
while read line; do
./$1 $line
done < $2
# ./$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

17
aliases/.bash_aliases

@ -20,24 +20,25 @@ alias rmsw="rm .sw*"
# unalias c
d() { cd "$@" && ls -a ; }
cd_up() { d $(printf "%0.s../" $(seq 1 $1 )) ; }
alias "c."="cd_up"
alias "d."="cd_up"
alias cdd="d ~/Downloads"
alias dsnip="d ~/.vim/plugged/vim-snippets/UltiSnips/"
alias csnip="d ~/.vim/UltiSnips/"
vdsnip() { vi ~/.vim/plugged/vim-snippets/UltiSnips/"$1".snippets ; }
vsnip() { vi ~/.vim/UltiSnips/"$1".snippets ; }
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 ; }
# config
## config
alias lc="d ~/linux-config/"
alias vv="vi ~/.vimrc"
alias r=". ~/.bashrc"
# aliases
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 vv="vi ~/.vimrc"
alias r=". ~/.bashrc"
# redshift
rs(){ redshift -O $(($1 * 1000)) ; }

14
aliases/.git_aliases

@ -4,7 +4,7 @@ alias gpl="git pull --rebase"
alias grbc="git rebase --continue"
alias gps="git push"
alias vig="vi .gitignore"
alias ga="git add -A *"
alias ga="git add -A * && gs"
alias gai="git add .gitignore"
alias gd="git diff -w"
alias gdc="git diff --cached"
@ -16,10 +16,18 @@ alias gsl="git shortlog"
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"
gcho() { git checkout $1 ; }
gremotes() {
git remote set-url --add --push origin $1
git remote set-url --add --push origin $2
}
alias egc="vim -c \"set syn=gitcommit\" -c \"set tw=72\" commit-msg.txt"
gmrgr() {
# 1 = remote name, 2 = remote path
git remote add $1 $2
git fetch $1
# whichever branch you want to merge
git merge --allow-unrelated-histories $1/master
git remote remove $1
}

4
aliases/.my_pc_aliases

@ -1,7 +1,7 @@
if [ "$(whoami)" == "kevin" ]; then
alias vbn="cvlc --loop ~/Downloads/brown-noise.mp3"
alias mt="ok ~/Documents/School/136/calc-textbook.pdf"
alias mt="ok ~/Documents/School/calc-textbook.pdf"
alias clc="gcalccmd"
alias 36t="ok ~/Documents/School/236/236-textbook.pdf"
alias 36t="ok ~/Documents/School/236-textbook.pdf"
fi

8
aliases/.school_aliases

@ -1,6 +1,6 @@
in_lab=false
cd_school="d ~/Documents/School";
if [ -d "/h/u3/c7/" ]; then
cd_school="d ~/Documents/School/notes";
if [ $(whoami) == "mokkar" ]; then
TERM=xterm-256color
xmodmap -e "clear Lock"
in_lab=true
@ -17,9 +17,10 @@ fi
alias sch="$cd_school"
alias 236="$cd_school/236"
alias psy="$cd_school/psy"
alias rml="rm *.aux *.log *.pdf"
pdl() { pdflatex $1 ; }
cptp() {
cp template.tex cp-template.tex
cp *template.tex cp-template.tex
chmod 600 cp-template.tex
date=`date +%-m-%d`
mv cp-template.tex "$date".tex
@ -27,5 +28,4 @@ cptp() {
# 136
alias 136="$cd_school/136"
alias 136n="$cd_school/136/notes"
alias pr2="$cd_school/136/par/2"
Loading…
Cancel
Save