About Shift+Space

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

About Shift+Space

Wu Bingzheng

Hi men,

If I map Space to next-page:

 nmap <Space> <C-F>

it works fine. However if I map Space to prev-page:

 nmap <Space> <C-B>

it doesn't work.

If I press Ctrl+B, it works fine too.

Anybody knows the reason?

Thanks,
Wu
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: About Shift+Space

Maxim Kim

On 3 мар, 11:09, Wu Bingzheng <[hidden email]> wrote:
> Hi men,
>
>  nmap <Space> <C-B>
>
> it doesn't work.
It works for me.
Note: <C-B> doesn't move you cursor to the very top of buffer. If your
cursor is on 10th line <C-B> has no visible effect.

I use the follwing bindings instead:
nnoremap <Space> <C-D><C-D>
nnoremap <S-Space> <C-U><C-U>
vnoremap <Space> <C-D><C-D>
vnoremap <S-Space> <C-U><C-U>

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: About Shift+Space

Wu Bingzheng


>
> It works for me.
> Note: <C-B> doesn't move you cursor to the very top of buffer. If your
> cursor is on 10th line <C-B> has no visible effect.
>
> I use the follwing bindings instead:
> nnoremap <Space> <C-D><C-D>
> nnoremap <S-Space> <C-U><C-U>
> vnoremap <Space> <C-D><C-D>
> vnoremap <S-Space> <C-U><C-U>

In fact, if I press Ctrl+B, it works fine. But if I write the map in
vimrc, it doesn't work.

I tried this:
   nmap <Space> <C-U><C-U>
it works. However if I write like:
   nmap <Space> <C-D><C-D>
   nmap <S-Space> <C-U><C-U>
vim will pagedown, both when I press Space and Shift+Space.

It's really strange!

Thanks,
Wu

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: About Shift+Space

Albie Janse van Rensburg

Wu Bingzheng wrote:

