Wednesday 14 January 2015

Getting Started with VIM

Vim is an awesome text editor, oh wait it's just much more than a text editor.
Before i begin this post doesn't not include commands and all but just an advice as to how to approach learning Vim.

VIM as such provides just bare minimum functionality and is not so cool, but again it's upto you to configure  Vim according to you and make it cool. Vim also supports tons of plugins that bring along a lot more functionality than just simple Vim.

What not do do...

One of the biggest mistake one can make while starting with Vim is to approach it just like other text editors like sublime, Gedit etc and it is because Vim is different is that is why it's awesome.

Vim is a modal editor which means it has different modes and a key may take special role according to the mode.

Also in Vim you simply do everything from Keyboard so say Goodbye to you mouse. Everything you do in vim is doable by not moving your fingers from the home row, yes exactly you don't even need arrow keys because moving is done using h,j,k,l keys and this is the main reason behind increase in productivity as you are not wasting time moving you hand back and forth between your mouse/arrow keys. 

How to begin ?


Vim stores the configuration in a file called .vimrc (also know as a dot file, literally because of the dot) present in your home directory. This simply text file dictates what will the behavior of Vim when launched.  Initially you should use somebody else's dot files and once you get your hands on and have fair bit experience you can start to tweak the configuration according to your needs.

Initially if you want you can use my vim setup: https://github.com/harsimrans/dotvim

Also initially you should not make Vim as your primary text editor because if you do so you'll hate Vim, like from the bottom of your heart. your productivity will drop not because vim is complicated but because you are just not used to it. So take out some free time and start playing around with Vim and probably after a few days you'll feel comfortable.

Browse through the Internet, there are tons of articles about basic Vim commands and go through a couple of them before you start using Vim.

REMEMBER invest some time in Vim , play with it and get comfortable with Vim. Then make Vim your primary editor. Believe me you will realize your productivity increase than before even if it's little.

Productivity after vim  = c * productivity before vim, where Obviously c >> 1 :P

Things to do before and after installing Ubuntu

After almost running out of space allocated for Ubuntu and somewhat messing my machine (started to crash a lot) just because I'm not a good maintainer, i decided to change the partition structure for the new install.

Deciding on how much space you need

This is a crucial step in installation. You should try and allocate enough space for the Linux distribution you are installing to avoid the pains of resizing the partitions. Sometime people even reinstall the whole distribution instead of resizing the partitions.

In my previous install i had allocated 40GB for the Linux partition. Installing software and a couple of virtual machines i was on the verge of running out of space. Also since i was to re-install so i decided to given even more space.

 

How my partitions are laid out

Also i decided to make a separate home partition, so that i don't loose my data if i need to reinstall or shift to a different distribution.

So i decided to make 3 separate partitions:

  1. About 40GB partition for root, where all the software installations will reside.
  2. About 60GB partition for home, so that my data resides in a separate partition.
  3. Since i have 6GB RAM , so about 5GB of swap space.
This is how my partitions are laid out on the disk.


Installation Process

The installation process is very easy for Ubuntu and now a days almost every distribution has made their installation process easier than before. So no problems here once your know how to layout your partitions.

After Installation

Surprisingly this time out of the box i could manipulate brightness settings otherwise you'll need to fix that too.
There are a few things you might want to do after you install Ubuntu. Here is a list of what i did.

  1. After installation adjust basic settings according to your need. Go to settings and make changes to power management, display, launcher settings etc.
  2. Enable Mutiverse.
  3. There are some 3rd party codecs or plugins required for essential softwares to work. Install "ubuntu-restricted-extras", this should take of almost everything you'll need from flash to codecs for audio and video files. But be warned that it might not be legal in some countries, because of software patents.
  4. When ever you install a package or remove a packages, remember there may be packages that are no longer needed (mostly installed along as dependencies). Make sure to remove those too.
Hopefully this time i will try hard not to screw my installation.