undo points for word and line deletion

This commit is contained in:
Reed Esau
2014-02-14 03:35:06 -07:00
parent 2596239120
commit 0ea2b4c9f9
2 changed files with 12 additions and 7 deletions

View File

@@ -19,7 +19,7 @@ smooth the path to writing prose.
* Agnostic on soft line wrap _versus_ hard line breaks, supporting both
* Auto-detects wrap mode via modeline and sampling
* Adjusts navigation key mappings to suit the wrap mode
* Creates undo points on common punctuation
* Creates undo points on common punctuation, line and word deletion
* When using hard line breaks, enables autoformat while inserting text
* Buffer-scoped configuration (with a few minor exceptions, _pencil_
preserves your global settings)

View File

@@ -215,19 +215,24 @@ function! pencil#init(...) abort
silent! unmap <buffer> <Down>
endif
" set undo points around common punctuation
" set undo points around common punctuation,
" line <c-u> and word <c-w> deletions
if b:wrap_mode
inoremap <buffer> . .<C-g>u
inoremap <buffer> ! !<C-g>u
inoremap <buffer> ? ?<C-g>u
inoremap <buffer> , ,<C-g>u
inoremap <buffer> ; ;<C-g>u
inoremap <buffer> . .<c-g>u
inoremap <buffer> ! !<c-g>u
inoremap <buffer> ? ?<c-g>u
inoremap <buffer> , ,<c-g>u
inoremap <buffer> ; ;<c-g>u
inoremap <buffer> <c-u> <c-g>u<c-u>
inoremap <buffer> <c-w> <c-g>u<c-w>
else
silent! iunmap <buffer> .
silent! iunmap <buffer> !
silent! iunmap <buffer> ?
silent! iunmap <buffer> ,
silent! iunmap <buffer> ;
silent! iunmap <buffer> <c-u>
silent! iunmap <buffer> <c-w>
endif
endfunction