How can I make shift+spacebar page up in Vim?
Solution 1:
You cannot. CMS's solution will work for gVim, but not in vim because terminals cannot distinguish between <Space> and <S-Space> because curses sees them the same. It might be possible in the future if vim gains libtermkey support and your terminal supports the proper <CSI> sequences (xterm does if properly configured; nothing else does yet).
Solution 2:
If you are using vim inside iTerm2 you can map shift-space to ctrl+U by sending the hex key 15. Here's a screen shot:
To look up a hex code for a ctrl+letter combination, for example ctrl+u, you can do the following:
- In vim enter the insert mode
- Hit ctrl+v then ctrl+u then ctrl+c then ga
- various numerical representations will print at the bottom
You can apply this idea to other terminal emulators that support key mapping.
Solution 3:
Use this:
map <Space> ^D " Pagedown when press Space
map <S-Space> ^U " Page Up when press Shift Space
To get the ^D and ^U symbol correctly just press Control-V Control-D, and Control-V Control-U
Solution 4:
For OSX:
nnoremap <Space> <C-d>
nnoremap <S-Space> <C-u>