From 47adae6d2e9ea0bc7cdbb43facab071b80be7816 Mon Sep 17 00:00:00 2001 From: katherine Date: Wed, 1 Mar 2023 01:44:48 -0700 Subject: custom vim snippets only --- .vim/snippets/c.snippets | 42 +++++++++++++++++++++++++++++++++++++++ .vim/snippets/tex.snippets | 49 ++++++++++++++++++++++++++++++++++++++++++++++ .vimrc | 12 +++++++++++- 3 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 .vim/snippets/c.snippets create mode 100644 .vim/snippets/tex.snippets diff --git a/.vim/snippets/c.snippets b/.vim/snippets/c.snippets new file mode 100644 index 0000000..ff06931 --- /dev/null +++ b/.vim/snippets/c.snippets @@ -0,0 +1,42 @@ +snippet main + int main(int argc, char *argv[]) + { + ${0} + } + +snippet in + #include <${1:stdio}.h> + $0 + +snippet ndef + #ifndef ${1:`toupper(vim_snippets#Filename('$1_H', 'UNTITLED_H'))`} + #define $1 + + ${0} + + #endif /* end of include guard: $1 */ + +snippet if + if (${1:true}) { + ${0:${VISUAL}} + } + +snippet elif + else if (${1:true}) { + ${0:${VISUAL}} + } + +snippet switch + switch (${1:/* variable */}) { + ${0:${VISUAL}} + } + +snippet for + for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) { + ${4} + } + +snippet while + while (${1:1}) { + ${0:${VISUAL}} + } diff --git a/.vim/snippets/tex.snippets b/.vim/snippets/tex.snippets new file mode 100644 index 0000000..bf1bd20 --- /dev/null +++ b/.vim/snippets/tex.snippets @@ -0,0 +1,49 @@ +snippet b \begin{} ... \end{} block + \\begin{${1:env}} + ${0:${VISUAL}} + \\end{$1} + +snippet sec \section + \\section{${1:section name}}% + \\label{sec:${2:$1}} + ${0} + +snippet sub \subsection + \\subsection{${1:subsection name}}% + \\label{sub:${2:$1}} + ${0} + +snippet ssub \subsubsection + \\subsubsection{${1:subsubsection name}}% + \\label{ssub:${2:$1}} + ${0} + +snippet it italic text + \\textit{${1:${VISUAL:text}}}${0} +snippet bf bold face text + \\textbf{${1:${VISUAL:text}}}${0} +snippet em emphasize text + \\emph{${1:${VISUAL:text}}}${0} +snippet sc small caps text + \\textsc{${1:${VISUAL:text}}}${0} +snippet sf sans serife text + \\textsf{${1:${VISUAL:text}}}${0} +snippet rm roman font text + \\textrm{${1:${VISUAL:text}}}${0} +snippet tt typewriter (monospace) text + \\texttt{${1:${VISUAL:text}}}${0} + +snippet ft \footnote + \\footnote{${1:${VISUAL:text}}}${0} + +snippet dd 3dots + \\dd{}${0} +snippet ddd 4dots + \\dd{}${0} +snippet tw textwidth + \\textwidth${0} +snippet hs hspace + \\hspace{${1:${VISUAL:text}}}${0} +snippet vs vspace + \\vspace{${1:${VISUAL:text}}}${0} + diff --git a/.vimrc b/.vimrc index 45b2557..4c68c79 100644 --- a/.vimrc +++ b/.vimrc @@ -48,7 +48,6 @@ Plug 'itchyny/lightline.vim' Plug 'MarcWeber/vim-addon-mw-utils' Plug 'tomtom/tlib_vim' Plug 'garbas/vim-snipmate' -Plug 'honza/vim-snippets' Plug 'dhruvasagar/vim-table-mode' @@ -133,10 +132,21 @@ let g:easytags_always_enabled = 1 "goyo fun! s:goyo_enter() set formatoptions+=a + let b:quitting = 0 + let b:quitting_bang = 0 + autocmd QuitPre let b:quitting = 1 + cabbrev q! let b:quitting_bang = 1 q! endfun fun! s:goyo_leave() set formatoptions-=a + if b:quitting + if b:quitting_bang + qa! + else + qa + endif + endif endfun autocmd! User GoyoEnter nested call goyo_enter() -- cgit v1.2.3