From 1e2b07b971cc136e3f739d94888a5bd5fc1c594a Mon Sep 17 00:00:00 2001 From: Julian T Date: Tue, 2 Mar 2021 16:04:14 +0100 Subject: Add snippits for nvim --- vim-extra/.config/nvim/UltiSnips/go.snippets | 14 +++++++++ vim-extra/.config/nvim/UltiSnips/tex.snippets | 44 +++++++++++++++++++++++++++ vim-extra/.vim/extra.vim | 8 +++-- 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 vim-extra/.config/nvim/UltiSnips/go.snippets create mode 100644 vim-extra/.config/nvim/UltiSnips/tex.snippets diff --git a/vim-extra/.config/nvim/UltiSnips/go.snippets b/vim-extra/.config/nvim/UltiSnips/go.snippets new file mode 100644 index 0000000..96a9fec --- /dev/null +++ b/vim-extra/.config/nvim/UltiSnips/go.snippets @@ -0,0 +1,14 @@ +snippet ec "if err no nil" +if err != nil { + return $1err +} +$0 +endsnippet + +snippet eh "if err no nil write http" +if err != nil { + ${1:http}.Error(w, err.Error(), http.Status${2:InternalServerError}) + return +} +$0 +endsnippet diff --git a/vim-extra/.config/nvim/UltiSnips/tex.snippets b/vim-extra/.config/nvim/UltiSnips/tex.snippets new file mode 100644 index 0000000..1cdc972 --- /dev/null +++ b/vim-extra/.config/nvim/UltiSnips/tex.snippets @@ -0,0 +1,44 @@ +# https://castel.dev/post/lecture-notes-1/ +snippet begin "begin{} / end{}" bA +\begin{$1} + $0 +\end{$1} +endsnippet + +snippet dm "Display math" wA +\[ +$1 +.\] $0 +endsnippet + +# Subscript +snippet _p "Subscript" iA +_{$1}$0 +endsnippet + +# To the power of +snippet td "To the power of" iA +^{$1}$0 +endsnippet + +# Fraction +snippet // "Fraction" iA +\\frac{$1}{$2}$0 +endsnippet + +# Integral +snippet \int_ "Bestemt intergrale" wA +\int_{$1}^{$2} $3 \,dx$0 +:qa +endsnippet + +# Section and stuff +snippet sec "Section" bA +\section{$1} +$0 +endsnippet + +snippet ssec "Sub section" bA +\subsection{$1} +$0 +endsnippet diff --git a/vim-extra/.vim/extra.vim b/vim-extra/.vim/extra.vim index c2d7e21..176cdeb 100644 --- a/vim-extra/.vim/extra.vim +++ b/vim-extra/.vim/extra.vim @@ -39,7 +39,7 @@ " File support " Plugin 'cespare/vim-toml' - "Plugin 'lervag/vimtex' + Plugin 'lervag/vimtex' " Plugin 'aklt/plantuml-syntax' " Plugin 'LnL7/vim-nix' Plugin 'dart-lang/dart-vim-plugin' @@ -48,7 +48,7 @@ " Snippits - " Plugin 'SirVer/ultisnips' + Plugin 'SirVer/ultisnips' " Plugin 'honza/vim-snippets' call vundle#end() " required @@ -91,3 +91,7 @@ " let g:one_allow_italics = 1 let g:gruvbox_italic = 1 colorscheme gruvbox + + " Tab is already in use by completion + let g:UltiSnipsExpandTrigger="" + let g:UltiSnipsJumpForwardTrigger="" -- cgit v1.2.3