aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugin')
-rw-r--r--plugin/novim-mode.vim44
1 files changed, 29 insertions, 15 deletions
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 <S-Left> <Esc><Right>v<Left>
-inoremap <S-Right> <Esc><Right>v<Right>
-inoremap <S-Up> <Esc><Right>v<Up>
-inoremap <S-Down> <Esc><Right>v<Down>
-inoremap <C-V> <Esc>pi<Right>
-vnoremap <C-C> y<Esc>i
-vnoremap <C-X> d<Esc>i
+inoremap <C-V> <C-O>p
+vnoremap <C-C> y
+vnoremap <C-X> x
+
+" CTRL-A for selecting all text
+inoremap <C-A> <C-O>gg<C-O>gH<C-O>G
+cnoremap <C-A> <C-C>gggH<C-O>G
+vnoremap <C-A> <C-C>gggH<C-O>G
" Indenting
-" The `gv` returns you to the exact same selection, so you can repeat the
-" command
-vnoremap <Tab> ><Esc>gv
-vnoremap <S-Tab> <<Esc>gv
+" TODO: TAB doesn't work in mswin selection mode, but SHIFT+TAB does??
+vnoremap <Tab> >
+vnoremap <S-Tab> <
" CTRL+q to exit pane/app
inoremap <C-Q> <C-O>:q<CR>
@@ -40,13 +48,18 @@ nnoremap <C-Q> :q<CR>
" Find
inoremap <C-F> <C-O>/
+" Find next
inoremap <F3> <C-O>n
+" Find previous
+inoremap <S-F3> <C-O>N
" Clears highlighting. NB. Overriding ESC makes it very hard to get into
" NORMAL mode.
-inoremap <Esc> <C-O>:noh<CR>
+inoremap <silent> <Esc> <C-O>:noh<CR>
" 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 <silent> <C-U> <C-O>u
inoremap <silent> <C-R> <C-O><C-R>
@@ -71,6 +84,7 @@ inoremap <silent> <Home> <C-O>^
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 <buffer> <Up> <C-O>gk