Please bear with us as we work to restore functionality to dotfiles.org.
" vimrc file based on the system-wide vimrc file for Mac OS X
" Original author: Benji Fisher
" Last modified: 8 May 2006
" TODO: Is there a better way to tell that Vim.app was started from Finder.app?
" Note: Do not move this to the gvimrc file, else this value of $PATH will
" not be available to plugin scripts.
if has("gui_running") && system('ps xw | grep "Vim -psn" | grep -vc grep') > 0
" Get the value of $PATH from a login shell.
" If your shell is not on this list, it may be just because we have not
" tested it. Try adding it to the list and see if it works. If so,
" please post a note to the vim-mac list!
if $SHELL =~ '/\(sh\|csh\|bash\|tcsh\|zsh\)$'
let s:path = system("echo echo VIMPATH'${PATH}' | $SHELL -l")
let $PATH = matchstr(s:path, 'VIMPATH\zs.\{-}\ze\n')
endif
endif
:fixdel
" Maximize window size vertically if running on GUI
if has("gui_running")
set lines=57 columns=100
endif
" Use highlights for searching
set hlsearch
" Default tab settings
set tabstop=4
set shiftwidth=4
set expandtab
set softtabstop=4
" Multiple-window mode
map j_
map k_
set wmh=0
" Incremental search
set incsearch
" Syntax highlighting
syntax on
" Show matching brackets
set showmatch
" Auto-indent for programming
set autoindent
" No-compatibility mode
set nocompatible
" Visual bell
set vb
" Do not put CR at the end of the last line
set binary noeol
" Backspace handling
set backspace=indent,eol,start
" Completion mode
set wildmode=longest,list,full
" Use modelines
set modeline
" Search in the first five lines for modelines
set modelines=5
" Remember information between vim restarts
set viminfo='200,<300,s150,%,h,!
" Use arrow keys inside wrapped lines
map gk
map gj
" Auto-complete
" =============
" Don't scan include files
set complete-=i
" Turn on wild menu
set wildmenu
" File-related stuff
" ==================
" Support all three CR formats
set fileformats=unix,dos,mac
" Detect the type of file and enable filetype-specific indenting
filetype plugin indent on
" Start the visual/selection mode with Shift+Arrows
set keymodel=startsel
" GUI-related stuff
" =================
" No toolbar
set guioptions-=T
" No autoselect
set guioptions-=a
" Use consolse messages instead of GUI dialogs
set guioptions+=c
" Show line numbers
" set number
" Ruler format
set ruler
set rulerformat=%25(%n%m%r:\ %Y\ [%l,%v]\ %p%%%)
" Minimal number of lines above/below cursor
set scrolloff=3
" Shorter messages
set shortmess=asI
" Show command in status line
set showcmd
" Status line format:
" {buffer number}: {file name, relative path to the current working directory}{modified flag}{readonly flag}
" {help flag}{preview flag} [file type, encoding, format] [current line-total lines, current column][position percentage in file]
set statusline=%n:\ %f%m%r%h%w\ [%Y,%{&fileencoding},%{&fileformat}]\ [%l-%L,%v][%p%%]
" Set fast TTY
set ttyfast
" Do not redraw while running macros (much faster).
set lazyredraw
" What to show when you do :set list.
set listchars=tab:\|\ ,trail:.,extends:>,precedes:<,eol:$
" Code folding
" ============
set foldenable
" Fold column width
set foldcolumn=1
" Make folding indent sensitive
set foldmethod=indent
" Folds with a higher level will be closed automatically
set foldlevel=4
if has("autocmd")
" Automatically change to the directory of the current buffer
autocmd BufEnter * :cd %:p:h
" autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
autocmd BufRead *.py set ts=4
autocmd BufRead *.py set shiftwidth=4
autocmd BufRead *.py set expandtab
autocmd BufRead *.py syntax match Error "\(^ *\)\@<=\t\+"
autocmd BufRead *.c set smartindent
autocmd BufRead *.h set smartindent
autocmd BufRead *.cpp set smartindent
autocmd BufRead *.hpp set smartindent
endif
" LaTeX invocation
map ,rl :!pdflatex % && pdflatex %
" Switch between header/source
map :A