"""""""""""""""""" "" vim: :ts=4 sw=4 noexpandtab: "" "" gVim RC file v. 1.8 "" 20080428-230500 Marco Fontani "" """""""""""""""""" let g:netrw_liststyle=1 "" Do :call RCVer() to see current version let g:GvimRC_Version = '1.8a ferus' function! RCVer() :echo "MF gVim RC version #" g:GvimRC_Version endfunction """ GUI FONT "set guifont=Lucida_Console:h13:cANSI "set guifont=Consolas:h14:cANSI "set guifont="Bitstream Vera Sans 9" set guifont="DejaVu Sans Mono 9" """ MSWIN " unsure about the following, hopefully they'll be alright source $VIMRUNTIME/mswin.vim behave mswin """ PERL SUPPORT filetype plugin on let g:Perl_AuthorName = 'Marco Fontani' let g:Perl_AuthorRef = 'MF' """ TODO WORK let g:Perl_Email = 'MFONTANI@cpan.org' "let g:Perl_Email = 'MFONTANI@uk.ibm.com' let g:Perl_Company = 'n/a' "let g:Perl_Company = 'IBM UK LTD' :set nocompatible :set cursorline " set suffixes to ignore in command-line completion " these are mostly things we won't want to hand edit set suffixes=.bak,~,.o,.info,.swp,.aux,.bbl,.blg,.dvi,.lof,.log,.lot,.ps,.toc """ For plugin VCS: http://www.vim.org/scripts/script.php?script_id=90 " show nice status line set statusline=%<%f\ %{VCSCommandGetStatusLine()}\ %h%m%r%=%l,%c%V\ %P " setup the plugin :VCSCommandEnableBufferSetup " show the status line -- always :set laststatus=2 """ MAP LEADER let mapleader="\\" let maplocalleader = "," "" NEED Perl's OmniCompletion from: http://www.vim.org/scripts/script.php?script_id=1924 "" For "plugin" Perl's Devel::PerlySense, as per http://use.perl.org/~Ovid/journal/35574?from=rss "" Also see: http://amix.dk/blog/viewEntry/130 "" on (.vim|vimfiles)/ftplugin create perl_perlysense.vim containing: "if exists( "b:perlysense" ) " finish "endif "let b:perlysense = 1 map pp :call PerlySense_POD() map pg :call PerlySense_smart_go_to() function! PerlySense_POD() call GetPos() let command="perly_sense smart_doc --file=" . b:file." --row=".b:row." --col=".b:col echo system(command) endfunction function! PerlySense_smart_go_to() call GetPos() let command="perly_sense smart_go_to --file=" . b:file." --row=".b:row." --col=".b:col let result = split( system(command), "\t" ) let file = result[0] execute "e " . file endfunction function! GetPos() let b:file = bufname("%") let b:row = line(".") let b:col = col(".") endfunction "" INDENT OPTIONS " vim: :ts=4 sw=4 noexpandtab: set ts=4 set sw=4 set noexpandtab """ Spell Checking ":set spell ":set spellang=uk,it """ OUTLINER " defaults: let otl_install_menu=1 let no_otl_maps=0 let no_otl_insert_maps=0 " overrides: let otl_bold_headers=0 let otl_use_thlnk=0 au BufWinLeave *.otl mkview au BufWinEnter *.otl silent loadview """ FOLDING set foldmethod=indent set foldcolumn=3 set foldlevel=999 """ VISUALIZATION " shows line numbers set number " on six characters set numberwidth=6 """ WORD COMPLETION "" TODO WORK set dictionary=/usr/dict/words "set dictionary=\dms\scripting\WORDS set ignorecase " set infercase " sets how to auto-complete with CTRL+P " :set complete=key,key,key " . Current file " b Files in loaded buffers, not in a window " d Definitions in the current file and in files included by a #include directive " i Files included by the current file through the use of a #include directive " k The file defined by the "dictionary" option (discussed later in this chapter) " kfile The file named {file} " t The "tags" file. (The ] character can be used as well.) " u Unloaded buffers " w Files in other windows " In my case, .,b,k should suffice (still testing!) set complete=.,b,d,k,t """ COLOR SCHEME " Default ":colorscheme marcodark ":colorscheme jhlight ":colorscheme jhlight ":colorscheme osx_like "hi Comment gui=none guifg=RoyalBlue3 guibg=#f0f0e0 """"" NOW DONE AT END!!! " ____ _ _____ _ _ "| _ \ ___ _ __| | | ___| _ _ __ ___| |_(_) ___ _ __ ___ "| |_) / _ \ '__| | | |_ | | | | '_ \ / __| __| |/ _ \| '_ \/ __| "| __/ __/ | | | | _|| |_| | | | | (__| |_| | (_) | | | \__ \ "|_| \___|_| |_| |_| \__,_|_| |_|\___|\__|_|\___/|_| |_|___/ " """ From http://www.perlmonks.org/?node_id=540167 " check perl code with :make "autocmd FileType perl set makeprg=perl\ -wc\ %\ $* autocmd FileType perl set makeprg=\"$VIMRUNTIME/tools/efm_perl.pl\"\ -c\ %\ $* " should aid getting to the line where the error is -- WORKS only with the efm_perl.pl autocmd FileType perl set errorformat=%f:%l:%m """ For perlcritic: "let current_compiler = "perlcritic" "if exists(":CompilerSet") != 2 " command -nargs=* CompilerSet setlocal "endif "autocmd FileType perl set makeprg=perlcritic\ -verbose\ 1\ -2\ % "autocmd FileType perl set errorformat=%f:%l:%c:%m " Folding: let perl_fold=1 let perl_fold_blocks=1 " Highlight POD correctly: let perl_include_pod = 1 " When you hit F4 inside a code block it folds on that block, working on your {}'s "set foldmethod=marker "nmap 0v/{%zf "From http://www.perlmonks.org/?node_id=143348 " F2 close current window (commonly used with my F1/F3 functions) noremap :close " perl -cw buffer, using a temp file, into a new window function! PerlCW() let l:tmpfile1 = tempname() let l:tmpfile2 = tempname() execute "normal:w!" . l:tmpfile1 . "\" execute "normal:! perl -cw ".l:tmpfile1." \> ".l:tmpfile2." 2\>\&1 \" execute "normal:new\" execute "normal:edit " . l:tmpfile2 . "\" endfunction " perl buffer, using a temp file, into a new window function! PerlOutput() let l:tmpfile1 = tempname() let l:tmpfile2 = tempname() execute "normal:w!" . l:tmpfile1 . "\" execute "normal:! perl ".l:tmpfile1." \> ".l:tmpfile2." 2\>\&1 \" execute "normal:new\" execute "normal:edit " . l:tmpfile2 . "\" endfunction " Settings for editing perl source (plus bind the above two functions) function! MyPerlSettings() if !did_filetype() set filetype=perl endif "set textwidth=78 "set expandtab "set tabstop=4 "set shiftwidth=4 "set cindent set comments=:# set formatoptions=croql set keywordprg=man\ -S\ 3 noremap :call PerlCW() noremap :call PerlOutput() endfunction autocmd FileType perl :call MyPerlSettings() " .t files are really Perl "autocmd BufRead *.t set syntax=perl autocmd BufRead *.t set filetype=perl " PerlDoc on a SPLIT WINDOW function! PerlDoc() normal yy let l:this = @ if match(l:this, '^ *\(use\|require\) ') >= 0 exe ':new' exe ':resize' let l:this = substitute(l:this, '^ *\(use\|require\) *', "", "") let l:this = substitute(l:this, ";.*", "", "") let l:this = substitute(l:this, " .*", "", "") exe ':0r!perldoc ' . l:this exe ':0' return endif normal yiw exe ':new' exe ':resize' exe ':0r!perldoc -f ' . @ exe ':0' endfunction map h :call PerlDoc():set nomod "" Call Devel::ptkdb on current buffer map :!perl -d:ptkdb % imap :!perl -d:ptkdb % perl << EOF sub YYYYMMDD { my $yyyymmdd = sprintf("%04d/%02d/%02d", (localtime(time))[5] + 1900, (localtime(time))[4] + 1, (localtime(time))[3] ); $yyyymmdd; } sub HHMM { my $hhmm = sprintf("%02d:%02d", (localtime(time))[2], (localtime(time))[1] ); $hhmm; } sub perl_dbix_table { my $fn = $main::curbuf->Name() || "NONAME"; # Edited file's name $main::curbuf->Append(0, # line 0 == start of the file "package XY::Main::TABLENAME;", "use base qw/DBIx::Class/;", "#__PACKAGE__->load_components(qw/PK::Auto Core/);", "#__PACKAGE__->table('TABLENAME');", "#__PACKAGE__->add_columns(qw/id column1 column2/);", "#__PACKAGE__->set_primary_key('id');", "#__PACKAGE__->has_many(column2 => 'XY::Main::OtherTable');", "#__PACKAGE__->belongs_to(column1 => 'XY::Main::AnotherTable');", "1;", "", ); } sub perl_header { my $fn = $main::curbuf->Name() || "NONAME"; # Edited file's name #$main::curwin->Cursor(0,0); # Goes to first line in file $main::curbuf->Append(0, # line 0 == start of the file "#!/usr/bin/perl", "# vim: :ts=4 sw=4 noexpandtab:", "#"x72, "# " . "FILE: $fn", "# " . "CREATED: " . YYYYMMDD() . " " . HHMM(), "# " . "AUTHOR: " . VIM::Eval("g:Perl_AuthorName") . " <" . VIM::Eval("g:Perl_Email") . ">" , "# " . "COMPANY: " . VIM::Eval("g:Perl_Company"), "#", "# VERSION: 0.0.1", "#", "# " . "DESCRIPTION:", "#", "#", "#"x72, "", "use strict;", "use warnings;", "use diagnostics;", "use Data::Dumper;", "", ); } sub perl_footer { my $fn = $main::curbuf->Name() || "NONAME"; # Edited file's name $main::curbuf->Append($main::curbuf->Count(), # Last line "", "__END__", "", "=head1 NAME", "", "$fn -- # TODO DESCRIPTION", "", "=head1 SYNOPSIS", "", "=head1 DESCRIPTION", "", "# TODO DESCRIPTION", "", "=head1 METHODS", "", "=over 8", "", "=item C", "", "Syntax:", "", " todo();", "", "Returns:", "", " undef on failure", " defined on success", "", "=back", "", "=head1 SEE ALSO", "", "TODO", "", "=head1 AUTHOR", "", VIM::Eval("g:Perl_AuthorName") . " <" . VIM::Eval("g:Perl_Email") . ">" , "", "=head1 COPYRIGHT AND LICENSE", "", "Copyright (c) " . ((localtime(time))[5] + 1900) . " by " . VIM::Eval("g:Perl_AuthorName") . " - " . VIM::Eval("g:Perl_Company"), "This code may only be redistributed internally in " . VIM::Eval("g:Perl_Company"), "", "=cut", ); } sub perl_testfile { $main::curbuf->Append(0, # line 0 == start of the file "use Test::More qw(no_plan);", "use Carp;", "", "# Example:", "# ok(!defined(\$x), 'x is not defined') or diag(Dumper(\$x));", "", ); perl_header(); # puts the header at start of file } sub perl_sub { my ($r,$c) = $main::curwin->Cursor(); # Get current row/col $main::curwin->Cursor($r, 0); # Go to current row, column 0 $main::curbuf->Append($r, "sub NAME {", "\tmy %params = (", "\t\t# param1 => 'def value',", "\t\t\@\_,", "\t);", "", "\t# my \$t = \$params{param1} or croak('NAME() called with no param1 parameter!');", "", "}", ); $main::curwin->Cursor($r, $c); # Go to where we were } EOF "__ ___ _____ _ _ "\ \ / (_)_ __ ___ | ___| _ _ __ ___| |_(_) ___ _ __ ___ " \ \ / /| | '_ ` _ \ | |_ | | | | '_ \ / __| __| |/ _ \| '_ \/ __| " \ V / | | | | | | | | _|| |_| | | | | (__| |_| | (_) | | | \__ \ " \_/ |_|_| |_| |_| |_| \__,_|_| |_|\___|\__|_|\___/|_| |_|___/ " "" Comment current line in VBS function! VBSKomment() if getline(".") =~ "^\'" let hls=@/ silent s/^\'//g let @/=hls else let hls=@/ silent s/^/\'/ let @/=hls endif endfunction "" Comment current line in Perl function! PERLKomment() if getline(".") =~ "^\#" let hls=@/ silent s/^\#//g let @/=hls else let hls=@/ silent s/^/\#/ let @/=hls endif endfunction """ Abbreviations ab tihs this ab teh the "" Profiling template conversion: function! PTCSV() " Tabs to semicolons : %substitute @\t@;@ge " Remove multiple semicolons from end of line : %substitute @;\+$@@ge endfunction "" Profiling template HEADER for TARGETS function! PTTARGETSHEADER() exe(":0") exe("normal iImport_Tool_Version_4\.5\n") exe("normal iColName;ColDesc;ColOs;ColCIDServer;ColSME;ColGroup;ColWebPack;ColProduct;ColPrRefGRoup;ColPrRefProduct;ColProductSortAfter;ColSysParamId;ColSysParamValue\n") exe("normal i#last modified;19/06/2007;MFONTANI\n") endfunction "" Remove Empty Lines function! RemoveEmptyLines() : %substitute @^[\ \t]*\n@@g : %g@^$@d endfunction "" Figlet current line function! FIGLET() " Call figlet : . ! figlet " Comment out 5 next lines with # : . , .+5 s@^@#@ge " Remove subsequent (5) empty lines generated : . , .+10 g@^$@d endfunction "" Edit gVim RC function! EditGVIMRC() :e $HOME/.gvimrc endfunction "" Edit Bash RC function! EditBASHRC() "" TODO WORK ":e C:\cygwin\home\AGY14430\.bashrc ":e C:\cygwin\home\Marco\.bashrc :e $HOME\.bashrc endfunction " A comprehensive TARGETS function function! PTTARGETSALL() : call PTTARGETSHEADER() : call PTCSV() endfunction " __ __ "| \/ | ___ _ __ _ _ "| |\/| |/ _ \ '_ \| | | | "| | | | __/ | | | |_| | "|_| |_|\___|_| |_|\__,_| " :menu Marco.CScheme.Jhlight :colorscheme jhlight :menu Marco.CScheme.MarcoLight :colorscheme marcolight "":menu Marco.GTD :tabe c:\dms\GTD.otl "":inoremenu Marco.GTD :tabe c:\dms\GTD.otl :menu Marco.gVimRC.FetchMUDIt :Nread scp://okram@server.mud.it/www/gvimrc.txt :inoremenu Marco.gVimRC.FetchMUDIt :Nread scp://okram@server.mud.it/www/gvimrc.txt :menu Marco.gVimRC.SaveMUDIt :Nwrite scp://okram@server.mud.it/www/gvimrc.txt :inoremenu Marco.gVimRC.SaveMUDIt :Nwrite scp://okram@server.mud.it/www/gvimrc.txt :menu Marco.gVimRC.EditLocal :call EditGVIMRC() :inoremenu Marco.gVimRC.EditLocal :call EditGVIMRC() :menu Marco.BASHRC :call EditBASHRC() :inoremenu Marco.BASHRC :call EditBASHRC() ":menu Marco.VCS.Add :VCSAdd ":inoremenu Marco.VCS.Add :VCSAdd ":menu Marco.VCS.Annotate :VCSAnnotate ":inoremenu Marco.VCS.Annotate :VCSAnnotate ":menu Marco.VCS.Blame :VCSBlame ":inoremenu Marco.VCS.Blame :VCSBlame ":menu Marco.VCS.Commit :VCSCommit ":inoremenu Marco.VCS.Commit :VCSCommit ":menu Marco.VCS.Delete :VCSDelete ":inoremenu Marco.VCS.Delete :VCSDelete ":menu Marco.VCS.Diff :VCSDiff ":inoremenu Marco.VCS.Diff :VCSDiff ":menu Marco.VCS.GotoOriginal :VCSGotoOriginal ":inoremenu Marco.VCS.GotoOriginal :VCSGotoOriginal ":menu Marco.VCS.Log :VCSLog ":inoremenu Marco.VCS.Log :VCSLog ":menu Marco.VCS.Remove :VCSRemove ":inoremenu Marco.VCS.Remove :VCSRemove ":menu Marco.VCS.Revert :VCSRevert ":inoremenu Marco.VCS.Revert :VCSRevert ":menu Marco.VCS.Review :VCSReview ":inoremenu Marco.VCS.Review :VCSReview ":menu Marco.VCS.Status :VCSStatus ":inoremenu Marco.VCS.Status :VCSStatus ":menu Marco.VCS.Update :VCSUpdate ":inoremenu Marco.VCS.Update :VCSUpdate ":menu Marco.VCS.VimDiff :VCSVimDiff ":inoremenu Marco.VCS.VimDiff :VCSVimDiff :menu Marco.PT.TabToSSV :call PTCSV() :inoremenu Marco.PT.TARGETSALL :call PTTARGETSALL() :menu Marco.PT.TARGETSALL :call PTTARGETSALL() :inoremenu Marco.PT.TabToSSV :call PTCSV() :menu Marco.PT.TargetsHeader :call PTTARGETSHEADER() :inoremenu Marco.PT.TargetsHeader :call PTTARGETSHEADER() :menu Marco.PT.Filetype :set ft=PT :inoremenu Marco.PT.Filetype :set ft=PT :menu Marco.TEXT.RemoveEmptyLines :call RemoveEmptyLines() :inoremenu Marco.TEXT.RemoveEmptyLines :call RemoveEmptyLines() :menu Marco.PERL.Perl_Header :perl perl_header :inoremenu Marco.PERL.Perl_Header :perl perl_header :menu Marco.PERL.Perl_Footer :perl perl_footer :inoremenu Marco.PERL.Perl_Footer :perl perl_footer :menu Marco.PERL.Perl_TEST :perl perl_testfile :inoremenu Marco.PERL.Perl_TEST :perl perl_testfile :menu Marco.PERL.Perl_SUB :perl perl_sub :inoremenu Marco.PERL.Perl_SUB :perl perl_sub :menu Marco.PERL.DBIx_Table :perl perl_dbix_table :inoremenu Marco.PERL.DBIx_Table :perl perl_dbix_table " _ __ __ __ _ "| |/ /___ _ _ | \/ | __ _ _ __ _ __ (_)_ __ __ _ ___ "| ' // _ \ | | | | |\/| |/ _` | '_ \| '_ \| | '_ \ / _` / __| "| . \ __/ |_| | | | | | (_| | |_) | |_) | | | | | (_| \__ \ "|_|\_\___|\__, | |_| |_|\__,_| .__/| .__/|_|_| |_|\__, |___/ " |___/ |_| |_| |___/ "" Function Keys "" Browse/edit file: map :browse confirm e imap :browse confirm e "" Make current file map :make % imap :make % "" Execute current file map :!% imap :!% "" Tag List Toggle nnoremap :TlistToggle nmap :SrcExplToggle "" Normal keys map & :call PERLKomment() map ^ :call VBSKomment() "" VMAPS "vmap w :call VisualHTMLTagWrap() "cmap >fn =expand('%:p') "cmap >fd =expand('%:p:h').'/' " _____ ____ _ _ "| ___| _ _ __ ___ / ___|__ _| | |___ "| |_ | | | | '_ \ / __| | | / _` | | / __| "| _|| |_| | | | | (__ | |__| (_| | | \__ \ "|_| \__,_|_| |_|\___| \____\__,_|_|_|___/ " "" enables "show matching parens line" on all files: "call TEchoPairInstall('*') """ AUTOCMDS "" Reloads _gvimrc when saved -- removed for now "" autocmd BufWritePost _gvimrc source % ""au BufNewFile,BufRead *.opt setf opt " NOT good for VBS part: "au BufNewFile,BufRead *.hta :set ft=html " NOT good for HTML part: au BufNewFile,BufRead *.hta :set ft=vb " ____ _ ____ _ " / ___|___ | | ___ _ __ / ___| ___| |__ ___ _ __ ___ ___ "| | / _ \| |/ _ \| '__| \___ \ / __| '_ \ / _ \ '_ ` _ \ / _ \ "| |__| (_) | | (_) | | ___) | (__| | | | __/ | | | | | __/ " \____\___/|_|\___/|_| |____/ \___|_| |_|\___|_| |_| |_|\___| " From "osx_like.vim" -- my tastes hi clear set background=light if exists("syntax_on") syntax reset endif hi Normal gui=none guifg=Black guibg=White hi Cursor guifg=White guibg=Black "hi CursorLine guibg=lightblue ctermbg=lightgray hi LineNr gui=bold guifg=#828c95 guibg=#cccccc hi NonText gui=bold guifg=DarkGray guibg=#dddddd hi SpecialKey gui=none guifg=RoyalBlue4 hi Title gui=bold guifg=Black hi Visual gui=none guifg=White guibg=#829db9 hi FoldColumn gui=none guifg=Black guibg=#979797 hi Folded gui=none guifg=#666666 guibg=#cccccc hi StatusLine gui=bold guifg=#829db9 guibg=Black hi StatusLineNC gui=bold guifg=#829db9 guibg=#666666 hi VertSplit gui=bold guifg=#9ca6af guibg=DimGray hi Wildmenu gui=bold guifg=Black guibg=White hi Pmenu guibg=Grey65 guifg=Black gui=none hi PmenuSbar guibg=Grey50 guifg=fg gui=none hi PmenuSel guibg=Yellow guifg=Black gui=none hi PmenuThumb guibg=Grey75 guifg=fg gui=none hi IncSearch gui=none guifg=White guibg=RoyalBlue4 hi Search gui=none guifg=Black guibg=Yellow hi MoreMsg gui=bold guifg=ForestGreen hi Question gui=bold guifg=ForestGreen hi WarningMsg gui=bold guifg=Red hi Comment gui=none guifg=RoyalBlue3 hi Error gui=none guifg=White guibg=Red hi Identifier gui=none guifg=Sienna4 hi Special gui=none guifg=RoyalBlue4 hi PreProc gui=none guifg=RoyalBlue3 hi Todo gui=bold guifg=Red guibg=Yellow hi Type gui=bold guifg=RoyalBlue4 hi Underlined gui=underline guifg=Blue hi Boolean gui=bold guifg=ForestGreen hi Constant gui=none guifg=ForestGreen hi Number gui=bold guifg=ForestGreen hi String gui=none guifg=ForestGreen hi Label gui=bold,underline guifg=Sienna4 hi Statement gui=bold guifg=Sienna4 hi htmlBold gui=bold hi htmlItalic gui=italic hi htmlUnderline gui=underline hi htmlBoldItalic gui=bold,italic hi htmlBoldUnderline gui=bold,underline hi htmlBoldUnderlineItalic gui=bold,underline,italic hi htmlUnderlineItalic gui=underline,italic :match Todo /TODO\:/ :match Todo /FIXME/ " error if tab after text :match Error /[^\t]\zs\t\+$/ " error if spaces after text :match Error /[^\t]\zs\s\+$/ " error if spaces on a line on its own (doesn't work yet) ":match Error /^\t\+$/ syntax on