Browse Source

Enabled Ultisnips and added a few Python ones (for reference)

master
Julio Biason 4 years ago
parent
commit
bbba7e3ddf
  1. 3
      .gitmodules
  2. 21
      nvim/UltiSnips/markdown.snippets
  3. 16
      nvim/UltiSnips/python.snippets
  4. 18
      nvim/init.vim
  5. 1
      nvim/pack/syntaxes/start/ultisnips

3
.gitmodules vendored

@ -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

21
nvim/UltiSnips/markdown.snippets

@ -0,0 +1,21 @@
snippet header
+++
title = "$1"
date = `date +%Y-%m-%d`
[taxonomies]
tags = [$2]
+++
$0
<!-- more -->
endsnippet
snippet pt
<!-- vim:spelllang=pt: -->
endsnippet
snippet date
`date +%Y-%m-%d`
endsnippet

16
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

18
nvim/init.vim

@ -45,7 +45,6 @@ let g:rainbow_active = 1 " This is part of the Rainbow brackets, enabling it
" Mappings {{{
nnoremap - :Ex<CR>
nnoremap <silent> <leader>c :call TrimWhiteSpace()<CR>
" nnoremap <leader>] <c-w>g<c-]>
" }}}
" 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 <buffer> %s/\s\+$//e " When saving a Python file, remove tailing spaces
au FileType python nmap <silent> <Leader>a :call JumpToAlternate()<CR>
" Shortcut to add pylint disables
au FileType python iab lint # pylint: disable
au FileType python iab defmain def main():<CR>""""""<CR><CR><BS>if __name__ == '__main__':<CR>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 (<CR>).
" There is one thing to take care, though: <CR> is NOT <C-R>.
" <C-R> will call the function (strftime), which will insert the current
" date.
au FileType markdown iab <silent> :header +++<CR>title = ""<CR>date = <C-R>=strftime('%Y-%m-%d')<CR><CR><CR>[taxonomies]<CR>tags = [""]<CR>+++<C-O>5k<C-O>6l
" This abbreviation adds a modeline to set VIM to change the spell
" lang to portuguese.
au FileType markdown iab :pt <!--<CR>vim:spelllang=pt:<CR>-->
au FileType markdown iab :date <C-R>=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

1
nvim/pack/syntaxes/start/ultisnips

@ -0,0 +1 @@
Subproject commit 8554371b57c8989cf73f73f288c456fb3f2a3a3a
Loading…
Cancel
Save