Well - i don't get it to work in terminal.
Any idea?
/Peter Holm
Which shift keys? On which OS? On which terminal or terminal emulator?
"Borland C" makes me believe you're on Windows, but in the Windows
console (the "dos box" as used by cmd.exe) there should be no problem.
But naming "terminal" with no article seems to point to MacOsX, where
the most common terminal emulator is called Terminal.app. Or are you
using "terminal" as a generic name for any kind of text console
including the Linux text console, the konsole application which is part
of KDE, the gnome-terminal which is of course part of Gnome, the xterm
console which is a generic terminal emulator for X11 systems, etc.?
However, all these text consoles have different properties, their $TERM
or 'term' values are different, etc.
If you are trying to map the Shift key without another key to be hit
together with it, or if you are trying to distinguish between left-shift
and right-shift, Vim can't do it.
Shift-F1 to Shift-F12 ought to work, but I notice that here in konsole
Shift-F12 isn't seen by Vim. The other ones are though. In the Linux
console however, my Vim sees Shift-F1 to Shift-F8 but doesn't know what
they are; Shift-F9 to Shift-F12 it just doesn't see.
Shift-Up etc. may or may not work depending on whether the
termcap/terminfo entries Vim is using match what your keyboard interface
is sending.
In general, it's better to give enough specific details for people to
understand exactly what you're trying to do and what happens or doesn't
happen.
Best regards,
Tony.
--
The cry has been that when war is declared, all opposition should
therefore be hushed. A sentiment more unworthy of a free country could
hardly be propagated. If the doctrine be admitted, rulers have only to
declare war and they are screened at once from scrutiny ... In war,
then, as in peace, assert the freedom of speech and of the press.
Cling to this as the bulwark of all our rights and privileges.
-- William Ellery Channing
Sorry . that was bad from my side, and i appricate very much your
detaljed ansver despite my lack of information.
My system is ubuntu 8.10, and i want this mappings to work.
http://groups.google.com/group/vim_use/browse_thread/thread/12892e26ed72f3f5?pli=1
In Short- i would like to, at first- get this settings to work in the
linux terminal, then (hopefully) i would like to get it to to work in
xterm and kde-konsloe as well.
00
I ma not very sure how to change my settings to get it to work in
linux-terminal, and i appricate all the help i can get.
My settngs in linux-terminal is
TTY=linux
the only change i have done is
stty -ixon
in my .bashrc
Well, I'm on openSUSE Linux, which is maybe not identical with Ubuntu
but at least it's not too different.
I just loaded Vim here in my Linux console, and when I hit Shift-Up,
Shift-Down, Shift-Left, Shift-Right, Shift-Ins or Shift-Del Vim sees the
same key without the Shift modifier. Shift-PgUp and Shift-PgDn it
doesn't see at all.
The best suggestion I can offer is to choose a different {lhs} for the
mappings. Maybe F5 to F8 because they are almost straight up from hjkl.
The resulting mappings would be as follows:
imap <F5> <esc>v<Left>
vmap <F5> <Left>
imap <F6> <esc>v<Down>
vmap <F6> <Down>
imap <F7> <Esc>v<Up>
vmap <F7> <Up>
imap <F8> <esc>v<Right>
vmap <F8> <Right>
Best regards,
Tony.
--
"An ounce of prevention is worth a pound of purge."
In GUI mode, vim is able to see every combination of modifier-key(s)
and symbol-key that the user can press except for those combinations
intercepted by the OS and/or window manager. In terminal mode, vim
doesn't see key combinations directly but sees only sequences of
7-bit and/or 8-bit characters emitted by the terminal program in
response to key combinations pressed by the user. Most terminal
programs emit unique character sequences for only a limited subset
of all the possible key combinations.
So it is not surprising that some mappings that work in GUI mode do
not work in terminal mode. That being said, if you post exactly the
mappings you're having problems with, someone here might be able to
offer a solution, or be able to tell you for sure that they won't
work.
Regards,
Gary
I had an earlier posting here, named :
Select Text without jump between Insert Mode / Visual Mode
and a user which name is Martin K. Schreder, kindley enough posted a
complete set of mapping to me.
Here between the dotted lines is part of our his ansver.
....................................
Well, you could do it like this:
" switch to visual mode and extend selection upwards
:imap <S-Up> <esc>v<Up>
" make sure the same key combination works in visual mode
:vmap <S-Up> <Up>
" do the same for other arrow keys
:imap <S-Down> <esc>v<Down>
:vmap <S-Down> <Down>
:imap <S-Left> <esc>v<Left>
:vmap <S-Left> <Left>
:imap <S-Right> <esc>v<Right>
:vmap <S-Right> <Right>
" C-Insert yanks in vis mode and goes back to insert
" Remapping C-Insert does not work for me in terminal
:vmap <C-Ins> y<esc>i
....................................
And here is a link to the complete posting:
http://groups.google.com/group/vim_use/browse_thread/thread/12892e26ed72f3f5?pli=1#
It's that mapping i really ought to get to work in terminal mode - and
hopefully also in xterm and konsole.
Regards
/Peter Holm
Well - i don't get it to work in terminal.
Any idea?
/Peter Holm
Sorry . that was bad from my side, and i appricate very much your
Sorry . that was bad from my side, and i appricate very much your
Your terminal and vim together determine which key combinations are
understood by vim. Vim uses the terminfo database to determine some
of these; I'm not sure how vim knows about the key combinations not
defined by terminfo. You can see which key combinations vim
recognizes by executing
:set termcap
For the rxvt terminal I'm using at the moment, vim recognizes
<Left>, <Right>, <Up>, <Down>, (S-Left> and <S-Right> but not <S-Up>
or <S-Down>. However, if I enter insert mode and hold the Ctrl key
while typing the letter v, then type the up arrow, I see that the
character sequence that the terminal emits for that key is
^[OA
where ^[ indicates the Esc character. If while in insert mode I
hold the Ctrl key while typing the letter v again, then hold the
shift key while typing the up arrow, I see that the resulting
character sequence is
^[[a
So this terminal does emit different character sequences for the
<Up> and <S-Up> keys. One way to get your mappings to work with
this terminal would be to also use these mappings:
:imap <Esc>[a <S-Up>
:imap <Esc>[b <S-Down>
You can perform similar experiments with your terminals to see if
they do emit unique character sequences for those key combinations
and it so, create mappings as I did. It may also be that some or
all of those terminals emit the same sequences for the shifted arrow
keys as they do for the unshifted arrow keys. In that case, you'll
have to have to use different key combinations for those mappings.
I hope that was clear enough. See also
:help i_CTRL-V
Regards,
Gary
Thankyou very much Gary for that great piece of information.
Now i will have some nice time experimenting with this. :)
My Best Regards
/Peter Holm
Thankyou very much Gary for that great piece of information.
Thankyou very much Gary for that great piece of information.
Thankyou very much Gary for that great piece of information.
Thankyou very much Gary for that great piece of information.