July 2005
Intermediate to advanced
544 pages
13h 8m
English
A suitably configured editor can make coding much easier, and code much more robust. Automating common tasks ensures that those tasks are done correctly every time, and automating common formatting requirements means that those requirements can be followed consistently without effort.
The following sections provide additions for the configuration files of five popular text editors. These additions support many of the layout and debugging guidelines recommended in this book.
vim is one of several successors to the classic Unix text editor vi. You can learn about vim and download the latest open source version for all major operating systems from http://www.vim.org.
The following commands might make useful additions to your .vimrc file:
set autoindent"Preserve current indent on new linesset textwidth=78"Wrap at this columnset backspace=indent,eol,start"Make backspaces delete sensiblyset tabstop=4"Indentation levels every four columnsset expandtab"Convert all tabs typed to spacesset shiftwidth=4"Indent/outdent by four columnsset shiftround"Indent/outdent to nearest tabstopset matchpairs+=<:>"Allow % to bounce between angles too"Inserting these abbreviations inserts the corresponding Perl statement...iab phbp #! /usr/bin/perl -wiab pdbg use Data::Dumper 'Dumper';^Mwarn Dumper [];^[hiiab pbmk use Benchmark qw( cmpthese );^Mcmpthese -10, {};^[Oiab pusc use Smart::Comments;^M^M###iab putm use Test::More qw( no_plan );iab papp ^[:r ...