Skip to content

Instantly share code, notes, and snippets.

@jasonporritt
Created July 22, 2010 18:27
Show Gist options
  • Save jasonporritt/486381 to your computer and use it in GitHub Desktop.
Save jasonporritt/486381 to your computer and use it in GitHub Desktop.
set guifont=Monospace\ 10
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set shiftround " Shift to the next round tab stop
set wrap
set linebreak
set autoindent
"==================================================
" From Andy Lester's .vimrc...
"--------------------------------------------------
"============================================================================
" General settings
"----------------------------------------------------------------------------
set nocompatible " nocp: turn of vi compatibility
set undolevels=1000 " ul: lots and lots of undo
set modelines=20
set modeline " ml: Turn on modelines
set ai " always set autoindenting on
"set backup " keep a backup file
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
"============================================================================
" Presentation
"----------------------------------------------------------------------------
set shortmess=aIoO " sm: really short messages, don't show intro
"set showmode " smd: show the current input mode
"set more " more: page on extended output
set errorbells " eb: ring bell on error messages
set novisualbell " novb: turn of visual bell
set noequalalways " noea: don't always keep windows at equal size
set splitbelow " sb: splitted window appears below current one
colorscheme jason
"============================================================================
" Statusline, Ruler
"----------------------------------------------------------------------------
"set laststatus=2 " ls: always put a status line
"set statusline=%([%-n]%y\ %f%M%R%)\ %=\ %(%l,%c%V\ %P\ [0x%02.2B]%)
"============================================================================
" Filename Autocompletion
"----------------------------------------------------------------------------
set wildchar=<Tab> " wc: tab does autocompletion
set wildmode=longest,list " wim: bash-style autocompletion
" wig: when autocompleting, ignore certain files
set wildignore=*~,#*#,*.sw?,*.o,*.class,*.java.html,*.cgi.html,*.html.html,.viminfo,*.pdf
"============================================================================
" Search and Replace
"----------------------------------------------------------------------------
set incsearch " is: show partial matches as search is entered
set hlsearch " hls: highlight search patterns
"set ignorecase " Ignore case distinction when searching
"set smartcase " ... unless there are capitals in the search string.
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
"============================================================================
" Autocommands
"----------------------------------------------------------------------------
" *.t files are Perl test files
au FileType pl,pm,t set filetype=perl
au FileType conf set filetype=apache
autocmd FileType text call TextMode()
autocmd FileType mail call TextMode()
au BufNewFile,BufRead *.pl,*.pm,*.t setf perl
au BufNewFile,BufRead *.pmc,*.ops setf c
au BufNewFile,BufRead *.tt,*.ttml setf tt2html
autocmd FileType perl call PerlMode()
autocmd FileType perl :noremap K :!perldoc <cword>
\ <bar><bar> perldoc -f <cword><cr>
set showmatch " show matches on parens, bracketc, etc.
set matchpairs+=<:>
" Suffixes that get lower priority when doing tab completion for filenames.
" These are files we are not likely to want to edit or read.
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
"============================================================================
" Functions
"----------------------------------------------------------------------------
function! TextMode() " Stolen from David Hand
set nocindent " nocin: don't use C-indenting
set nosmartindent " nosi: don't "smart" indent, either
set autoindent " ai: indent to match previous line
set noshowmatch " nosm: don't show matches on parens, brackets, etc.
set comments=n:>,n:#,fn:- " com: list of things to be treated as comments
set textwidth=72 " tw: wrap at 72 characters
set formatoptions=tcrq " fo: word wrap, format comments
set dictionary+=/usr/local/dict/* " dict: dict for word completion
set complete=.,w,b,u,t,i,k " cpt: complete words
endfunction
function! PerlMode() " Stolen from David Hand
set shiftwidth=4 " sw: a healthy tab stop
set textwidth=72 " tw: wrap at 72 characters
set autoindent " ai: indent to match previous line
set cindent " cin: Use C-indenting
set cinkeys=0{,0},!^F,o,O,e " cink: Perl-friendly reindent keys
set cinoptions=t0,+4,(0,)60,u0,*100 " cino: all sorts of options
set cinwords=if,else,while,do,for,elsif,sub
set comments=n:# " com: Perlish comments
set formatoptions=crql " fo: word wrap, format comments
set nosmartindent " nosi: Smart indent useless when C-indent is on
set showmatch " show matches on parens, bracketc, etc.
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment