Saari Development

Vim: Indentation (tab) Settings

Posted in Uncategorized by imsaar on February 27th, 2006

In the same discussion that I discovered the settings for ruby specific settings I found some tips on best setting of tab and shift related settings

sts=2 sw=2 ts=8 et

Here is my understanding of the settings:

sts = smart tab stops - these are useful when you hit tab for indenting, when you hit backspace you will go back a sts lenth rather than one space at a time because of et is enabled

sw = shift width - this is useful when you do <> for indenting

ts = tab stop - would render the real tab (tab character) properly if found in your code

et = expand tabs - replaces/exapnds tab to spaces

Vim: Setting different indentation for Ruby files

Posted in Uncategorized by imsaar on February 27th, 2006

Adding this to .vimrc file should result in shift-width set to two when editing ruby files:

autocmd FileType ruby setlocal  sw=2

*nix: Text Files Commands

Posted in Uncategorized by imsaar on February 25th, 2006

This post saved the day for some work related stuff:

Week 101 - Unix Commands Reference (7 March 2005)

It talks about:

split … split a file into many files
sort … sort the lines of a file into alphabetic order
uniq … filter out repeated lines of a file
join … perform a database join on files
paste … merge corresponding lines of two file
comm … display lines common to two files
diff … compare two files
diff3 … compares three files
sdiff … compare and merge two files
zdiff, bzdiff … diff zipped, bzipped files

Ruby: using irb and ri as a exploratory learning device

Posted in Uncategorized by imsaar on February 22nd, 2006


irb> Kernel.methods.each do |method| puts method; system “/usr/local/bin/ri –no-pager Kernel##{method}”; ch = STDIN.getc; break if (ch.chr == ‘q’) end

Once you enter this just keep hit enter until you want to quit, at that point hit ‘q’ and enter.

Still some kinks to be worked out but it is a start

Update:
Found this interesting link: http://www.rubygarden.org/ruby?Irb/TipsAndTricks on http://www.rubyweeklynews.org/

vim extracting first column (space delimited)

Posted in Uncategorized by imsaar on February 19th, 2006

Just figured out how to extract a single (first) column from a file containing text

:%s/^\(\w\+\)\.\*/\1/g

I am sure there is a better way to do this but this is best I can get for now. I don’t like the excessive escaping vim requires in regex.

PS: Just figured out that you have to have:

:set nomagic

for the above subsitution to work.

vimrc update - showmatch

Posted in Uncategorized by imsaar on February 10th, 2006

” rediscovered showmatch
set showmatch
” this would show you the matching paren or brace