Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

VIM: How to move cursor in empty lines?

I’ve been through a lot of instructions, but I can’t find a solution to this problem. Giving this code in vim as an example:

#include <iostream>

 <--- My cursor is here

int main(){
std::cout << "Hello world";
return 0;
}

My cursor is stuck in the position above (I can’t press h or k). So I want to be able to press h and k (moving my cursor forward and backward in an empty line), what could I do to allow this?

Thank you so much for reading all this.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Perhaps you want:

:set virtualedit=all

Read the documentation for details on the other options available:

:help virtualedit

From the docs: "Virtual editing means that the cursor can be positioned where there is no actual character."

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading