On 17/11/09 20:24, Matt Wozniski wrote: > > On Tue, Nov 17, 2009 at 11:01 AM, Christian Brabandt wrote: >> >> On Tue, November 17, 2009 4:16 pm, Robbo wrote: >>> >>> I've just looked for :h cword >>> but if i write >>> :map<C-[> :ptag<cword> >>> >>> it doesn't work. >> >> Try if this works: >> :map<C-[> :exe ":ptag " . expand("<cword>")<CR> > > I'm surprised no one has suggested: > > :nnoremap<C-[> <C-w><C-}> > > Maybe I'm missing some subtlety that makes that incorrect?
The subtlety is that Ctrl-} is undefined. If on your national keyboard it gives something usable, it's probably because your keyboard driver translates it to something else. The only "Ctrl+ printable key" combinations which Vim can reliably identify are those defined by ASCII, i.e., _only_ the following: 0x40 to 0x5F i.e. @, A to Z, [, \, ], ^ and _, where Ctrl subtracts 0x40, i.e., changes them to 0x00 to 0x1F respectively. In particular Ctrl-[ is the same as Esc, Ctrl-I is the same as Tab, Ctrl-M is the same as Enter, etc. Ctrl+lowercase is the same as Ctrl+ the corresponding uppercase, i.e. Ctrl+letter is the same as Ctrl+Shift+ the same letter Ctrl+? is 0x7F (DEL) That's all. Ctrl+ _non_printing key is detected differently, and may work or not work depending on which nonprinting key with which keyboard interface. The results may vary from OS to OS, and on a single OS between gvim, Console Vim in one terminal (such as xterm), Console Vim in another terminal (such as the Linux console), etc. > > Also, please note that mapping "<C-[>" has disastrous consequences in > terminal vim; it's likely to break everything from keypresses to mouse > clicks and mousewheel scrolling. > > ~Matt Indeed. Ctrl-[ is the same as Esc (Vim cannot discriminate between them), and you should avoid remapping that. Best regards, Tony. -- The correct way to punctuate a sentence that starts: "Of course it is none of my business, but --" is to place a period after the word "but." Don't use excessive force in supplying such a moron with a period. Cutting his throat is only a momentary pleasure and is bound to get you talked about. -- Lazarus Long, "Time Enough for Love" -- You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php