From faac9512ba959286621bcb1222ebcdc153ebe37c Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Fri, 12 Mar 2021 11:21:21 -0500 Subject: [PATCH] lots of snippets --- .vim/mysnippets/all.snippets | 9 +++++++++ .vim/mysnippets/scheme.snippets | 2 +- .vim/mysnippets/tex.snippets | 14 +++++++++++++- .vim/templates/skeleton.xml | 13 +++++++++++++ .vimrc | 7 +++++++ 5 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 .vim/templates/skeleton.xml diff --git a/.vim/mysnippets/all.snippets b/.vim/mysnippets/all.snippets index 3929897..6a9059a 100644 --- a/.vim/mysnippets/all.snippets +++ b/.vim/mysnippets/all.snippets @@ -1,3 +1,12 @@ snippet today "Today" w `date +"%A, %B %d"` endsnippet + +snippet '([0-9]+)->([0-9]+)' "enumerate list" rw +`!p +start = int(match.group(1)) +end = int(match.group(2)) +for i in range(start, end+1): + snip.rv += str(i)+"\n" +` +endsnippet diff --git a/.vim/mysnippets/scheme.snippets b/.vim/mysnippets/scheme.snippets index fa2a1ef..3e9678d 100644 --- a/.vim/mysnippets/scheme.snippets +++ b/.vim/mysnippets/scheme.snippets @@ -1,3 +1,3 @@ -snippet ~ "lambda" iA +snippet \ "lambda" w λ endsnippet diff --git a/.vim/mysnippets/tex.snippets b/.vim/mysnippets/tex.snippets index 9ee0f20..33cef93 100644 --- a/.vim/mysnippets/tex.snippets +++ b/.vim/mysnippets/tex.snippets @@ -1,5 +1,5 @@ # Enviros -snippet \begin "enviroment" bA +snippet beg "enviroment" w \begin{$1} $0 \end{$1} @@ -29,6 +29,18 @@ snippet proof "proof" w \end{proof} endsnippet +snippet ibeg "inline enviroment" w +\begin{$1} $2 \end{$1} $0 +endsnippet + +snippet ibmat "inline bmatrix" w +\begin{bmatrix} $1 \end{bmatrix} $0 +endsnippet + +snippet ibsmat "inline small bmatrix" w +\begin{bsmallmatrix} $1 \end{bsmallmatrix} $0 +endsnippet + # FRACTIONS snippet // "frac" iA \\frac{$1}{$2}$0 diff --git a/.vim/templates/skeleton.xml b/.vim/templates/skeleton.xml new file mode 100644 index 0000000..a40a1a8 --- /dev/null +++ b/.vim/templates/skeleton.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/.vimrc b/.vimrc index a0842f5..df16a5d 100644 --- a/.vimrc +++ b/.vimrc @@ -15,6 +15,7 @@ set encoding=utf-8 set tabstop=4 set shiftwidth=4 set expandtab +set hidden " spell check setlocal spell @@ -100,6 +101,7 @@ augroup templates autocmd BufNewFile *.tex 0r ~/.vim/templates/skeleton.tex autocmd BufNewFile *.html 0r ~/.vim/templates/skeleton.html autocmd BufNewFile *.rkt 0r ~/.vim/templates/skeleton.rkt + autocmd BufNewFile *.xml 0r ~/.vim/templates/skeleton.xml augroup END " vim plug @@ -123,12 +125,17 @@ Plug 'tpope/vim-commentary' call plug#end() +" leader for plugins +let maplocalleader = "\\" + " Ultisnips let g:UltiSnipsExpandTrigger = '' let g:UltiSnipsJumpForwardTrigger = '' let g:UltiSnipsJumpBackwardTrigger = '' let g:UltiSnipsSnippetDirectories=["UltiSnips", "mysnippets"] +map sr :call UltiSnips#RefreshSnippets() + " Vimtex let g:tex_flavor='latex' let g:vimtex_view_method='zathura' -- 2.20.1