Wednesday, December 7, 2011

Re: LaTeX-ize vim

> try this mapping (it's one single line):
>
>  :nnoremap <F5> "wciw<cr>\begin{<c-r>w}<cr>  <cr>0<c-d>\end{<c-r>w}<cr><up><up><end>
>
> Regards,
> Jürgen
>
> --
> Sometimes I think the surest sign that intelligent life exists elsewhere
> in the universe is that none of it has tried to contact us.     (Calvin)
>
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php

Thanks. Now I would like it also to work in insert mode (as well as
taking advance of this opportunity to learn a bit about creating maps
:D)

I have implemented this map:

:inoremap <F5> "<home><ESC>dwi\begin{<c-r>w}<cr>
<cr>0<c-d>\end{<c-r>w}<cr><up><up><end>

which more or less work, although the indentation is wrong (not a big
deal since vim fixes it when autoindent is on). However I don't really
understand why this works. In particular I don't know how the word is
deleted in you map, and what's the meaning of the <c-r>w command,
which apparently pastes the original word.

Thank you.

--
Juan José Gómez Navarro

Departamento de Física
Centro de Investigacion en Óptica y Nanofísica (CIOyN)
Universidad de Murcia
Campus Espinardo
E-30100 Murcia
España

Tel : +34 868 888 552
Fax : +34 868 888 568
Email: juanjo.gomeznavarro@gmail.com, jjgomeznavarro@um.es

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: