From ac7fc9b5691ce751c0a2d54219bbc0a3fe46d9e4 Mon Sep 17 00:00:00 2001 From: Holger Rapp Date: Sun, 11 Oct 2015 14:03:37 +0200 Subject: [PATCH] Fix fold* snippets. --- UltiSnips/all.snippets | 10 +++++----- pythonx/vimsnippets.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/UltiSnips/all.snippets b/UltiSnips/all.snippets index 385df48..0e286e5 100644 --- a/UltiSnips/all.snippets +++ b/UltiSnips/all.snippets @@ -10,7 +10,7 @@ priority -60 # NICE BOXES # ############## global !p -from vimsnippets import foldmarker, make_box +from vimsnippets import foldmarker, make_box, get_comment_format endglobal snippet box "A nice box with the current comment symbol" b @@ -40,17 +40,17 @@ $0 endsnippet snippet fold "Insert a vim fold marker" b -`!p snip.rv = _get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]`${2:1} `!p snip.rv = _get_comment_format()[2]` +`!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 -`!p snip.rv = _get_comment_format()[0]` ${2:1}`!p snip.rv = foldmarker()[1]` `!p snip.rv = _get_comment_format()[2]` +`!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 -`!p snip.rv = _get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]` `!p snip.rv = _get_comment_format()[2]` +`!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}} -`!p snip.rv = _get_comment_format()[0]` `!p snip.rv = foldmarker()[1]` $1 `!p snip.rv = _get_comment_format()[2]` +`!p snip.rv = get_comment_format()[0]` `!p snip.rv = foldmarker()[1]` $1 `!p snip.rv = get_comment_format()[2]` endsnippet ########################## diff --git a/pythonx/vimsnippets.py b/pythonx/vimsnippets.py index c2e89d0..d200229 100644 --- a/pythonx/vimsnippets.py +++ b/pythonx/vimsnippets.py @@ -58,7 +58,7 @@ def _parse_comments(s): except StopIteration: return rv -def _get_comment_format(): +def get_comment_format(): """ Returns a 4-element tuple (first_line, middle_lines, end_line, indent) representing the comment format for the current file. @@ -78,7 +78,7 @@ def _get_comment_format(): def make_box(twidth, bwidth=None): - b, m, e, i = _get_comment_format() + b, m, e, i = get_comment_format() bwidth_inner = bwidth - 3 - max(len(b), len(i + e)) if bwidth else twidth + 2 sline = b + m + bwidth_inner * m[0] + 2 * m[0] nspaces = (bwidth_inner - twidth) // 2