## #36 change environment doubles backslashes

open
nobody
None
5
2011-08-14
2011-08-14
No

When I use <S-F5> to change the latex environment, I get two backslashes: \\begin{changed} … \\end{changed}. It seems that the variables 'first' and 'second' (envmacros.vim: s:change) are not evaluated as if they were strings. (VIM 7.3.260). I atach a patch to fix this.

## Discussion

• Bernhard Fisseni - 2011-08-14

Change Environment: only one backslash with \begin{…} and \end{…}

Attachments
• Bernhard Fisseni - 2011-10-16

Surprised it works for you. To me, it seems that the vim documentation indicates that doubling is necessary in the given examples, which use double quotes. Yet double and singe quotes have different semantics. I get:

File:
aabbcc

Commands:
:s/a/\='\\'/g
:s/c/\="\\"/g

Result:
\\\\bb\\

(I.e. doubling needed for double but not for single quotes.)

Hence, I wonder why the current version works for you, considering that it assigns first and second expressions with single (not doble quotes), in which the backslash need not be doubled.

• Jaeho Shin - 2012-12-14

This exact problem is happening to me as well. Reproducible in both Vim 7.3 (Apple's) and 7.3.744 (compiled via Homebrew) on Mac OS X 10.8.2.

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 20 2012 13:16:02)
Compiled by root@apple.com

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Dec 5 2012 11:15:41)
MacOS X (unix) version
Included patches: 1-744

Additionally, when I choose \[ or $$, it becomes \begin{\[} and \begin{$$}. I'll share my rough patch for this one as well. https://gist.github.com/4283455