Monday, August 23, 2010

Re: map "if there are more than one tabpage" then :tabnext else w

Hi Tony!

On Mo, 23 Aug 2010, Tony Mechelynck wrote:

> Oh, but you can — unless the Ctrl-Tab event doesn't reach Vim, or
> reaches it as a plain 0x09.
>
> My gvim can see whether or not Esc, Tab, Enter or Space has been hit
> with or without Ctrl and/or Shift: try it, in Insert mode in gvim, by
> hitting Ctrl-K followed by Shift-Space, Ctrl-Tab, Shift-Ctrl-Esc, etc.
> You'll see the correct <> code inserted in your buffer, even though
> Shift-Space normally inserts a space, Esc is Ctrl-[, Tab is Ctrl-I,
> Enter is Ctrl-M. I think I've seen a bug fix about that recently (well,
> before the 7.3 release obviously) but I can't find it back.

Oh it can? But that is only gvim, right? I use console vim on Unix
exclusively and the console version does not seem to distinguish between
those two keys.

> if has('windows')
> noremap <expr> <C-Tab> <SID>Tab(1)
> noremap <expr> <C-S-Tab> <SID>Tab(0)
> function s:Tab(fwd)
> if tabpagenr('$') > 1
> return a:fwd? "\<C-PageDown>" : "\<C-PageUp>"
> else
> return "\<C-W>" . (a:fwd? "w" : "W")
> endif
> endfunction
> endif

That's why I think there is a has('gui_running') missing.

regards,
Christian

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: