On 02/05/10 22:35, Peng Yu wrote:


On May 2, 12:52 pm, Tony Mechelynck<[email protected]>
wrote:
On 02/05/10 01:49, Peng Yu wrote:





On May 1, 6:13 pm, Tim Chase<[email protected]>    wrote:
On 05/01/2010 05:59 PM, Peng Yu wrote:

:new by default open a window above the current window. Is there a
command to open a new window below the current one?

You can use

     :below new

which you can read about at

     :help :below

If you want it to always split below, you can investigate the
'splitbelow' option

     :help 'splitbelow'

which you can set in your vimrc so that new/split windows are
created below the current one instead of above it.  However, it's
easy enough to override with the ":bel" command.

"open file under cursor
map<C-O>    :exe "below new ".expand("<cfile>")<CR>
map<C-S-O>    :exe "new ".expand("<cfile>")<CR>

I put the above comand in ~/.vimrc. I expect that ctrl+shift+o open a
new window above the current one and ctrl+o open a new window below
the current one. However, both of them open a new window above the
current one. Would you please let me know how to fix the first command?

Ctrl-O and Ctrl-Shift-O are both 0x0F; if you map them to different
{rhs}es, the last one wins. Also, this hides the standard meaning of
Ctrl-O, namely, "go to older place in jumplist". Try mapping them to,
let's say, F8 and Shift-F8 instead.

Why Ctrl-O and Ctrl-Shift-O can not be distinguished?

Because that's how ASCII defined the control characters long ago. Basically, 0x00 to 0x1F correspond to Ctrl together with 0x40 to 0x5F respectively, but it was decided that it was unnecessary to hold Shift when hitting Ctrl with a letter.


I can not use F8 as my vncviewer use it for a special meaning. What
about F7? Does it have any designated usage?

In Vim, only F1 has a special usage (Help). If you haven't yet remapped F7 or Shift-F7, and if your window manager doesn't preempt them, you're free to use them.


In general, how to figure out if a combination of keys are used or not
and whether they are combinations that can be understand by vim?

For a particular key combo in a particular mode, use the help. For instance ":help CTRL-O" for Ctrl-O in Normal mode, ":help i_CTRL-V" (and ":help i_CTRL-V_digit") for Ctrl-V in Insert mode, ":help c_CTRL-R" for Ctrl-R in Command-line mode, etc.

To find an unused key, your best chance is the Fn keys, but you may also look at the index.txt helpfile (by using :help index.txt) which has a summary of all key bindings used by Vim.

To know if a key has been mapped and where, use (e.g. for F7)

        :verbose map <F7>
        :verbose map! <F7>

The command without the exclamation mark gives the mappings for Normal, Visual, Select and Operator-pending modes, with the exclamation mark those for Insert/Replace and Command-line modes. See ":help map-listing" and ":help :map-verbose" for details.

To know if a given key is understood by Vim you can either use it in Insert mode, prefixed with Ctrl-V or (for a special key) CTRL-K, to see if something is inserted in your buffer, or else, after checking that it isn't mapped yet, define a mapping for it, for example

        :map <S-C-F4> :echo 'Hello! You just hit Shift-Control-F4!'<CR>

then see if that mapping works.


Best regards,
Tony.
--
It's not an optical illusion, it just looks like one.
                -- Phil White

--
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

Reply via email to