Open bpj opened 12 years ago
Why not just have 2 different targets? There's no shortage of them.
A concise prompt does sound slick.
Technically there is some consistency with the suggested behavior but I agree with @tpope on this, typing \begin{<env>}
is pretty long and using 2 different targets as explained here and simplified here could be used directly in ftplugin/tex.vim
:
let b:surround_{char2nr("e")} = "\\begin{\1environment: \1}\n\t\r\n\\end{\1\1}"
let b:surround_{char2nr("c")} = "\\\1command: \1{\r}"
If I need to put something into a LaTeX environment it's usually a longer piece -- one or more paragraphs --, and it's anyway most convenient to just open a line, type in the \begin{} line, move down, open another line and type in the \end{} line.
For me a far more common use case is that I'm marking up an existing text and want to surround a smaller text object -- a word/WORD/sentence -- with a command, making the text object the argument of the command. To handle the cases beyond the most common commands I've put the following in my .vimrc:
I would like to have a switch to change between the environment and command argument behavior of the
\
target and back. Even if that can't be I hope you put the above customization as an example in the documentation, since I believe very many who regularly mark up text written by others for LaTeX would find it very useful.A cosmetic and hence not very important wish would be for the prompt to appear just as
\
similar to<
with an XML tag.