aboutsummaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorThomas Buckley-Houston2017-06-15 20:42:52 +0000
committerThomas Buckley-Houston2017-06-15 20:42:52 +0000
commitd64b2c002a51e99bafb54c6cc0dfe59f8de958dc (patch)
treed4376cb6afe2c851e1fa4f53b0334c4fa755370f /autoload
parentba2917cb2233ede57532c1c67b57652c867cf922 (diff)
Better movement through wrapped text
Diffstat (limited to 'autoload')
-rw-r--r--autoload/novim_mode.vim20
1 files changed, 16 insertions, 4 deletions
diff --git a/autoload/novim_mode.vim b/autoload/novim_mode.vim
index af5c76a..549210e 100644
--- a/autoload/novim_mode.vim
+++ b/autoload/novim_mode.vim
@@ -101,8 +101,18 @@ function! g:SetNoVimModeShortcuts()
" General fixes to editor behaviour
if g:novim_mode_use_editor_fixes == 1
- " Fix HOME to go back to the first non-whitespace character of the line
- inoremap <silent> <Home> <C-O>^
+ " All thee `g`s here make these also work for wrapped lines.
+
+ " Fix HOME to go back to the first non-whitespace character of the line.
+ inoremap <silent> <Home> <C-O>g^
+ " Native End would work anyway but it needs the `g` for wrapped lines
+ inoremap <silent> <End> <C-O>g$
+
+ " For selection behaviour
+ inoremap <silent> <S-Home> <S-Left><C-G><C-O>g^
+ snoremap <silent> <S-Home> <C-O>g^
+ inoremap <silent> <S-End> <S-Right><C-G><C-O>g$
+ snoremap <silent> <S-End> <C-O>g$
" Tweaks PageUp behaviour to get cursor to first line on top page
inoremap <silent> <PageUp> <C-O>:call novim_mode#PageUp()<CR>
@@ -224,11 +234,13 @@ function! s:SetWrappedTextNavigation()
" Make arrow keys move through wrapped lines
" TODO:
- " * Make END key move to end of current wrapped piece of line.
- " * Scroll window 1 wrapped soft line at a time rather an entire block of wrapped
+ " * Scroll window 1 wrapped soft line at a time rather than entire block of wrapped
" lines.
au BufNewFile,BufRead *.txt,*.md,*.markdown inoremap <buffer> <Up> <C-O>gk
au BufNewFile,BufRead *.txt,*.md,*.markdown inoremap <buffer> <Down> <C-O>gj
+ " For selection behaviour
+ au BufNewFile,BufRead *.txt,*.md,*.markdown snoremap <buffer> <S-Up> <C-O>gk
+ au BufNewFile,BufRead *.txt,*.md,*.markdown snoremap <buffer> <S-Down> <C-O>gj
endfunction
" Try to intuitively and intelligently close things like buffers, splits,