diff options
author | Thomas Buckley-Houston | 2017-05-15 03:46:03 +0000 |
---|---|---|
committer | Thomas Buckley-Houston | 2017-05-15 03:46:03 +0000 |
commit | 55c98eaa013c5f319fa11dfc44eab86e25de0872 (patch) | |
tree | d6055dd4ee9e081bbec67d502e0c9e2a5169c930 |
Initial commit. Basic plugin and start of docs
-rw-r--r-- | README.md | 11 | ||||
-rw-r--r-- | doc/novim-mode.txt | 12 | ||||
-rw-r--r-- | plugin/novim-mode.vim | 64 |
3 files changed, 87 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..f08ae7f --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# No-vim mode + +Try to make vim keybindings work like a 'normal' editor. + +WIP + +## Installation + +Eg; + +`Plug 'tombh/novim-mode'` diff --git a/doc/novim-mode.txt b/doc/novim-mode.txt new file mode 100644 index 0000000..ffff024 --- /dev/null +++ b/doc/novim-mode.txt @@ -0,0 +1,12 @@ +novim-mode.txt + +============================================================================== +CONTENTS |novim-contents| + + Introduction ....................................... |novim-introduction| + +============================================================================== +Introduction *novim* *novim-introduction* + +Novim-mode provides defaults to Insert Mode whenever appropriate and provides +a set of keybindings to make Vim behave more like a 'normal' editor. diff --git a/plugin/novim-mode.vim b/plugin/novim-mode.vim new file mode 100644 index 0000000..ef72015 --- /dev/null +++ b/plugin/novim-mode.vim @@ -0,0 +1,64 @@ +" Make sure insert mode is the default mode when opening/switching to files +augroup start_insertmode + autocmd! + autocmd BufEnter * if &modifiable | startinsert | endif +augroup END + +" 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 + +" 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 + +" CTRL+q to exit pane/app +inoremap <C-Q> <C-O>:q<CR> + +" Find +inoremap <C-F> <C-O>/ +inoremap <F3> <C-O>n +" Clears highlighting. NB. Overriding ESC makes it very hard to get into +" NORMAL mode. +inoremap <Esc> <C-O>:noh<CR> + +" Undo/redo +inoremap <silent> <C-U> <C-O>u +inoremap <silent> <C-R> <C-O><C-R> + +" CTRL+s saves +inoremap <silent> <C-S> <C-O>:update<CR> + +" CTRL+k deletes the current line +inoremap <silent> <C-K> <C-O>"_dd + +" CTRL+d duplicates current line +" TODO: don't put it vim's clipboard, so CTRL+V works as expected +inoremap <silent> <C-D> <C-O>yy<C-O>p + +" Alt+/- moves the current line up and down +inoremap <silent> <M--> <C-O>:m -2<CR> +inoremap <silent> <M-=> <C-O>:m +1<CR> + +" Home goes back to the first non-whitespace character of the line +inoremap <silent> <Home> <C-O>^ + +" Allow text to wrap in text files +au BufNewFile,BufRead *.txt,*.md,*.markdown setlocal linebreak spell +" Make arrow keys move through wrapped lines +" TODO: +" * Scroll 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 +au BufNewFile,BufRead *.txt,*.md,*.markdown inoremap <buffer> <Down> <C-O>gj + |