Reply to message «Re: swapping mark behaviors», 
sent 10:51:11 20 May 2011, Friday
by Jeroen Budts:

> One simple solution I can think of is to remap most mark-related
> 
> commands, such as:
> :map ma mA
> :map mb mB
> :map 'a 'A
> 
> "etc..
For m* you should use `nnoremap ma mA' because mark command is valid only for 
normal mode.
For '* you should use `noremap 'a 'A' because you should not use `map' at all 
unless you have to (it makes you less dependent on other options).

But I suggest to use cycles instead:

    for s:l in map(range(char2nr('a'), char2nr('z')), 'nr2char(v:val)')
        let s:u=toupper(s:l)
        execute 'nnoremap m'.s:l 'm'.s:u
        execute  "noremap '".s:l "'".s:u
        execute 'nnoremap m'.s:u 'm'.s:l
        execute  "noremap '".s:u "'".s:l
    endfor
    unlet s:l s:u

You can of course remap `m' and «'» to some functions that uses getchar() to 
obtain mark name but since there are only 26 possible marks I would prefer the 
above solution.

Original message:
> On 05/20/2011 08:26 AM, sinbad wrote:
> > how to make marks always across files. i want to be able to quickly
> > mark the
> > file positions, for RSI reasons it's difficult for me to press SHIFT
> > every time
> > to mark. so either i want the marks to always be across files or swap
> > the mark
> > behaviors of CAPs marks not NONCAPS marks.
> 
> One simple solution I can think of is to remap most mark-related
> 
> commands, such as:
> :map ma mA
> :map mb mB
> :map 'a 'A
> 
> "etc..
> 
> I quickly tried it and it seems to work. Probably there are better
> methods for doing this.
> 
> Jeroen

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to