Tuesday, June 4, 2013

Re: How to fix <h1> id strings?

....
:noremap <C-F5> 0/id\s*=<Enter>vi":s/\%V /_/g<Enter>

The inobvious trick is the \%V, which allows the substitution to work
only on the highlighted text. Otherwise, it operates on the whole line.
The preceding map appears to work consistently, as long as you're in
normal mode and on the line with the "id=".

Because snipMate has you in insert mode while filling out the line, the
following completes your <h1> line editing and puts you in insert mode
on a new blank line following:

:inoremap <C-F5> <Esc>0/id\s*=<Enter>vi":s/\%V /_/g<Enter>o

Without trying this you might want to replace the <Esc> with <C-O>:
:h i_CTRL-o

So I think you map would change to:
:inoremap <C-F5> <C-o>0/id\s*=<Enter>vi":s/\%V /_/g<Enter>

Just a thought, as this may preserve the undo operation better, not certain though.

Your welcome.
David 

--
--
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
 
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: