On Sat, Dec 20, 2008 at 12:30:17AM -0200, Leandro Camargo wrote:
> 
> On Sat, Dec 20, 2008 at 12:17 AM, Tony Mechelynck
> <antoine.mechely...@gmail.com> wrote:
> > On 20/12/08 00:26, Leandro N. Camargo wrote:
> >> I'm not having success to make these two key mappings to work:
> >>
> >> noremap<silent>  <C-,>  <Esc>:call cursor(line('.'), 1)<CR>i
> >> noremap<silent>  <C-.>  <Esc>:call cursor(line('.'), col('$'))<CR>i
> >>
> >> Since my cmd+arrow(left/right) shortcuts doens't work inside my bash
> >> terminal (I don't have Home/End keys on my macbook) I've tried to make
> >> this workaround at least for vim.
> >>
> >> I've put both inside my .vimrc (and loding into my vim using :source)
> >> and I wasn't succeeded.
> >> I've tried imap and inoremap there as well.
> >>
> >> Anyone know what is the catch?
> >>
> >> Best regards,
> >> Leandro.
> >
> > Among all thinkable Ctrl-printable key combinations, only those for
> > "printable keys" in the range 0x40-0x5F are reliably mappable, plus
> > Ctrl-lowercase letters (because case doesn't matter) and Ctrl-? which
> > maps to 0x7F. The culprit is not Vim, not even vi, but ASCII which
> > defined only those combinations, so only these can be seen (as 0x00-0x1F
> > plus 0x7F) when using "cooked" keyboard input, as Vim does. Of the
> > Ctrl-unprintable key combinations, some of them can be seen, others not;
> > and some of them are ambiguous as to the presence or absence of the Ctrl
> > modifier; it all tepends on your keyboard interface.
> >
> > On the Mac, there are both a Ctrl and a Cmd modifier; one of them is
> > represented as <C-something>, the other as <D-something>. If one of them
> > doesn't work, try the other.
> 
> Thanks you all for your thoughts.
> Ben is right about the "," and "." keys over key mappings, the problem
> was due these keys.
> Even regarding Tony thoughts about non-printables chars I'd insist on
> using <C-Left> and <C-Right> to do these my desired tasks.
> But as I realized they are already created inside vim for tasks I
> don't even use.
> So my golden question is: can I over these key mappings <C-Left> and 
> <C-Right> ?
> Because what I really want is to make something like:
> 
> imap <C-Left> <Esc>bi
> imap <C-Right> <Esc>wi
> imap <C-S-Left> <Esc>:call cursor(line('.'), 1)<CR>i
> imap <C-S-Right> <Esc>:call cursor(line('.'), col('$'))<CR>i

You still haven't corrected this i (should be a). Using <esc>A is
much shorter anyway :-) Thus just use:
> imap <C-S-Right> <Esc>A

On linux you can do something like 
xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'
to map capslock to <esc>. Then typing <caps>b is even more convinient
than using the default ctrl-left and ctrl-right combos. Your <esc>
mapping stuff won't work with visual mode. So do yourself a favour,
read :h motion once to see what mappings are availible. Repeat this once
a month till you feel you know most mappings you really need. You'll
find mappings such as tT fF (and using ; and , (repeat last movement)
which are much better than ctrl- quirks. And you'll be able to use them
in visual mode as well.
You'll be more precise with vim mappings as well. Example:
Lookup the difference e E  w W. Which behaviour do you want for c-right?

I know its hard to learn something you're not used to. Put it will pay off soon
if you spend some time within vim.

At least this is what I would do.. But it depends on how much time
you'll spend coding or editing text in your life.

my 2 cents again :-)

Sincerly
Marc Weber

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to