vimrc/sources_non_forked/vim-snippets/UltiSnips/all.snippets

114 lines
3.4 KiB
Text
Raw Normal View History

2012-08-17 03:41:25 +00:00
# This file contains snippets that are always defined. I personally
# have snippets for signatures and often needed texts
# sligthly lower priority than everything else since specialized versions
# should overwrite. The user needs to adjust her priority in her snippets to
# ~-55 so that other filetypes will still overwrite.
priority -60
2012-08-17 03:41:25 +00:00
##############
# NICE BOXES #
##############
global !p
2015-12-08 13:20:04 +00:00
from vimsnippets import foldmarker, make_box, get_comment_format
2019-11-16 15:28:42 +00:00
LOREM = """
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod \
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At \
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, \
no sea takimata sanctus est Lorem ipsum dolor sit amet.
"""
2012-08-17 03:41:25 +00:00
endglobal
snippet box "A nice box with the current comment symbol" b
`!p
box = make_box(len(t[1]))
2015-01-18 12:58:28 +00:00
snip.rv = box[0]
snip += box[1]
2016-11-09 17:22:55 +00:00
`${1:${VISUAL:content}}`!p
2012-08-17 03:41:25 +00:00
box = make_box(len(t[1]))
2015-01-18 12:58:28 +00:00
snip.rv = box[2]
snip += box[3]`
2012-08-17 03:41:25 +00:00
$0
endsnippet
snippet bbox "A nice box over the full width" b
`!p
2015-07-13 10:22:46 +00:00
if not snip.c:
width = int(vim.eval("&textwidth - (virtcol('.') == 1 ? 0 : virtcol('.'))")) or 71
box = make_box(len(t[1]), width)
2015-01-18 12:58:28 +00:00
snip.rv = box[0]
snip += box[1]
2016-11-09 17:22:55 +00:00
`${1:${VISUAL:content}}`!p
box = make_box(len(t[1]), width)
2015-01-18 12:58:28 +00:00
snip.rv = box[2]
snip += box[3]`
2012-08-17 03:41:25 +00:00
$0
endsnippet
snippet fold "Insert a vim fold marker" b
2015-12-08 13:20:04 +00:00
`!p snip.rv = get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]`${2:1} `!p snip.rv = get_comment_format()[2]`
endsnippet
snippet foldc "Insert a vim fold close marker" b
2015-12-08 13:20:04 +00:00
`!p snip.rv = get_comment_format()[0]` ${2:1}`!p snip.rv = foldmarker()[1]` `!p snip.rv = get_comment_format()[2]`
endsnippet
snippet foldp "Insert a vim fold marker pair" b
2015-12-08 13:20:04 +00:00
`!p snip.rv = get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]` `!p snip.rv = get_comment_format()[2]`
${2:${VISUAL:Content}}
2015-12-08 13:20:04 +00:00
`!p snip.rv = get_comment_format()[0]` `!p snip.rv = foldmarker()[1]` $1 `!p snip.rv = get_comment_format()[2]`
endsnippet
2012-08-17 03:41:25 +00:00
##########################
# LOREM IPSUM GENERATORS #
##########################
2019-11-16 15:28:42 +00:00
snippet "lorem(([1-4])?[0-9])?" "Lorem Ipsum" r
`!p snip.rv = " ".join(LOREM.split()[:int(match.group(1))]) if match.group(1) else LOREM`
2012-08-17 03:41:25 +00:00
endsnippet
2014-09-27 15:32:18 +00:00
##########################
# VIM MODELINE GENERATOR #
##########################
# See advice on `:help 'tabstop'` for why these values are set. Uses second
# modeline form ('set') to work in languages with comment terminators
# (/* like C */).
snippet modeline "Vim modeline"
vim`!v ':set '. (&expandtab ? printf('et sw=%i ts=%i', &sw, &ts) : printf('noet sts=%i sw=%i ts=%i', &sts, &sw, &ts)) . (&tw ? ' tw='. &tw : '') . ':'`
endsnippet
2016-10-02 11:37:21 +00:00
#########
# DATES #
#########
snippet date "YYYY-MM-DD" w
2018-06-14 10:31:12 +00:00
`!v strftime("%Y-%m-%d")`
2016-10-02 11:37:21 +00:00
endsnippet
snippet ddate "Month DD, YYYY" w
2017-02-11 13:01:38 +00:00
`!v strftime("%b %d, %Y")`
2016-10-02 11:37:21 +00:00
endsnippet
snippet diso "ISO format datetime" w
2018-06-14 10:31:12 +00:00
`!v strftime("%Y-%m-%d %H:%M:%S%z")`
2016-10-02 11:37:21 +00:00
endsnippet
snippet time "hh:mm" w
2017-02-11 13:01:38 +00:00
`!v strftime("%H:%M")`
2016-10-02 11:37:21 +00:00
endsnippet
snippet datetime "YYYY-MM-DD hh:mm" w
2017-02-11 13:01:38 +00:00
`!v strftime("%Y-%m-%d %H:%M")`
2016-10-02 11:37:21 +00:00
endsnippet
2017-03-07 17:04:28 +00:00
snippet todo "TODO comment" bw
`!p snip.rv=get_comment_format()[0]` ${2:TODO}: $0${3: <${4:`!v strftime('%d-%m-%y')`}${5:, `!v g:snips_author`}>} `!p snip.rv=get_comment_format()[2]`
endsnippet
2018-03-31 14:56:26 +00:00
##########
# Misc #
##########
snippet uuid "Random UUID" w
2019-11-16 15:28:42 +00:00
`!p if not snip.c: import uuid; snip.rv = str(uuid.uuid4())`
2018-03-31 14:56:26 +00:00
endsnippet
2012-08-17 03:41:25 +00:00
# vim:ft=snippets: