Aziz's ode to Vim
Some of my colleagues ask, "hey, what is the big deal about an editor? it is
something trivial, what you do with it is more important..". True, what we do
with an editor is much more important than the editor itself. But an editor is
something basic, not something trivial. I would like to have a tremendous
control at my fingertips when I work. This is where one editor compares with
others. In this aspect, I can't think of an editor which can beat Vim.
This entire website was developed with Vim.
Perhaps I should say more - why I love Vim so much. I love vim because it makes
me so powerful. Actually, I philandered
with several editors before I happily settled down with Vim.
Read more about my experiences with text editors.
Vim novice? Here are some tips on
getting started on vim. (has details on downloading/installing as well).
Macros
Sort according to a column
I find this one pretty useful when I have data organized in columns and
I would like to sort according to one column. The columns could be
separated by space or any other character.
Usage :
" Sort lines treating the entire line as one string
:[range]Sort
" Sort lines based on column n
:[range]ColSort n
" Sort lines based on column n using c as the column separator
:[range]ColSort n c
Inserting numbers Insert
numbers in any column by visually selecting that column and typing
:'<,'> I 23 5 This would
create a sequence of right aligned numbers starting from 23 and
incremented by 5. Oh, by the way, this file includes a very useful command (by
Stefan Roemer) to execute an ex command on columns. You can select a block visually and
execute any ex-command (like substitute) explicitly on the block. For
example, selecting a block and typing
:'<,'> B s/pat/repl/ would
execute the substitute command exclusively on the block.
Find file Find the location
of a file from within vim. :FF
start_dir patt would find all files whose name matches the regular
expression patt starting from directory start_dir.
VHDL/Verilog and Vim
VHDL macros In my previous job, most
of my work involved editing VHDL code and these macros come in very handy.
These days I am with verilog (verilog macros coming soon).
Changing case of VHDL files Here are
two commands to change the reserved words and attributes in VHDL to all
lower or all upper. Commented words don't get changed. Please note that
this works only when syntax is on.
|