cnoremap <C-P> <Up>
cnoremap <C-N> <Down>
+if has('eval')
+" Don't move the cursor to the first column for certain scroll commands (<C-F,
+" <C-B>, <C-D>, <C-U>). Thanks to jamessan in #vim on Freenode (2011-08-31
+" 02:27 CEST) for the 'nostartofline' tip. But I can't use 'nostartofline'
+" directly because it also enables that feature for other commands which I
+" don't want.
+
+ " Set 'nostartofline' for a single movement.
+ function! s:TemporaryNostartofline(movement)
+ let l:startofline = &startofline
+ set nostartofline
+ execute 'normal! ' . a:movement
+ let &startofline = l:startofline
+ endfunction
+
+ " Thanks to fow in #vim on Freenode (2012-02-16 15:38 CET) for the idea to
+ " use "<Bslash><Lt>"; Vim documentation reference: :help <>.
+ nnoremap <silent> <C-F>
+ \ :call <SID>TemporaryNostartofline("<Bslash><Lt>C-F>")<CR>
+ nnoremap <silent> <C-B>
+ \ :call <SID>TemporaryNostartofline("<Bslash><Lt>C-B>")<CR>
+ nnoremap <silent> <C-D>
+ \ :call <SID>TemporaryNostartofline("<Bslash><Lt>C-D>")<CR>
+ nnoremap <silent> <C-U>
+ \ :call <SID>TemporaryNostartofline("<Bslash><Lt>C-U>")<CR>
+endif
+
" Write before suspending, thanks to deryni in #vim on Freenode (2011-05-09
" 20:02 CEST). To suspend without saving either unmap this or use :stop<CR>.
nnoremap <silent> <C-Z> :update<CR>:stop<CR>
" in #vim on Freenode (2011-08-15 00:17 CEST).
nnoremap <C-G> 2<C-G>
-" Use <Space> to move down a page and - to move up one like in mutt.
-nnoremap <Space> <C-F>
-nnoremap - <C-B>
+" Use <Space> to move down a page and - to move up one like in mutt. Don't use
+" nnoremap so the <C-F>/<C-B> 'nostartofline' fix (see above) works.
+nmap <Space> <C-F>
+nmap - <C-B>
" Go to next and previous buffer. Thanks to elik in #vim on Freenode
" (2010-05-16 18:38 CEST) for this idea.