I'm a newbie in vim. I'm trying to use it under OpenSUSE 11.0 as well
as cygwin (WinXP prof. sp3). Unfortunately I found out that cygwin
version doesn't move cursor through the words with CTRL+LEFT, CTRL+RIGHT
(while SUSE version does). I tried to append the folowing lines to
.vimrc file:
map <C-left> w
map <C-right> b
imap <C-left> w
imap <C-right> b
but it had no effect. I also tried uppercase variant:
map <C-LEFT> w
map <C-RIGHT> b
with the same negative result.
The following is an output of :version command.
:version
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Oct 9 2008 15:23:22)
Compiled by corinna@cathi
Huge version without GUI. Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent -clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+cryptv +cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +float
+folding -footer +fork() +gettext -hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap +menu
+mksession +modify_fname +mouse -mouseshape +mouse_dec -mouse_gpm -mouse_jsbterm +mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte +multi_lang -mzscheme
-netbeans_intg -osfiletype +path_extra -perl +postscript +printer +profile -python +quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent -sniff
+statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title -toolbar +user_commands
+vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp -xterm_clipboard
-xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2
Linking: gcc -L/usr/local/lib -o vim.exe -lm -lncurses -liconv -lintl
Thanks in advance,
Evgeny
In that case, you should first test if Vim sees the codes: in Insert
mode, hit Ctrl-V (or Ctrl-Q if your Ctrl-V is remapped to the paste
operation) followed by the key in question.
- If something appears in your edit buffer, but your mapping doesn't
work, then the problem is probably with your 'term' setting or its termcap
- If nothing appears, it probably means that the OS (including keyboard
driver and anything between it and the user application) is not passing
that keypress event to you.
Best regards,
Tony.
--
Democracy, n.:
A government of the masses. Authority derived through mass
meeting or any other form of direct expression. Results in mobocracy.
Attitude toward property is communistic... negating property rights.
Attitude toward law is that the will of the majority shall regulate,
whether it is based upon deliberation or governed by passion,
prejudice, and impulse, without restraint or regard to consequences.
Result is demagogism, license, agitation, discontent, anarchy.
-- U. S. Army Training Manual No. 2000-25 (1928-1932),
since withdrawn.
>> I'm a newbie in vim. I'm trying to use it under OpenSUSE 11.0 as
>> well as cygwin (WinXP prof. sp3). Unfortunately I found out that
>> cygwin version doesn't move cursor through the words with
>> CTRL+LEFT, CTRL+RIGHT (while SUSE version does). I tried to append
>> the folowing lines to .vimrc file:
>> map <C-left> w
>> map <C-right> b
>> imap <C-left> w
>> imap <C-right> b
>> but it had no effect.
> [...]
> In that case, you should first test if Vim sees the codes: in Insert
> mode, hit Ctrl-V (or Ctrl-Q if your Ctrl-V is remapped to the paste
> operation) followed by the key in question. - If something appears
> in your edit buffer, but your mapping doesn't work, then the problem
> is probably with your 'term' setting or its termcap - If nothing
> appears, it probably means that the OS (including keyboard driver
> and anything between it and the user application) is not passing
> that keypress event to you.
In Insert mode, when I press Ctrl-V first time, the ^ symbol appears.
The second Ctrl-V results in V char. So multiple Ctrl-V results in
^V^V^V^V^V^V^V
When I press Ctrl-Q nothing appears!
--
Best regards,
Evgeny
>>>> I'm a newbie in vim. I'm trying to use it under OpenSUSE 11.0 as
>>>> well as cygwin (WinXP prof. sp3). Unfortunately I found out that
>>>> cygwin version doesn't move cursor through the words with
>>>> CTRL+LEFT, CTRL+RIGHT (while SUSE version does). I tried to
>>>> append the folowing lines to .vimrc file:
>>>> map <C-left> w
>>>> map <C-right> b
>>>> imap <C-left> w
>>>> imap <C-right> b
>>>> but it had no effect.
>
>>> [...] In that case, you should first test if Vim sees the codes:
>>> in Insert mode, hit Ctrl-V (or Ctrl-Q if your Ctrl-V is remapped
>>> to the paste operation) followed by the key in question. - If
>>> something appears in your edit buffer, but your mapping doesn't
>>> work, then the problem is probably with your 'term' setting or its
>>> termcap - If nothing appears, it probably means that the OS
>>> (including keyboard driver and anything between it and the user
>>> application) is not passing that keypress event to you.
>>
>> In Insert mode, when I press Ctrl-V first time, the ^ symbol
>> appears. The second Ctrl-V results in V char. So multiple Ctrl-V
>> results in ^V^V^V^V^V^V^V
> No. Try pressing CTRL-V *once*, then pressing Ctrl-Left. The idea is
> that by doing this, you will see exactly what Vim receives from the
> keypress. The point is to verify that Vim receives the keypress at
> all, and if it does that it is what Vim expects. See :help i_CTRL-V
> for details on what we are asking you to do.
Excuse me!
Pressing Ctrl-V followed by Ctrl-Left results in four chars ^[[D
- the first two ^[ are blue and the last two [D are white.
But I have no idea what they mean.
> Out of curiosity, why are you mapping ctrl-LEFT to go one word to
> the RIGHT and vice-versa? (FYI, the reverse should work
> out-of-the-box). Are you using right-to-left text or something?
You're right, I mistook. Of course, C-left should be mapped to b.
> Also, your imaps wouldn't work even if Vim was receiving the
> <C-Left> properly. You want "imap <c-left> <c-o>w" and "imap
> <c-right> <c-o>b" instead. Otherwise, you'd just insert a w or b
> character into the text with your mappings. See :help i_CTRL-O.
You're right again! Now I enter the following commands
imap <c-left> <c-o>b
imap <c-right> <c-o>w
but they don't work too.
--
Best regards,
klu...@iszf.irk.ru mailto:klu...@iszf.irk.ru
^[ in blue means Ctrl-[, i.e., the Esc character. The whole result means
that when you hit Ctrl-Left, the sequence of interfaces between the
keyboard hardware and your Console Vim sends the three bytes Esc [ D (or
0x1B 0x5B 0x44) to represent that keypress.
Best regards,
Tony.
--
It's raisins that make Post Raisin Bran so raisiny ...
Tuesday, December 16, 2008, 2:18:16 PM, you wrote:
>> Pressing Ctrl-V followed by Ctrl-Left results in four chars ^[[D
>> - the first two ^[ are blue and the last two [D are white.
>> But I have no idea what they mean.
> ^[ in blue means Ctrl-[, i.e., the Esc character. The whole result
> means that when you hit Ctrl-Left, the sequence of interfaces
> between the keyboard hardware and your Console Vim sends the three
> bytes Esc [ D (or 0x1B 0x5B 0x44) to represent that keypress.
Thank you, but how I can now map this three bytes to <c-o>b ?
That doesn't look promising. They look like the ANSI codes for regular
cursor keys, i.e. the same as if you pressed it without control. You can
verify this using the CTRL-V trick: see if CTRL-V LEFT gives something
different to CTRL-V CTRL-LEFT. I suspect it won't.
In that case you'll have to investigate options of the terminal program
you are using? Which are you using? The default thing that comes with
Cygwin? I don't know Cygwin well, but does it have some options? See if
it has any to do with terminal emulation, or control keys. Or
investigate trying a different terminal program.
That your CTRL-Qs are eaten isn't a surprise at all if you are using
some program that indeed does emulate a terminal. CTRL-S is probably
eaten too. You can possibly get Vim to see them if you issue
stty -ixon
prior to starting Vim, if indeed that command exists in Cygwin.
Ben.