From 46dccf06e4723ea8dbe3a71e213367647ae549f1 Mon Sep 17 00:00:00 2001 From: Thomas Buckley-Houston Date: Tue, 16 May 2017 13:16:57 +0700 Subject: Use `behave mswin`, improves selection behaviour Also updated README --- plugin/novim-mode.vim | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) (limited to 'plugin/novim-mode.vim') diff --git a/plugin/novim-mode.vim b/plugin/novim-mode.vim index 000d0cb..86536b1 100644 --- a/plugin/novim-mode.vim +++ b/plugin/novim-mode.vim @@ -15,23 +15,31 @@ augroup start_insertmode autocmd BufEnter * call InsertMode() augroup END +" Mostly changes the way selection works. +" See: http://vimdoc.sourceforge.net/htmldoc/gui.html#:behave +" An extract from the docs about the difference between `behave mswin` +" and `behave xterm`: +" mswin xterm +" 'selectmode' 'mouse,key' '' +" 'mousemodel' 'popup' 'extend' +" 'keymodel' 'startsel,stopsel' '' +" 'selection' 'exclusive' 'inclusive' +behave mswin + " Copy and paste stuff -" TODO: -" * Doesn't work when cursor is on the first col -" * Support SHIFT+ARROW in visual mode -inoremap v -inoremap v -inoremap v -inoremap v -inoremap pi -vnoremap yi -vnoremap di +inoremap p +vnoremap y +vnoremap x + +" CTRL-A for selecting all text +inoremap gggHG +cnoremap gggHG +vnoremap gggHG " Indenting -" The `gv` returns you to the exact same selection, so you can repeat the -" command -vnoremap >gv -vnoremap <gv +" TODO: TAB doesn't work in mswin selection mode, but SHIFT+TAB does?? +vnoremap > +vnoremap < " CTRL+q to exit pane/app inoremap :q @@ -40,13 +48,18 @@ nnoremap :q " Find inoremap / +" Find next inoremap n +" Find previous +inoremap N " Clears highlighting. NB. Overriding ESC makes it very hard to get into " NORMAL mode. -inoremap :noh +inoremap :noh " Undo/redo " Doesn't use Ctrl+Z because that's already a significant *nix shortcut +" Unfortunately Vim can't use uppercase (shifted) key combos, otherwise +" we'd use CTRL+SHIFT+U here. inoremap u inoremap @@ -71,6 +84,7 @@ inoremap ^ au BufNewFile,BufRead *.txt,*.md,*.markdown setlocal linebreak spell " 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 " lines. au BufNewFile,BufRead *.txt,*.md,*.markdown inoremap gk -- cgit v1.2.3-70-g09d2