Newlines within custom recipes
KnightWhoSaysNeeeowWumPing opened this issue · 2 comments
Hello there,
I was wondering if there is a way of inserting additional newlines into custom recipes.
Consider the following configuration (~/.vimrc
):
let g:sanwich#recipes = deepcopy(g:sandwich#default_recipes)
let g:sanwich#recipes += [
\ {'buns': ['%START', '%END'], 'nesting': 1, 'input': ['x'], 'filetype': ['tex', 'plaintex']},
\ ]
When I now select the whole line bbb
within the following example .tex file ...
aaa
bbb
ccc
... and type sax
, the resulting output is:
aaa
%START
bbb
%END
ccc
Just as expected.
Is it however possible to insert an additional newline? Something like:
aaa
% START
bbb
% END
ccc
And if so, what should the recipe/buns configuration look like?
Thank you for your time and your awesome plugin!
How about this?
let g:sanwich#recipes = deepcopy(g:sandwich#default_recipes)
let g:sanwich#recipes += [
\ {'buns': ["%START\n", "\n%END"], 'nesting': 1, 'input': ['x'], 'filetype': ['tex', 'plaintex']},
\ ]
It might be better to make it work linewise always or limit it to work only with linewise block. For instance:
let g:sanwich#recipes += [
\ {'buns': ["%START\n", "\n%END"], 'nesting': 1, 'input': ['x'], 'filetype': ['tex', 'plaintex'], 'linewise': 1},
\ ]
or
let g:sanwich#recipes += [
\ {'buns': ["%START\n", "\n%END"], 'nesting': 1, 'input': ['x'], 'filetype': ['tex', 'plaintex'], 'motionwise': ['line']},
\ ]
Wow, now I feel stupid...
I tried with \n
but only using single quotes '
instead of double quotes "
. 🤦
Thank you very much! Also for pointing out the linewise
parameter - that's very handy, indeed 😄