Showing posts with label vim. Show all posts
Showing posts with label vim. Show all posts

Friday, February 19, 2010

Vim editor for ruby on rails development using rails.vim

by sandipransing 0 comments
Vim install On CentOS
yum install vim-enhanced
Vim install on Ubuntu machine

Install vim-full using command
apt-get install vim

While coding with ruby, html, erb, haml, js and stylesheets.
It is great pain to indent code. Using rails vim one can easily
keep code always indented.

This increases code readability and minimizes effort, bugs and
finally proves ease of using vim editor.

rails.vim script contains lot of syntax highlighter and indentation
plugins that really helps development needs.

If you have git installed then clone it under .vim directory of your profile
git clone git://github.com/sandipransing/rails_vim.git ~/.vim

To install from zip file download & extract it inside ~/.vim directory

download link: http://www.vim.org/scripts/download_script.php?src_id=11920
wget http://www.vim.org/scripts/download_script.php?src_id=11920 /rails.vim 
This is how my editor looks like




Open your ~/.bashrc and at the bottom add:

alias vi=vim
export EDITOR=vim
Read More…

Wednesday, November 18, 2009

Get hand over VI / VIM editor

by sandipransing 1 comments

Movements
b   previous word
w   next word
e        end of word
0/^      begining of line
$        end of line
G        end of file
1G/gg    begining of file
/pattern  search next
?pattern  search previous
n         repeat    search forword ( i.e next occurence )
N         repeat    search backword
:line     goto line specified

  *****Modes****
  i   insert mode
  r   replace mode
  s   delete character under cursor and eneter insert mode

  *****Delete******
  x    delete character under cursor
  dd   delete current line
  line dd delete number of lines specified

  ****copy********
  yy        copy current line
  pp        print copied contents
  line yy   copy number of lines specified

  *******visual******

  v     enter visual mode
  aw    highlight word
  as    highlight sentence
  ap    highlight paragraph
  ab    highlight block

  ******undo/redo******
  u       undo
  cntrl+r redo

  ******autocomplete****
  cntrl+x   enter completion mode
  cntrl+p   display autocomplete options

  ******uppercase/lowercase*****
  guu   lowercase line
  gUU   uppercase line

  *******Regx replace****

  range s/foo/bar/arg - replace foo with bar in ‘range’ with

  Values of 'range':
  %               whole file
  number          that particular line
  none            apply to current line only

  values of 'arg':
  none  apply to first occurrence
  g     global (all occurrences)

Select/Macros
  qchar      start recording macro storing it in register ‘char’
  q          end recording
  @char      replay the macro stored in ‘char’
  :1,10 norm! @char run the macro stored in ‘char’ over the 1-10 line range

Read More…

Friday, May 22, 2009

vi / vim Shortcuts

by sandipransing 2 comments
Open file
vi filename
As i am newb on linux macine, i dont know vi shortcuts.
so, i am listing down shortcuts which i am getting familier. :)

Insert in file
i

Exit file
q

forced exit
q!

save file
wq

forced save
wq!

Copy no of lines
yy

Paste copied lines
pp

Undo changes
uu

Delete lines
dd

To search and replace string in vi
:%s/search_string/replacement_string/g

To find particular word in file
?string1

If you have any quick list. please, let me know
Read More…

About The Author

Sandip is a ruby on rails developer based in pune and also a blogger at funonrails. Opensource contributor and working with Josh software Private Limited. for more info read Follow Sandip on Twitter for updates.

Connect With Me...

Github Projects

@sandipransing Twitter