> I tried this:
>    nmap <Space> <C-U><C-U>
> it works. However if I write like:
>    nmap <Space> <C-D><C-D>
>    nmap <S-Space> <C-U><C-U>
> vim will pagedown, both when I press Space and Shift+Space.
>
> It's really strange!
>
> Thanks,
> Wu
>  
What happens if you type Ctrl-v (Ctrl-q if you're using mswin.vim) and
then Shift-Space in command-line mode (pressing : ) or insert mode?

On my Vim, it prints :

    <S-Space>

This way I know I can use <S-Space> in mappings.  It's possible that,
due to some setting on your Vim or otherwise on your PC, Vim is not
receiving the Shift modifier.  If you  DON'T get the output as I did,
try launching Vim using

    vim -u NONE

and then try the command-line test as above again.  If you STILL get
nothing, there might be something up with your terminal or regional
settings.

There could possibly be an issue with your Vim compile as well, although
I don't know what that could be.

Hope that helps

--

[ Albie Janse van Rensburg ~ http://morph.telspace.co.za ]

In God we trust; all else we walk through.


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: About Shift+Space

Wu Bingzheng


> What happens if you type Ctrl-v (Ctrl-q if you're using mswin.vim) and
> then Shift-Space in command-line mode (pressing : ) or insert mode?
>
What's the function of Ctrl-v? According to your words, it seems like
to show
which key you press. Am I right?

However, i think Ctrl-v is VirtualBlock, as Vim User Manual says.

Thanks,
Wu

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: About Shift+Space

Gary Johnson-4

On 2009-03-03, Wu Bingzheng wrote:
> > What happens if you type Ctrl-v (Ctrl-q if you're using mswin.vim) and
> > then Shift-Space in command-line mode (pressing : ) or insert mode?
> >
> What's the function of Ctrl-v? According to your words, it seems like
> to show
> which key you press. Am I right?

In insert mode, yes.  Or rather, it allows you to insert a key press
literally, which vim then displays for you to see.  See

    :help i_CTRL-V

> However, i think Ctrl-v is VirtualBlock, as Vim User Manual says.

That would be the effect of typing Ctrl-V in normal mode, which as
you've already discovered, is explained here:

    :help CTRL-V

HTH,
Gary



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: About Shift+Space

Gary Johnson-4

On 2009-03-03, Gary Johnson wrote:

> On 2009-03-03, Wu Bingzheng wrote:
> > > What happens if you type Ctrl-v (Ctrl-q if you're using mswin.vim) and
> > > then Shift-Space in command-line mode (pressing : ) or insert mode?
> > >
> > What's the function of Ctrl-v? According to your words, it seems like
> > to show
> > which key you press. Am I right?
>
> In insert mode, yes.  Or rather, it allows you to insert a key press
> literally, which vim then displays for you to see.  See
>
>     :help i_CTRL-V

Sorry, I forgot the command-line part.  The effect of Ctrl-V in
command-line mode is explained here:

    :help c_CTRL-V

You can read about the different modes here:

    :help vim-modes

The meaning and usage of help prefixes such as i_ and c_ are
explained here:

    :help help-context

Regards,
Gary



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: About Shift+Space

Tony Mechelynck
In reply to this post by Maxim Kim

On 03/03/09 09:36, Maxim Kim wrote:

> On 3 мар, 11:09, Wu Bingzheng<[hidden email]>  wrote:
>> Hi men,
>>
>>   nmap<Space>  <C-B>
>>
>> it doesn't work.
> It works for me.
> Note:<C-B>  doesn't move you cursor to the very top of buffer. If your
> cursor is on 10th line<C-B>  has no visible effect.
>
> I use the follwing bindings instead:
> nnoremap<Space>  <C-D><C-D>
> nnoremap<S-Space>  <C-U><C-U>
> vnoremap<Space>  <C-D><C-D>
> vnoremap<S-Space>  <C-U><C-U>

Here, Ctrl-B (directly or by mapping <Space> to it) moves the cursor to
the ('scrolloff' + 1)th line. If I set 'scrolloff' to a high value
(9999) it still scrolls by a page. See also ":help 'window'".

Besst regards,
Tony.
--
    [The rest of the ARMY stand around looking at a loss.]
INSPECTOR END OF FILM: (picks up megaphone) All right!  Clear off!  Go on!
                  "Monty Python and the Holy Grail" PYTHON (MONTY)
PICTURES LTD

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: About Shift+Space

Maxim Kim

On 4 мар, 08:30, Tony Mechelynck <[hidden email]> wrote:
> Here, Ctrl-B (directly or by mapping <Space> to it) moves the cursor to
> the ('scrolloff' + 1)th line. If I set 'scrolloff' to a high value
> (9999) it still scrolls by a page. See also ":help 'window'".

As far as I can see <C-B> doesn't move the cursor -- it scrolls the
window. Cursor is moved as a side effect of this scrolling.
Thus I can't visually select every line with 20gg10<C-B> command for
example.
<C-U> on the other hand moves cursor up. Thus I can <C-U> to the line
number 1.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: About Shift+Space

Maxim Kim


> Thus I can't visually select every line with 20gg10<C-B> command for
> example.
edit:
Thus I can't visually select every line to the top of buffer with
continiously hitting <C-B> command for
example.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: About Shift+Space

Tony Mechelynck
In reply to this post by Wu Bingzheng

On 04/03/09 03:02, Wu Bingzheng wrote:

>
>> What happens if you type Ctrl-v (Ctrl-q if you're using mswin.vim) and
>> then Shift-Space in command-line mode (pressing : ) or insert mode?
>>
> What's the function of Ctrl-v? According to your words, it seems like
> to show
> which key you press. Am I right?
>
> However, i think Ctrl-v is VirtualBlock, as Vim User Manual says.
>
> Thanks,
> Wu

That's in Normal mode. In Insert/Replace and Command-line modes, Ctrl-V
is Literalize (see :h i_CTRL-V and :h i_CTRL-V_digit). In addition, in
the GUI if you follow it with a special key, the latter will be shown in
<> notation. A more general way to show special keys in <> notation is
to prefix them by Ctrl-K instead, but if you try Ctrl-K with a printing
key, Vim will usually wait for the second part of a |digraph|.

Best regards,
Tony.
--
Besides the device, the box should contain:

* Eight little rectangular snippets of paper that say "WARNING"

* A plastic packet containing four 5/17 inch pilfer grommets and two
   club-ended 6/93 inch boxcar prawns.

YOU WILL NEED TO SUPPLY: a matrix wrench and 60,000 feet of tram
cable.

IF ANYTHING IS DAMAGED OR MISSING: You IMMEDIATELY should turn to your
spouse and say: "Margaret, you know why this country can't make a car
that can get all the way through the drive-through at Burger King
without a major transmission overhaul?  Because nobody cares, that's
why."

WARNING: This is assuming your spouse's name is Margaret.
                -- Dave Barry, "Read This First!"

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: About Shift+Space

Wu Bingzheng
In reply to this post by Albie Janse van Rensburg


> What happens if you type Ctrl-v (Ctrl-q if you're using mswin.vim) and
> then Shift-Space in command-line mode (pressing : ) or insert mode?
>
> On my Vim, it prints :
>
>     <S-Space>
On my Vim, it just shows a 'space', when I press Space of Shift-Space,
(I think I did the right operation becaust it prints ^M when i press
Enter.)
even if I lauch Vim as 'vim -u NONE'.

It seems be trouble and I don't want to look in the reason anymore.

Thanks,
Wu

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---