Donnerstag, 20. Dezember 2012

VI: best Ruby IDE since 1976

First I have to admit that you caught me in a lie.
The very best editor for developing software is not the VI but its conduction, the great VIM (Vi IMproved). It's not "cool" like TextMate and Apple hipsters might give a sniff at VIM, but it's available on every professional OS (Windows is none!)
From time to time you also have to debug some logic on a remote server, possibly even on a production server. Then your best choice is tunneling via SSH and debugging in your terminal by using VIM.
The mentioned method of operation is not only for Rubyists. It's the way to go for everyone working on remote machines. Even those Java island guys have to turn their back on NetBeans/ IntelliJ/ Eclipse in some situations.
Other good points are VIM's portable configuration, the high level of customizability and extensibility and not to forget its powerful and skilled community.
Well, none says VIM is intuitive. There is a learning curve when you first start using it, and it does require a bit of a commitment. But you will be rewarded for the rest of your coding life time.
If VIM is not already installed on your Debian based system (like Ubuntu), just do:
user$ sudo apt-get install vim vim-common
or in Fedora:
user$ sudo yum install vim-common vim-enhanced vim-minimal
As a next step maybe you will want to edit your vimrc:
user$ vi ~/.vimrc
There you can configure a lot and it will be part of your VIM life style. It could look like this:
set nocompatible " make VIM useable by switching off the compatibility to grandpa VI
set diffexpr=MyDiff() " overwrite the default diff function of VIM
function MyDiff()
  let opt = ''
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  silent execute '!C:\Vim\vim61\diff -a ' . opt . v:fname_in . ' ' . v:fname_new . ' > ' . v:fname_out
set history=500 " keep 500 lines of command line history
set tabstop=4 " set the tab Stops to 4 white spaces
set shiftwidth=4 " set the indention to 4 white spaces. along with tabstop=4 it implies an indention with 1 tab
set noexpandtab " do not replace Tabs with white space while editing
set nobackup " do not write Backup Files while saving

set showmatch " jump to the opening bracket briefly, if a closing bracket is typed

set cindent " cindent is a quite intelligent indention

set fo=croq " continues the comments in the next line

set foldmethod=marker " tagged lines with {{{ and }}} can be hidden with zc or opened with zo
set mousehide " hides mouse pointer while typing

set background=dark " set the background dark

syntax on " enable syntax highlightening
filetype on
filetype indent on
filetype plugin on
Of course there are a lot more options. Surf the web for it.
I won't go into details how to use the VIM. It is well documented in VIM. Just type :help. Moreover there are many tutorials out there. I suggest the official VIMdoc and the great screencast at peep For getting further tips visit the VIM Runpaint

Keine Kommentare:

Kommentar veröffentlichen