Category: Linux

Vim for lazy people

Inspired by one my friend’s facebook status which says…”Laziness is a virtue which assists U in doing a job in minimum possible time with maximum possible efficiency !!” , I decided to customize my vim editor to implement features like ctrl+c, ctrl+v, autocomplete, autoindent, single key compile and run etc. to get a “true” IDE

First of all install SuperTab , this extension provides a functionality similar to auto-complete, and for my purposes, infact it improves it. Whenever you are typing a word/variable if you hit tab it will find the nearest match and/or display a list of possible completions.

Now create a .vimrc file if it is not present already in home directory. I’m posting my .vimrc file which is properly commented so that you can modify it in accordance to yourself.

Note that the comment tags are created in vimrc files using the ” (quote) character instead of the more usual # or //. Also during mapping of key “+y etc. represents the key mapped and is NOT a comment.

Here’s my .vimrc file ::

"tab size
set ts=4

"indentation width
set sw=4

"c like indentation
set cindent

"autocomplete menu
set wildmenu
set wildmode=list:longest,full
set mouse=a

"compiling using F3
map <F3> : call CompileGcc()<CR>
func! CompileGcc()
  exec "w"
  exec "!gcc % -o %<"

"compile and execute using F9
map <F9> :call CompileRunGcc()<CR>
func! CompileRunGcc()
  exec "w"
  exec "!gcc % -o %<"
  exec "! ./%<"

"autocomplete Parenthesis
"When you type an open brace, this will automatically
"insert a closing brace on the same line, after the cursor.
"If you quickly hit Enter after the open brace, (to begin
"a code block), the closing brace will be inserted on the
"line below the cursor. If you quickly press the open brace
"key again after the open brace, Vim won't insert anything extra,
" you'll just get a single open brace. Finally, if you quickly
"type an open and close brace, Vim will not do anything special.
inoremap {      {}<Left>
inoremap {<CR>  {<CR>}<Esc>O
inoremap {{     {
inoremap {}     {}

inoremap (      ()<Left>
inoremap (<CR>  (<CR>)<Esc>O
inoremap ((     (
inoremap ()     ()

inoremap [      []<Left>
inoremap [<CR>  [<CR>]<Esc>O
inoremap [[     [
inoremap []     []

"mapping some more keys ::

"CTRL-X is cut
vnoremap <C-X> "+x

"CTRL-C is copy
vnoremap <C-C> "+y

"CTRL-V is paste
vnoremap <C-V> "+gP

"to paste blockwise, uses paste.vim autoload script
exe 'inoremap <script> <C-V>' paste#paste_cmd['i']
exe 'vnoremap <script> <C-V>' paste#paste_cmd['v']

" CTRL-A is Select all
noremap <C-A> gggH<C-O>G
inoremap <C-A> <C-O>gg<C-O>gH<C-O>G
cnoremap <C-A> <C-C>gggH<C-O>G
onoremap <C-A> <C-C>gggH<C-O>G
snoremap <C-A> <C-C>gggH<C-O>G
xnoremap <C-A> <C-C>ggVG

" Use CTRL-Q to do what CTRL-V used to do
noremap <C-Q>  <C-V>

When your VMware Player crashes unexpectedly upon start (i.e. GUI opens up for 1-2 seconds and then disappears), fear not.Fix is very simple  ::

#cd /usr/lib/vmware/lib
#sudo mv

That’s it !!! 🙂

That worked for me. If that does not work either…try this

#vmware-modconfig --console --install-all
#mv /usr/lib/vmware/resources/mozilla-root-certs.crt 

"certificate" crash is due to "curl" package which don't support ssl or c-ares
credits ::

Installing packages in Linux

Installing *.rpm files

#rpm -ivh packageName.rpm

Installing *.tar.gz files

First you must extract the *.tar.gz using

#tar -zxvf packageName.tar.gz

now cd into the location of source code

#cd packageName

Now you must consider reading filename “readme.txt” generally present in this directory which contains the installation procedure . Most packages require to configure software for your computer and checks if you have everything needed for it to build using configure command.


after that compile the software using make command


using make install command, install the compiled software as the root user

#make install

Installing *.tar.bz2 files

Bzip2 files use a newer and much better compression algorithm than gzip (.gz)

uncompress them using

#tar -jxvf packageName.tar.bz2

now follow the same instructions as in case of tar.gz

Installing *.sh files

#chmod +x

#sh ./

Installing *.bin files

#chmod +x packageName.bin


Installed nvidia drivers using #yum install kmod-nvidia only to find out a blank screen with blinking cursor on reboot.This problem is due to Nouveau driver taking control of the graphic card at an earlier point in the boot procedure.To fix this problem you should make sure that nvidia proprietary drivers are used rather than nouveau driver provided by default in Fedora 11+.

Follow the steps to fix this problem, before installing nvidia drivers  ::

#vi /etc/modprobe.d/blacklist.conf

and append the following line in the bottom — “blacklist nouveau

now open grub.conf file

#vi /etc/grub.conf

and add this to end of lines starting with word kernel — “nouveau.modeset=0 vga=0x318

now perform

#yum install kmod-nvidia

If you are stuck at blank screen on reboot go for alt+ctrl+f1 and follow the first two steps.

To enable yum through proxy server, open the yum.conf configuration file present in /etc/yum.conf as root


#vi /etc/yum.conf

Edit yum.conf and put the http proxy server address and proxy port number in yum.conf main section
If your proxy requires a user name and password then append them also as shown below.

# put your http proxy here followed by port number
#replace your_username with your username
#replace your_password with password of your username

#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m


#yum clean all


#yum update