Thanks to
gmax for a list of excellent nodes. Here's my
.vimrc:
" I don't want to become awkward when editing on another machine,
" so I stick to as few and as highly effective settings as possible.
set nocompatible " we want vim, not vi
set ruler " display current position in file
set backspace=2 " BS and Del in insert mode allowed and go thro
+ugh EOLs
set number " line numbers
set scrolloff=3
set autoindent
set noerrorbells
if has("gui_running")
set guioptions-=f " fork+detach console
set guioptions-=t " no menu tear-off
colorscheme peachpuff
else
set background=dark " my console has black bg
endif
filetype plugin indent on
syntax on
" Current directory follows the file being edited
autocmd BufEnter * lcd %:p:h
" [F4] for quick :make
noremap <F4> <ESC>:make<C-M>
" [F5] toggles error window
noremap <F5> <ESC>:cope<C-M>
autocmd BufReadPost quickfix noremap <F5> <ESC>:ccl<C-M>:noremap <lt>F
+5> <lt>ESC>:cope<lt>C-M><C-M>:echo ":ccl"<C-M>
" [Ctrl-PgUp/Dn] to flip through :make errors
noremap <C-PageUp> :cp<C-M>
noremap <C-PageDown> :cn<C-M>
inoremap <C-PageUp> <ESC>:cp<C-M>i
inoremap <C-PageDown> <ESC>:cn<C-M>i
" save keystrokes on the Perl shebang
iabbrev #!p #!/usr/bin/perl -w<C-M>use strict;<C-M><ESC>:filetype dete
+ct<C-M>i
These settings, as they should be, are not language specific (except the abbr). Along with this rc, for Perl coding I have a
.vim/ftplugin/perl.vim:
" Vim filetype plugin file
" Language: Perl
" Maintainer: Dan Sharp <vimuser@crosswinds.net>
" Last Change: Sun, 19 May 2002 02:07:22 Central European Standard
+Time
" Changed By: Aristotle Pagaltzis <pagaltzis@gmx.de>
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
" Set 'formatoptions' to break comment lines but not other lines,
" and insert the comment leader when hitting <CR> or using "o".
setlocal fo-=t fo+=croql
setlocal comments=:#
" Make sure the continuation lines below do not cause problems in
" compatibility mode.
set cpo-=C
" Change the browse dialog on Win32 to show mainly Perl-related files
if has("gui_win32") && !exists("b:browsefilter")
let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" .
\ "Perl Modules (*.pm)\t*.pm\n" .
\ "Perl Documentation Files (*.pod)\t*.pod\n" .
\ "All Files (*.*)\t*.*\n"
endif
" Provided by Ned Konz <ned@bike-nomad.com>
"---------------------------------------------
setlocal include=\\<\\(use\|require\\)\\s*
setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','
+.pm','')
setlocal isfname=A-Z,a-z,:,48-57,_
setlocal isident=48-57,_,A-Z,a-z
setlocal iskeyword=48-57,_,A-Z,a-z,:
setlocal define=[^A-Za-z_]
" Set this once, globally.
if !exists("perlpath")
if &shellxquote != '"'
let perlpath = system('perl -e "print join(q/,/,@INC)"')
else
let perlpath = system("perl -e 'print join(q/,/,@INC)'")
endif
let perlpath = substitute(perlpath,',.$',',,','')
endif
let &l:path=perlpath
setlocal keywordprg=perldoc
setlocal makeprg=perl\ -Mstrict\ -wc\ %
setlocal errorformat+=%m\ at\ %f\ line\ %l.
setlocal grepprg=rgrep\ -n\ -R\ '*.p[ml]'\ $*
map <buffer> <C-]> :exec ":tag /".expand("<cword>")
____________Makeshifts last the longest.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.