DEV Community

Discussion on: Vim Is The Perfect IDE

Collapse
 
ewengoisot profile image
ewen-goisot

(BTW, I definitely should edit my coms HERE with Vim, I've lost all I wrote)
.
Yes, you cane, add 5 lines to your .vimrc

inoremap <c-u> <Esc>a<c-u>
inoremap <c-w> <Esc>a<c-w>
inoremap <space> <Esc>a<space>
inoremap <c-z> <c-o>2u
inoremap <c-y> <c-o>2<c-r>

That means:
🔷 It works for new words <space>, delete word <c-w>, means Ctrl-W, delete line <c-u>.
🔷 When you press, let's say <space>, it first sends a break (<Esc>a exit and goes to insert mode), then truly add a space.
🔷 When you press <c-z> (map it to whatever you want), it goes to normal mode for only one command <c-o>, then does an undo (actually, two) 2u and that's all.
🔷 When you press <c-y>, it's like <c-z> but for "redo" 2<c-r> instead.
🔷 You can add breaks for other things, including every ASCII char if you want.
🔶 Maybe the status bar will "blink" a bit when there is a break.
🔶 Alternative: <c-g>u instead of <Esc>a avoids blinks but the "redo" will not work as expected.