l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
April 21: Google Glass
Next Installfest:
TBD
Latest News:
Mar. 18: Google Glass at LUGOD's April meeting
Page last updated:
2004 Nov 30 14:33

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] vim question: making mapping atomic w.r.t the '.'command
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] vim question: making mapping atomic w.r.t the '.'command



On Tue, Nov 30, 2004 at 02:00:10AM -0500, Peter Jay Salzman wrote:
> On Mon 29 Nov 04,  6:27 PM, Henry House <hajhouse@houseag.com> said:
> > I have a nice mapping in Vim 6:
> > 
> > 	:nmap gfe cw\empf{^[pa}^[
> > 
> > which emphasises a word when the buffer contains LaTeX source.
> 
> 
> This macro works, but you have to position the cursor on the beginning of the
> word, otherwise, you end up with only a part of the word emphasized.  Another
> strategy would be:
> 
>    1. Find the previous space character.
>    2. Move the cursor right by one.
>    3. Then change the word.
> 
> Here would be that strategy expressed as a macro:
> 
>    :nmap gfe F lcw\empf{<esc>pa}<esc>
>  
> The deficiency with my macro is that it doesn't work on the first word of
> each line since there's no space before it.
> 
> The benefit is that you can be "anywhere" in the word (provided the word
> doesn't start a new line) and it'll work.
> 
> Depends on which you find is the bigger annoyance.  ;-)

I believe an easier solution to this problem would be:

    :nmap gfe ciw\empf{^[pa}^[

Changing 'cw' to 'ciw' tells vim to change the word the cursor is inside
of so this should work anywhere, including the start of a new line.


Matt

-- 

*************************************************
* Matt Roper <matt@mattrope.com>                *
* http://www.mattrope.com                       *
* PGP Key: http://www.mattrope.com/mattrope.asc *
*************************************************
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
EDGE Tech Corp.
For donating some give-aways for our meetings.