Using the VIM editor for Linux.

Posted: February 2, 2012. At: 4:26 PM. This was 6 years ago. Post ID: 2607
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

Using the VIM editor for Linux is a good way to edit configuration files and write programming code. if the VIM editor is not installed on your system then type sudo apt-get install vim. To type text once you have entered the editor, press the i key to enter editing mode. To delete a line of text then press the d key in command mode. This is reached by pressing Esc to exit editing mode. in the command mode, you may type :w to save the current file, :q! to exit without saving and :wq to exit and save your current file. If you type :w myfile2.txt then the file currently being edited will be saved as a copy of the current buffer with that filename. In case you are editing a source file like a C++ source file and you need to edit line 1467, just type vim myfile.cpp +1467 and the editor will open at the selected line. To open the file with the cursor on the line of paragraph that contains a certain string of text then type this at the bash prompt: vim myfile.txt +/foo and the file will be opened at the first occurrence of the text string “foo”. For a C source file, you can type vim myfile.cpp +/main and the file will be opened at the first occurrence of main().

The GUI gvim application is another good way to use the VIM editor, but having a familiarity with the text based version of the editor will help you in the long term if you ever need to edit a file and you only have the command line instead of a GUI. Especially if you are installing Gentoo. Although that can be done in Ubuntu with a chroot anyway. Using Gparted to partition and format the partitions, then unpacking the stage3 and portage tarballs, but installing that takes far too long. Especially compiling Openoffice and Chromium. I have done that twice in the past, but no more. Ubuntu can do everything you want to do with a Linux box and it is far more stable and secure than Windows. That is why we use Linux after all, due to the greater security and stability, you do not need to install a virus scanner or Internet Security package like Norton 360 or Spybot search and destroy. Norton 360 only slows down your computer and it is better to install a more secure operating system than to put up with the virus prone load of crap that is Windows. Especially Windows `98 that was a disaster of malware. Windows 7 is more stable and secure, but it is still Windows. Proprietary software is not as secure and reliable as UNIX and Linux software. Linux can crash if it runs out of memory, but if you have a large amount of RAM you would not be worried about that.

The ee editor for UNIX is another good text editor. I use it on FreeBSD if I want to edit something as the vanilla VI editor is very hard to use, VIM is much better.

3 responses to “Using the VIM editor for Linux.

This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! Keep up the good work.

I will take a look at that and fix it. I would appreciate it if you could point me to some examples, then I could fix them. I have been fixing up some of my old posts and I will happily improve any posts if I have missed any spelling errors in the past.

Thanks a lot for your comment though, I appreciate the feedback. I hope to see you back again soon.

Hi ,Thanks for the tips I’ll check them out (along with the Unix books I’ve got in the loft from my Uni’ days). Thanks for the feedback too I’m glad you find the stuff that I write here useful.Cheers, Mark.

Leave a Reply