From d64b2c002a51e99bafb54c6cc0dfe59f8de958dc Mon Sep 17 00:00:00 2001 From: Thomas Buckley-Houston Date: Fri, 16 Jun 2017 03:42:52 +0700 Subject: Better movement through wrapped text --- autoload/novim_mode.vim | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'autoload') 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 ^ + " 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 g^ + " Native End would work anyway but it needs the `g` for wrapped lines + inoremap g$ + + " For selection behaviour + inoremap g^ + snoremap g^ + inoremap g$ + snoremap g$ " Tweaks PageUp behaviour to get cursor to first line on top page inoremap :call novim_mode#PageUp() @@ -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 gk au BufNewFile,BufRead *.txt,*.md,*.markdown inoremap gj + " For selection behaviour + au BufNewFile,BufRead *.txt,*.md,*.markdown snoremap gk + au BufNewFile,BufRead *.txt,*.md,*.markdown snoremap gj endfunction " Try to intuitively and intelligently close things like buffers, splits, -- cgit v1.2.3-70-g09d2