mirror of
https://github.com/preservim/vim-pencil.git
synced 2025-11-12 11:53:47 -05:00
undo points for word and line deletion
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user