≡ Menu

Vim Tutorial and HowTos

Vim is a text editor. It was created as an extended version of the vi editor, with many additional features designed to be helpful in editing program source code ( rss/feed ) .

Ubuntu Linux: Install vim Text Editor

I recently switched from OS X to Ubuntu. When I run the 'vim file.c' command at terminal, I see an error message that read as follows:

The program 'vim' can be found in the following packages:
* vim
* vim-gnome

* vim-tiny
* vim-athena
* vim-gtk
* vim-nox
Try: apt-get install <selected package>

How do I fix this problem and why vim is not a default text editor on Ubuntu Linux? How can I install full-fledged vim text editor in Ubuntu Linux?
[click to continue…]

Vi / Vim: Wipe and Undo All Changes Since Opening a File

I am a new vi / vim text editor user and I know how to quit without saving changes. What if I want to wipe out all of the edits I have made in a session and get back to the original file? How do I wipe all changes since opening a file?
[click to continue…]

VIM: Jump Back To Previous or Last Cursor Position

Writing shell scripts in vim I usually go search for functions or something. Copy lines and then go back to where I was and modify the code. However, I need to manually navigate way back to the previous / last position. How can I automatically go back to where I was when I started my search operation under vim?
[click to continue…]

Vi / Vim: Save And Quit The Editor Command

I am a new vi (vim) text editor user. How do I quit the vi editor and save my changes under Linux or Unix like operating systems?
[click to continue…]

Vi / Vim: Quit Without Saving Command

I am a new vi / vim text editor user. How can I quit the vi / vim text editor without saving my changes to a file under Linux / Unix like operating systems?
[click to continue…]

HowTo: Exit Vim Text Editor Command

I am a new Linux/Unix user. How do I exit the VIM / vi editor on Linux/Unix-like operating systems?
[click to continue…]

I am login to a remote server using a ssh client. I am annoyed with the arrow key behavior during insert mode in Vim. As soon as I hit arrow keys, vim display A B C D on screen. How do I fix this problem under Linux, FreeBSD, OpenBSD, NetBSD, Apple OS X or Unix-like operating systems? How can I fix arrow keys that display A B C D on remote shell?
[click to continue…]

Linux / Unix vi / vim: Open and Switch Between Multiple Files

I am new to Linux sysadmin work. I am using vi / vim text editor to edit files located in /etc/ directory. I open files using

vi /etc/resolv.conf /etc/hosts

I can edit the /etc/resolv.conf file only. How do I switch between the two open files while using vim text editor under Linux / BSD / Apple OS X / Unix like operating systems?
[click to continue…]

Vi / VIM: Find And Replace All Text Substitute Command

I am a new Linux user. I started to use vim or vi text editor. How do I find all occurrence of the word called 'eth0' and replace it with 'br0' on Linux operating systems?
[click to continue…]

VI / VIM: Open File And Go To Specific Function or Line Number

How do I open a text file using VIM or VI and go to specific line? How do I open a file using vim and go to specific function() in my source code?
[click to continue…]