Update UltiSnips snippets and Vim config

This commit is contained in:
foo-dogsquared 2019-08-22 20:25:27 +08:00
parent 2d208252e3
commit ac4951378e
3 changed files with 378 additions and 211 deletions

View File

@ -1,3 +1,16 @@
global !p
def smart_space(next_str, auto_str=" ", loose=False):
next_word = ""
if next_str:
if loose == True:
next_word = auto_str
elif next_str[0] in [",", ".", "-", "!", "?", " "]:
next_word = auto_str
return next_word
endglobal
# Text formatting
snippet "h(\d)" "Quick header snippet" biw
`!p
@ -9,6 +22,22 @@ snip.rv = "#" * header_level if legit_header_level else ""
$0
endsnippet
snippet tt "Monospace" biw
`$1` $0
endsnippet
snippet hl "Highlighted text" biw
#$1# $0
endsnippet
snippet sp "Superscript" biw
^$1^ $0
endsnippet
snippet sb "Subscript" biw
~$1~ $0
endsnippet
snippet dt "Definition term" bi
${1:<term>}::
${2:<definition>}
@ -55,7 +84,7 @@ $1
$0
endsnippet
# Images
# Multimedia blocks
snippet figure "Image block with caption" bi
.${2:<caption>}
image::${1:<image path>}[${3:width=100%,height=100%}]
@ -66,7 +95,6 @@ snippet -figure "Inline image" i
image:${1:<image path>}[${2}] $0
endsnippet
# Video blocks
snippet video "Video block" bi
video::${1:<image path>}[$2]
$0
@ -82,6 +110,11 @@ video::${1:<Vimeo video ID>}[vimeo]
$0
endsnippet
snippet audio "Audio block" bi
audio::${1:<image path>}[`!p snip.rv=smart_space(t[2], "options=", loose=True)`$2]
$0
endsnippet
# Other features
snippet incl "Include document" bi
include::${1:<file path>}[${2:<options>}]

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,7 @@ let g:UltiSnipsSnippetDirectories = [$HOME . "/.vim/own-snippets"]
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
let g:UltiSnipsEditSplit="context"
Plug 'scrooloose/nerdtree'
@ -51,7 +52,7 @@ set number relativenumber
set cursorline
" set tab to enter spaces, instead
set expandtab tabstop=4 shiftwidth=4 smartindent
set expandtab
let template_list = [
\ ["_minted-", ""],