In TextMate when you are editing a line of text and you press command + enter it inserts a newline and brings the cursor to that new line without bringing down any text from the previous line. Is there a way to create this feature in Vim? Any insight would be much appreciated. Thanks!
In TextMate when you are editing a line of text and you press command
Share
The following mapping works:
The
Dmaps the command key on Mac. The answer by CatPlusPlus shows how this would work when using the Control key instead.Note that mapping the command key only works in MacVim.
So in order to make this fail proof inside your vimrc do the following:
Check if a gui vim is running via:
Check if you are running on a Mac via:
Now adjust your mapping accordingly: