How to Use VIM Editor with Speed & Knowing ?

Hi!

These stuff were pretty elementary & actually got to know these in early season at campus. But, it's important & I use to use these almost everyday in programming in linux environment & that's why I thought to note down something about this.

Alright, among many of the text editors that can be used in linux environment vim-editor is one of the most commonly used applications.

That's mainly due to it's simplicity. It's usable with Terminal itself & consists of very limited amount of commands (comparing to emacs), which makes it easier to use even to a newbie.

Then, let's get to know VIM-Editor.

1. Check whether you've got VIM-Editor installed.



You'll see your terminal showing something like follows.


if you won't, then, you've got to install VIM-Editor in order to proceed. If you're a complete newbie here's a tip to get vim.

Go to Ubuntu Software Center & Search : GVim. Download & install it.

 You've got it for sure by now. Alright then, let's proceed.


2. Take out the terminal & go to Desktop. (Type: Cd Desktop) Then, type: vi [Your File Name].







3. Good, now you're in VIM Mode & you can't type anything write away. So, in order to go to typing mode : press 'i' in your keyboard. Then, you'll be seeing something like '-- INSERT--' at the bottom edge of your VIM editor which means that now you can type.




 4. Type anything & after you finish type keep in mind to press Esc to exit Typing Mode & come to Command Mode.

5.  Then, try following tips to fix/edit what you've already typed.

  • 'o' - (Letter O) Get an empty line. Bring your cursor to the end of a line & type 'o'. A new line will be opened.


  • 'dd'- (Letter d twice) Delete a line. Bring cursor to the beginning of a line & type 'dd'.


  • 'p' - Right after delete. Bring cursor to a new location & type 'p'. deleted line will be appearing at the new location.


  • 'cw' - Pick a word and a letter closer to the beginning of the word & bring cursor on it & type 'cw'. The rest of the word beginning from the letter you picked will be deleted. Now, you can replace it with something else.


  • Ex: 'Element' - pick lettter 'l' . It'll be 'E' after command 'cw'


  • 'r' - Take your cursor on a letter and type 'r' and then type a letter that you need to replace the previous with.


Enjoy VIM-Editor !

No comments: