J A G P R E E T wrote:
Hi There,
   I have these mappings defined in my .vimrc file.

map <C-t> :tabnew
map <C-left> :tabp<CR>
map <C-right> :tabn<CR>

I'm using putty(terminal emulator) to access the unix server.

The fist mapping works absolutely fine.
The other two doesn't work at all and gives the error(E388: Couldn't find
definition).
Furthermore I checked <C-left> shows the definition for the variable under
cursor.
No clues why its not overridden from my mapping.

When I changed map <C-left> : tabp<CR> to
Map <F2> : tabp<CR>
It works.

Another point is the mapping(<C-left>, <C-right>) works if I use Exceed or
x-Manager.
I have no clue at all why its not working in putty.
As far as I know for mapping at least; graphics support is not a must.

Whats missing for this mapping in putty.

Regards,
Jagpreet




This is the kind of error that could be the result of a bad or incomplete termcap/terminfo entry.

In console Vim, you can see what codes any key or keychord sends to Vim by hitting it in Insert mode, prefixed by Ctrl-V (or by ctrl-Q if your Ctrl-V is the "paste" key). In gvim the same procedure (on a non-printable key or keychord) gives you the <> notation for what gvim "thinks" you have pressed.

By the above method you can check, for instance, if Vim can tell the difference between Left and Ctrl-Left, Right and Ctrl-Right. (When I run Vim in GUI mode, it can; when I run the same executable in console mode, either in a konsole "xterm" or in /dev/tty with no access to X-windows, it cannot). If it cannot tell the difference, then you must use something else for the {lhs} of your mappings -- <S-Left> and <S-Right> are likely candidates.

If Vim can tell the difference, it still mightn't know that what you've hit is Ctrl-Left. In that case, one method (there are others) is to use the raw keycode sequence as the {lhs} of the mapping. You may have to bracket the mapping definition by a test on &term since different terminals give different keycodes. Example (in the vimrc):

        if has("gui_running") || (&term == "win32") || (&term == "pcterm")
                " we're either on our way to a GUI session
                " or on a terminal where <C-Left> etc. are defined correctly
                map <C-Left>  :tabprev<CR>
                map <C-Right> :tabnext<CR>
        elseif &term =~ '^xterm'
                " local xterm console
                " <Left> and <Ctrl-Left> are the same
                " map Backslash-Left instead
                map <Bslash><Esc>OD :tabprev<CR>
                map <Bslash><Esc>OC :tabprev<CR>
        elseif &term == "linux"
                " non-X text console
                " here too, map Backslash-Left
                map <Bslash><Esc>[D :tabprev<CR>
                map <Bslash><Esc>[C :tabnext<CR>
        elseif &term == "putty"
                " putty connection
                " ... etc. ...
        else
                " unknown type of console terminal
                " assume that <Left> is OK but <C-Left> isn't
                map <Bslash><Left>  :tabprev<CR>
                map <Bslash><Right> :tabnext<CR>
        endif

Note: The expression (&term == "putty") is a guess on my part. You may have to use something else depending on what Vim sees as the terminal type when in a putty session.


Best regards,
Tony

Reply via email to