DEV Community

Discussion on: April 9th, 2021: What did you learn this week?

Collapse
 
vonheikemen profile image
Heiker • Edited

vim has an easy mode. You enable it by using -y flag, like this vim -y. Is kinda cool, it makes it behave like a regular "click-and-type" text editor. In this mode regular shortcuts work as expected, ctrl + s for save, ctrl + c for copy, ctrl + v paste, ctrl + z to undo, ctrl + y redo.

The downside (and the reason nobody makes a big deal about it) is that is was designed to be used inside a GUI, so no shortcut to quit. You need to close whatever graphical interface vim is in.

Not all is lost, I think it provides a nice base to use vim for quick edits. For the people who will never use vim on purpose, I will recommend creating a .vimrc on their home folder with this content.

" Enable 'easy mode'
source $VIMRUNTIME/evim.vim

"  Ctrl + q to Quit vim
inoremap <c-q> <c-o>:q<cr>
Enter fullscreen mode Exit fullscreen mode

This will create a ctrl + q shortcut to quit. You could also replace (or add) <Esc> as a shortcut to quit.

This way even if you enter vim by accident it will behave somewhat like a "normal" text editor.

Collapse
 
nickytonline profile image
Nick Taylor

Awesome!

Hackerman from Kung Fury putting on a Nintendo Power glove