version 6.0
" set nocompatible
set showcmd
set showmatch
set incsearch
set ignorecase smartcase
set modeline
runtime ftplugin/man.vim
let cpo_save=&cpo
set cpo=B
autocmd FileType text setlocal tw=72 spell spelllang=en_us
autocmd FileType mail setlocal tw=72 nosmartindent nocindent
autocmd FileType perl so $VIM/vimcurrent/indent/perl.vim
autocmd FileType perl setlocal textwidth=120
autocmd FileType perl nmap K "zyiwn:set buftype=nofile:r!
\perldoc -tf 'z' 2>/dev/null perldoc 'z'gg
autocmd FileType php nmap K "zyiwn:set buftype=nofile:r!
\lynx -dump -nolist php.net/zperl -wne'print if /^z(?:\(\))?$/../^\s+Last updated:/'gg
autocmd FileType sh so $VIM/vimcurrent/indent/sh.vim
autocmd FileType sh setlocal ai
autocmd FileType c setlocal kp=man\ 3
autocmd FileType c nmap K "zyiwn:set buftype=nofile:r! man 3 'z'gg
autocmd BufNewFile,BufRead *.html source ~/.vim/html.vim
map!
map!
map!
map!
map!
map!
map!
map!
map!
map!
map
map
map
map
map
map
map
map
map
map
"
"
syntax on
"
" Set up printing
if !exists("printexpr_set")
let printexpr_set = 1
set printexpr=PrintFile(v:fname_in)
set printoptions=top:5pc,bottom:10pc,header:0
function PrintFile(fname)
call system("gv " . a:fname)
call delete(a:fname)
return v:shell_error
endfunc
endif
"
" I like a black xterm
set background=dark
"
" Allow 'Ctrl-N' identifier "copy" mechanism to recognize Perl idents
set iskeyword+=:
"
" Perltidy
map ,pt :%! perltidy
map ,ptv :'<,'>! perltidy
"
" Perl stack tracing via Carp::confess
map ,di :4Ouse Carp::Always;
map ,dd :4dd
"
"
" MONSTER TIPS from the VIM site!
"
" Yank word into register w.
nmap gy lb"wye
" Word from register w replaces the word under cursor. Use with 'gy'
" After replace, reposition to previous word for possibly another replace.
nmap gw lb"wPlcwbb
"
" Wrap word under cursor in single quotes
nmap \' ciw'pa'
"
" Wrap visually-selected word in single quotes
vmap \' c'pa'
"
" Wrap word under cursor in double quotes
nmap \" ciw"pa"
"
" Wrap visually-selected word in double quotes
vmap \" c"pa"
"
" Wrap word under cursor in *s
nmap \* ciw*pa*
"
" Wrap visually-selected word in *s
vmap \* c*pa*
"
" Wrap word under cursor in _s
nmap \_ ciw_pa_
"
" Wrap visually-selected word in _s
vmap \_ c_pa_
"
" Wrap visually-selected word/current line in
vmap \2 "zdi
z
nmap \2 :s#.*#
&
#
"
" Wrap visually-selected word/current line in
vmap \3 "zdi
z
nmap \3 :s#.*#
&
#
"
"" Wrap visually-selected word/current line in
vmap \4 "zdi
z
nmap \4 :s#.*#
&
#
"
" Mark the visually-selected area/entire file with HTML paragraphs
vmap \a :!perl -0 -wne's/^(\s*)//s;$start=$1;s/(\s*)$//s;$end=$1;s/(?:\s*\n){2,}/\n<\/p>\n\n
\n/gsm;print "$start
\n$_\n
$end"'
nmap \a :%s#\(\s*\n\)\{2,\}#\r
&
\r#g:%s#\n*\%$#\r
\r#g:0/<\/p>dd:0
"
" Mark the visually-selected area/entire file with HTML paragraphs
vmap \A :!perl -0 -wne's/^(\s*)//s;$start=$1;s/(\s*)$//s;$end=$1;s/(?:\s*\n){2,}/\n<\/p>\n<\/div>\n\n
dd:0
"
" Wrap visually-selected word/current line in
vmap \b "zdiz
nmap \b :s#.*#&#
"
" Wrap visually-selected word in
vmap \c cpa
"
" Pull the first name out of the first line and write 'Hi, name -'
map \g $F,wywIHi, pa-
" Make that 'Hello, name -'
map \G $F,wywIHello, pa-
"
" Convert thumbnail filename to an HTML link pointing to a larger eponymous
" image plus name tag
map \h :s#\(.*\)th_\(.*\)\(\.jpg\)#\2#
"
" Wrap visually-selected word/current line in
vmap \i cpa
nmap \i :s#.*#&#
"
" Jump-FROM and jump-TO links for '[1]'-type syntax
map \j :s:\[\([0-9]\+\)\]:[\1]:
map \J :s:\[\([0-9]\+\)\]:[\1]:
"
" Convert visually-selected URL/current line to HTML link
vmap \l "zdi"zpa
nmap \l :s#.*#&#
"
" Convert visually-selected URL/current line to HTML link (no URL)
vmap \L "zdi"zpaF"
nmap \L :s#.*#&#t>
"
" Convert visually-selected URL/current line to "mailto:" link
vmap \m "zdi"zpa
nmap \m :s#.*#&#
"
" Wrap visually-selected paragraph in
vmap \p "zdi
z
" Wrap current line in
nmap \p :s#.*#
&
#
"
" Wrap visually-selected paragraph in
vmap \P "zdi
z
" Wrap current line in
nmap \P :s#.*#
&
#
"
"
" Magic Perl shebang
map :set filetype=perl:set kp=perldoc\ -f:0:-r!which perlI#!$a -wo# Created by Ben Okopnik on:r!date-J^iuse strict;
" Magic Bash shebang
map :set filetype=sh:set kp=man:0:-r!which bashI#!o# Created by Ben Okopnik on:r!date-J^i
" Dictionary lookup for word under cursor
map :!dict \|less
map :w:![ -x "%:p" ]\|\|chmod +x "%:p":!"%:p"
map :w:!cc % && ./a.out
" Toggle spell-checking
map :if exists("syntax_on")syntax offset spellelsesyntax enableset nospellendif
"
" Toggle a comment hash at the beginning of the line
map :.!perl -wlne'/^(\s*)((?:\# ?)?)(.*)/;print $2?"$1$3":"$1\# $3"'
" Toggle comment hashes for visually-selected block
vmap :!perl -wlne'/^(\s*)((?:\# ?)?)(.*)/;print $2?"$1$3":"$1\# $3"'
"
map :r!quote
map q vipgq
map! q vipgq
"
"
""" Vim variables
"
let &cpo=cpo_save
unlet cpo_save
set autoread
set noautoindent
set nosmartindent
set backupdir=~/backup,/tmp
set backspace=2
set formatoptions=tcql
set history=50
" Don't redraw screen during macro execution
set lazyredraw
set ruler
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
set syntax=mail
set textwidth=75
set viminfo='20,\"50
set tabstop=4
set shiftwidth=4
set report=1
set updatecount=50 " write swap file to disk after each 100 characters
set updatetime=6000 " write swap file to disk after 6 inactive seconds
set visualbell
abb nad and
abb hte the
abb teh the
abb THe The
abb THis This
abb taht that
abb htat that
abb jsut just
abb mroe more
abb wnat want
abb lauhg laugh
abb weatehr weather
abb whetehr whether
abb excercise exercise
abb waht what
abb wiht with
abb becasue because
abb otehr other
abb rahter rather
abb thouhg though
abb althouhg although
abb togetehr together
abb mena mean
abb enouhg enough
abb enoguh enough
abb anyhting anything
abb Microsoft Micr0s0ft
abb Windows Wind0ws
abb Outlook 0utlook
abb Holland the Netherlands
"
abb _lg linuxgazette.net
abb _hlg http://linuxgazette.net
"
"
" Programming/HTML shortcuts
abb _cgi use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;use CGI qw/:standard/;$\|++;binmode STDOUT, ':encoding(UTF-8)'; # Set up utf-8 outputprint header(-charset => 'utf-8'), start_html( -encoding => 'utf-8', -title => 'Untitled');print end_html;?Untitled
abb _html :set indentexpr=:set noautoindent:0:-r!perl -MCGI=:standard -we'print start_html,end_html'kki
abb _css :set tw=120:0I"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">TITLE
:5fT
abb _pod =head1 NAME=head1 DESCRIPTION=head1 INTERFACE=head1 CAVEATSThis code is experimental, and may contain bugs. Please report any thatyou find to the address below.=head1 AUTHORBen Okopnik (ben@linuxgazette.net)=head1 SEE ALSOperl(1)=cut
abb _table