diff options
author | Thomas Buckley-Houston | 2017-05-16 06:16:57 +0000 |
---|---|---|
committer | Thomas Buckley-Houston | 2017-05-16 06:21:50 +0000 |
commit | 46dccf06e4723ea8dbe3a71e213367647ae549f1 (patch) | |
tree | f3ce7df96608a4392f44eddaee80583f708dfcd4 | |
parent | 1b3cb450e1c537fea662080af9ece1c43058ac94 (diff) |
Use `behave mswin`, improves selection behaviour
Also updated README
-rw-r--r-- | README.md | 35 | ||||
-rw-r--r-- | plugin/novim-mode.vim | 44 |
2 files changed, 60 insertions, 19 deletions
@@ -1,11 +1,38 @@ -# No-vim mode +# No vim keybindings mode -Try to make vim keybindings work like a 'normal' editor. +_Work In Progress_ -WIP +Some, indeed many, may say this is counter-productive or even sacrilegious. But Vim is a lot more than just a keybinding paradigm; firstly it has one of the richest plugin ecosystems of any editor, but also it is a --if not *the* most-- ubiquitous text editor and has been battle tested for over 25 years. There are more reasons to use it than merely its famous shortcut vocabulary. This plugin is an attempt to expose everything else about Vim without the overhead of learning to use Normal mode The Right Way. + +Vim itself already has support for something similar in its optional [`mswin.vim`](https://github.com/vim/vim/blob/master/runtime/mswin.vim) config file. However it still assumes the relevance of Normal mode and `SHIFT+INSERT` combinations. Whereas this plugin attempts to avoid Normal mode unless absolutely necessary, say for interacting with the NERDTree buffer. ## Installation -Eg; +Use your favourite plugin manager, eg, for vim-plug; `Plug 'tombh/novim-mode'` + +## Usage + +Most keybindings should work as you might expect from, say Atom or Sublime Text; `CTRL+S` to save, etc. However there are some differences; + * `CTRL+Z` does not undo, as that is already a well-established *nix shortcut for backgrounding a program. + * CTRL/HOME/END/PAGEUP/PAGEDOWN keys don't work during selection mode. Though large areas of text can be quickly selected with the mouse. It may end up being easier to simulate selection mode with Vim's default Visual mode. + * There seems to be a bug where only `SHIFT+TAB` and not `TAB` works for indenting during selection mode. Again this may be fixed by simulating selection mode with Visual mode in the future. + +### Keybindings + + * `CTRL+S`: Saves the current file + * `SHIFT+ARROW`: Enter selection mode + * `CTRL+C`: Copy selection + * `CTRL+X`: Cut selection + * `CTRL+V`: Paste current selection + * `CTRL+A`: Select all + * `TAB`: Indent selected text [currently broken] + * `SHIFT+TAB`: Unindent selected text + * `CTRL+F`: Find text. `F3` and `SHIFT+F3` find next/previous + * `CTRL+U/R`: Undo/Redo + * `CTRL+K`: Delete current line + * `CTRL+D`: Duplicate current line + * `ALT+UP/DOWN`: Move current line up/down + * `CTRL+Q`: Exit window/tab/split/quickfix/etc + 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 |