Raspberry Pi Setup · Lesson 5 of 17
Raspberry Pi OS Lite Wi-Fi Configuration (Advanced)
How to Edit a File in Vim
-
First, open a file by typing
vim filenamein your terminal. Replace "filename" with the name of your file. If the file does not exist,vimwill create a new one with the given name.vim my_file.txt -
Now, you’re in Vim’s default mode, which is Command mode. To start editing the file, you need to switch to Insert mode. You can do this by pressing the
ikey on your keyboard. - Once in Insert mode, type and following code which is used to setup the Wi-Fi via the command line.
-
When you’re done editing, you need to go back to Command mode. Press the
Esckey to return to this mode. -
In Command mode, you can save the file and quit Vim with the command
:wq(short for write and quit) and press Enter. This will save any changes and quit the editor.:wq - The file is now saved! Congrats, you’ve edited a file in Vim.