Vim Text Editor¶
GUI-based and Terminal-based Editors¶
The fundamental tool of every programmer is there text editor. While there many options for text editors, they generally fall into two categories: terminal-based and GUI-based.
As the name implies, GUI-based text editors open up their own graphical user interface for you two write in. It is likely you have all worked with a GUI-based text editor such as Notepad, Notepad++, Visual Studio, Eclipse, MATLAB’s editor, gedit, or Sublime Text (my personal favorite)
Terminal-based editors run directly in a command terminal and do not open up a separate window/interface. These can be a bit more tedious to work with at first. For example, you often can’t use your mouse to move your cursor to different part of a file. It can even be hard to figure our how to exit a terminal-based text editor once it’s started!!
In spite of these initial difficulties, terminal-based text editors are very important for robotics and embedded programming. When modifying code on another “remote” computer or onboard your drone, you often can’t open a graphical interface. This means you must use a terminal-based editor.
While there are many great terminal-based text editors (and very strong opinions on which to use), this tutorial introduces Vim.
The nice thing about Vim is that it comes with a ready-made tutorial! Simply open a terminal
Ctrl+Alt+T and enter command:
…and away you go!
Everyone’s first reaction and complaint about Vim is: “HOW DO I EXIT OUT OF THIS THING!!!”. To exit, use the following sequence:
If it complains about unsaved work, either use
:wq to save (write) or
:q! to discard unsaved work