~ doo
/.vimrc
my Vimrc, lifted from dotfiles, and hacked a touch.
" Options {{{
" Run in vim compatible mode (newer options and behavior).
set nocompatible
" Set color scheme (mine is a slight variation of default)
colorscheme desert
" Enable coloring for dark background terminals.
set background=dark
" Enable syntax highlighting and coloring.
syntax enable
syn sync fromstart
" Enable filetype detection, plugins, and indention.
filetype plugin indent on
" Source filetype plugins.
" The ! indicates sourcing all vs just the 1st found.
"runtime! ftdetect/*.vim
" Set grep to always display the filename.
"set grepprg=grep\ -nH\ $*
" On win32, use shellslash
"set shellslash
" Begin searching while typing.
set incsearch
" Ignore case while searching.
set ignorecase
" Use intelligent case while searching.
" If search string contains an upper case letter, disable ignorecase.
set smartcase
" Insert spaces for tabs according to shiftwidth.
set smarttab
" Use indent from current line when starting a new one.
set autoindent
" Use smart indenting when starting a new line.
set smartindent
" Don't use c style indenting.
set nocindent
" Highlight search results in buffer.
set hlsearch
" Expand tabs to spaces.
set expandtab
" Number of spaces that a tab counts for.
set tabstop=4
" Number of spaces to use for each step of indent.
set shiftwidth=4
" Allow backspace over ...
set backspace=indent,eol,start
" Strings to use in list mode.
"set listchars=tab:>-,extends:>,precedes:<,trail:-,nbsp:%,eol:$
" Break lines at the nearest word boundary.
set linebreak
" Enable line wrapping.
set wrap
" When closing a block, show the matching bracket.
set showmatch
" Include angle brackets in matching.
set matchpairs+=<:>
" Do not redraw the screen while macros are running.
set lazyredraw
" Backup files.
"set backup
" ... and back them up here (1st one that exists, wins).
"set backupdir=~/.vim/backup,.
" Save files before performing certain actions.
set autowrite
" Show current mode in the status line.
set showmode
" Show the command in the status line.
set showcmd
" Start scrolling at this number of lines from the bottom.
set scrolloff=2
" Start scrolling horizontally at this number of columns.
set sidescrolloff=5
" Status line takes up this many lines.
" Make the status line always visible.
set laststatus=2
" Always show the ruler.
set ruler
" Indicates a fast terminal connection.
set ttyfast
" Enables wildmenu tab completion.
set wildmenu
" Type of wildmenu.
set wildmode=longest:full,list:full
" Massively detailed viminfo file.
set viminfo='500,f1,:100,/100
" Look for embedded modelines at the top of the file.
set modeline
" Only look at this number of lines for modeline
set modelines=10
" Try to detect file formats.
" Unix for new files and autodetect for the rest.
set fileformats=unix,dos,mac
" Command history size.
set history=50
" Disable the splash screen (and some various tweaks for messages).
set shortmess=aTItoO
" Enable the mouse.
"set mouse=a
" Hide the mouse while typing.
"set mousehide
" Enable the popup menu.
"set mousem=popup
" Split vertically to the right.
set splitright
" Split horizontally below.
set splitbelow
" Status line definition.
set statusline=[%n]\ %<%f%m%r\ %w\ %y\ \ <%{&fileformat}>%=[%o]\ %l,%c%V\/%L\ \ %P
" Set folding method.
" =marker means to use an embedded tag to define the fold boundaries.
"set foldmethod=marker
" Disable the beeping.
set noerrorbells
" Set the terminal window title.
set title
" }}}
"
augroup JumpCursorOnEdit
au!
autocmd BufReadPost *
\ if expand("<afile>:p:h") !=? $TEMP |
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ let JumpCursorOnEdit_foo = line("'\"") |
\ let b:doopenfold = 1 |
\ if (foldlevel(JumpCursorOnEdit_foo) > foldlevel(JumpCursorOnEdit_foo - 1)) |
\ let JumpCursorOnEdit_foo = JumpCursorOnEdit_foo - 1 |
\ let b:doopenfold = 2 |
\ endif |
\ exe JumpCursorOnEdit_foo |
\ endif |
\ endif
" Need to postpone using "zv" until after reading the modelines.
autocmd BufWinEnter *
\ if exists("b:doopenfold") |
\ exe "normal zv" |
\ if(b:doopenfold > 1) |
\ exe "+".1 |
\ endif |
\ unlet b:doopenfold |
\ endif
augroup END