" Map the cursor keys to their corresponding actions imap [D imap [C imap [A imap [B " Add <> to % matching set matchpairs=(:),{:},[:],<:> " Set background = dark makes all colors show up brighter " Also, set syntax on whenever possible set background=dark syntax on " See :help cpo for flags-explanation " $ is that when you do cw on a word, a $ appears at the end an you " can type over the word. All the others are vim-default. See help. set cpo=aABceFs$ " Do not auto wrap lines " Set the size of a tab to match 4 spaces " Set backspace type as 2 " Fixes shit like not being able to bs another line " as the line you are editing... set nowrap set tabstop=4 set bs=2 " When searching highlight and keep highlighted, the words you search for set hlsearch set incsearch set ignorecase " When reading files or doing actions on files, press TAB to show a " browseable menu set wildmenu " Enable filetype plugins so auto-wrapping works for mail and such but " DISable the indenting plugin, cause it suxx ass. filetype plugin on filetype indent off set ai " Often .tmpl files are .html files, so use same syntax for .tmpl : augroup HTMLTemplates : autocmd! : autocmd BufRead,BufNewFile *.tmpl :so $VIMRUNTIME/syntax/html.vim : augroup END " Same goes for tt files (Template Toolkit) : augroup HTMLTemplates : autocmd! : autocmd BufRead,BufNewFile *.tt :so $VIMRUNTIME/syntax/html.vim : augroup END " Justify the full message from begin sig to top of msg map G?^-- $V1G/^$gq " Justify the alinea from current cursor position till end of alinea map ?^$V/^$gq:sil noh " Change signature if it is too offending :) map G?^-- $VGx:r!/usr/games/fortune ~/.sigs/sigs:sil noh " Unhilight any hlsearches (want this as toggle, actually, on a Fn key) map :sil noh " Let toggle paste mode versus nopase mode set pastetoggle= " automatically give executable permissions to certain files " au BufWritePost *.pl,*.cgi,*.sh :silent !chmod 755 " automatically insert shebangs in certain files au BufEnter *.sh if getline(1) == "" | :call setline(1, "#!/bin/sh") | endif au BufEnter *.pl,*.cgi if getline(1) == "" | :call setline(1, "#!/usr/bin/perl -w") | endif " When editing a perl file you can use perl's built-in keyword definition mapping (capital K == shift+k) when under a perl function or module to see it's POD. au BufEnter *.pl,*.pm,*.cgi let oldkp=&kp | set keywordprg=perl\ -e\ $c=shift;exec\"perldoc\".($c=~/^[a-z]+$/?\"\ -f\ \":\"\ -f\ \").$c' au BufLeave *.pl,*.pm,*.cgi let &keywordprg=oldkp " Sets a statusline (see :help statusline for format) " Enables statusline display " Defines colours for User1..9 groups (corresponds to numbers in set statusline...) set laststatus=2 set statusline=%1*%<%F%h%m%r%h%w%y\ %2*%{&ff}%=\ %3*a:%b\ %4*p:%o\ %5*c:%c%V\ %6*l:%l\/%L\ %7*%P hi User1 ctermfg=White ctermbg=DarkBlue hi User2 ctermfg=White ctermbg=DarkBlue hi User3 ctermfg=White ctermbg=DarkBlue hi User4 ctermfg=White ctermbg=DarkBlue hi User5 ctermfg=White ctermbg=DarkBlue hi User6 ctermfg=White ctermbg=DarkBlue hi User7 ctermfg=White ctermbg=DarkBlue hi User8 ctermfg=White ctermbg=DarkBlue hi User9 ctermfg=White ctermbg=DarkBlue " Press to check syntax with Perl! map :!perl -cw % " Turns on digraphs. " Type ', backspace, e and get é " set dg " Quotes unquoted HTML tag properties throughout buffer. " map :%s/\([^&^?]\)\(\<[[:alnum:]-]\{-}\)=\([[:alnum:]-#%]\+\)/\1\2="\3"/g