From bbba7e3ddf46ed257f7158e362c5a747d1835f7f Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Fri, 11 Dec 2020 17:49:34 -0300 Subject: [PATCH] Enabled Ultisnips and added a few Python ones (for reference) --- .gitmodules | 3 +++ nvim/UltiSnips/markdown.snippets | 21 +++++++++++++++++++++ nvim/UltiSnips/python.snippets | 16 ++++++++++++++++ nvim/init.vim | 18 ------------------ nvim/pack/syntaxes/start/ultisnips | 1 + 5 files changed, 41 insertions(+), 18 deletions(-) create mode 100644 nvim/UltiSnips/markdown.snippets create mode 100644 nvim/UltiSnips/python.snippets create mode 160000 nvim/pack/syntaxes/start/ultisnips diff --git a/.gitmodules b/.gitmodules index 0178e71..dcbd23c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -31,3 +31,6 @@ [submodule "nvim/pack/syntaxes/start/LanguageClient-neovim"] path = nvim/pack/syntaxes/start/LanguageClient-neovim url = git@github.com:autozimu/LanguageClient-neovim.git +[submodule "nvim/pack/syntaxes/start/ultisnips"] + path = nvim/pack/syntaxes/start/ultisnips + url = git@github.com:SirVer/ultisnips.git diff --git a/nvim/UltiSnips/markdown.snippets b/nvim/UltiSnips/markdown.snippets new file mode 100644 index 0000000..7c0b820 --- /dev/null +++ b/nvim/UltiSnips/markdown.snippets @@ -0,0 +1,21 @@ +snippet header ++++ +title = "$1" +date = `date +%Y-%m-%d` + +[taxonomies] +tags = [$2] ++++ + +$0 + + +endsnippet + +snippet pt + +endsnippet + +snippet date +`date +%Y-%m-%d` +endsnippet diff --git a/nvim/UltiSnips/python.snippets b/nvim/UltiSnips/python.snippets new file mode 100644 index 0000000..c7b4547 --- /dev/null +++ b/nvim/UltiSnips/python.snippets @@ -0,0 +1,16 @@ +snippet lint +# pylint:disable=$0 +endsnippet + +snippet date +`date +%Y-%m-%d` +endsnippet + +snippet defmain +def main(): + """$1""" + return + +if __name__ == '__main__': + main() +endsnippet diff --git a/nvim/init.vim b/nvim/init.vim index 59e8c54..9426628 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -45,7 +45,6 @@ let g:rainbow_active = 1 " This is part of the Rainbow brackets, enabling it " Mappings {{{ nnoremap - :Ex nnoremap c :call TrimWhiteSpace() -" nnoremap ] g " }}} " Plugin configuration {{{ @@ -97,10 +96,6 @@ au FileType python setlocal textwidth=79 " max line size au FileType python setlocal colorcolumn=80 " put a margin indicator au FileType python au BufWritePre %s/\s\+$//e " When saving a Python file, remove tailing spaces au FileType python nmap a :call JumpToAlternate() - -" Shortcut to add pylint disables -au FileType python iab lint # pylint: disable -au FileType python iab defmain def main():""""""if __name__ == '__main__':main() " }}} " CSV files {{{ @@ -108,7 +103,6 @@ au FileType csv setlocal list " Display special characters, like tabs (fo " }}} " Rust {{{ - let g:rustfmt_autosave = 1 " Apply `rustfmt` when saving the file. au FileType rust setlocal number " show line numbers @@ -121,18 +115,6 @@ au FileType rust setlocal colorcolumn=80 " put a margin indicator " }}} " Markdown {{{ -au FileType markdown setlocal iskeyword+=: " this is kinda of a "hack" to make abbr accept ":" in them -" This is a long abbreviation, but: -" Most of it is simply text, with linebreaks (). -" There is one thing to take care, though: is NOT . -" will call the function (strftime), which will insert the current -" date. -au FileType markdown iab :header +++title = ""date = =strftime('%Y-%m-%d')[taxonomies]tags = [""]+++5k6l -" This abbreviation adds a modeline to set VIM to change the spell -" lang to portuguese. -au FileType markdown iab :pt -au FileType markdown iab :date =strftime('%Y-%m-%d') - au FileType markdown setlocal spell " enable spell checking au FileType markdown setlocal textwidth=79 " max line size au FileType markdown setlocal expandtab " use spaces instead of tabs diff --git a/nvim/pack/syntaxes/start/ultisnips b/nvim/pack/syntaxes/start/ultisnips new file mode 160000 index 0000000..8554371 --- /dev/null +++ b/nvim/pack/syntaxes/start/ultisnips @@ -0,0 +1 @@ +Subproject commit 8554371b57c8989cf73f73f288c456fb3f2a3a3a