DEV Community

dwarfŧ
dwarfŧ

Posted on

1

neovim: the basics

Image description

introduction
welcome to neovim! It is a super-set of vim and makes a handy editor for any project. I use neovim because of the fact my operating system is linux. This means most of the code i run is in a terminal and neovim is perfect for that!

entering
first of all we need to enter the editor. We can enter vim with: vim and neovim: nvim. you will be greeted with this lovely text editor:

Image description

insert mode
once you have entered the editor typing will not do anything. You can type by pressing the key i. To leave insert mode (so you can run commands) press esc.

exiting
then once we've typed code we need to exit the editor. We can do this by doing: :q however this will only work if you have not typed anything. To leave neovim without saving do: :q!. To save and exit vim you can do: :wq and you can save it without exiting by doing: :w

running code directly inside of vim
here i have some code written in neovim:

Image description

and i can run it without leaving neovim. What allows me to do this is the fact by doing :! you can run bash code inside neovim. this means to run my c++ code i can just do: :! g++ main.cpp and run it with: :! ./a.out You can do this with any programming language as long as you have it installed on your computer.

goodbye
enjoy your knowledge and have a good day

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay