Skip to content

Instantly share code, notes, and snippets.

@mbbx6spp
Created August 31, 2010 20:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbbx6spp/559741 to your computer and use it in GitHub Desktop.
Save mbbx6spp/559741 to your computer and use it in GitHub Desktop.
Start configuration for vim for new shell accounts. this starter config depends on the following Vim plugins: rails, pathogen, vimchat, sessionman, bufexplorer, fuzzy finder, NERDTree, gist. Primary development languages: Erlang, Haskell, Ruby, Zsh scrip
" Author: Susan Potter
" Using ~/.vim/supo as placeholder initialization VimScripts location.
" Didn't want to use ~/.vim/init in case init had or starts to have special meaning for Vim plugins or loading.
source $HOME/.vim/supo/global.vim
source $HOME/.vim/supo/functions.vim
" Author: Susan Potter
" Opens session and NERDTree bookmark of same Name argument
" i.e. requires that session and bookmark have same name!
function LoadProject(Name)
exec 'SessionOpen '.a:Name
exec 'NERDTreeFromBookmark '.a:Name
endfunction
" Author: Susan Potter
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
set paste
set viminfo^=!
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" store lots of :cmdline history
set history=1000
set showcmd "show incomplete cmds down the bottom
set showmode "show current mode down the bottom
set incsearch "find the next match as we type the search
set hlsearch "hilight searches by default
set ignorecase "ignore case in search...
set smartcase "except when using caps in the search
set nowrap "dont wrap lines
set linebreak "wrap lines at convenient points
set whichwrap+=<,>,[,]
"set selection=exclusive
"set selectmode=mouse,key
"set mousemodel=popup
"set keymodel=startsel,stopsel
set cf " Enable error files & error jumping.
set clipboard+=unnamed " Yanks go on clipboard instead.
set autowrite " Writes on make/shell commands
set ruler " Ruler on
set nu " Line numbers on
set timeoutlen=250 " Time to wait after ESC (default causes an annoying delay)
" Formatting (some of these are for coding in C and C++)
set ts=2 " Tabs are 2 spaces
set bs=2 " Backspace over everything in insert mode
set shiftwidth=2 " Tabs under smart indent
set nocp incsearch
set cinoptions=:0,p0,t0
set cinwords=if,else,while,do,for,switch,case
set formatoptions=tcqr
set cindent
set autoindent
set smarttab
set expandtab
" Visual
set showmatch " Show matching brackets.
set mat=5 " Bracket blinking.
set list
" Show $ at end of line and trailing space as ~
set lcs=tab:\ \ ,eol:$,trail:~,extends:>,precedes:<
" No blinking .
set novisualbell
set noerrorbells " No noise.
set laststatus=2 " Always show status line.
" gvim specific
set mousehide " Hide mouse after chars typed
set mouse=a " Mouse in all modes
" Backups & Files
set backup " Enable creation of backup file.
set backupdir=~/.vim/backups " Where backups will go.
set directory=~/.vim/tmp " Where temporary files will go.
" statusline setup
set statusline=%f "tail of the filename
" requires fugitive plugin to be installed - remove if you don't use Git or fugitive
set statusline+=%{fugitive#statusline()}
" display a warning if fileformat isnt unix
set statusline+=%#warningmsg#
set statusline+=%{&ff!='unix'?'['.&ff.']':''}
set statusline+=%*
" display a warning if file encoding isnt utf-8
set statusline+=%#warningmsg#
set statusline+=%{(&fenc!='utf-8'&&&fenc!='')?'['.&fenc.']':''}
set statusline+=%*
set statusline+=%h "help file flag
set statusline+=%y "filetype
set statusline+=%r "read only flag
set statusline+=%m "modified flag
" display a warning if &et is wrong, or we have mixed-indenting
set statusline+=%#error#
" a whole bunch of other statusline appendages totally dependent on my code.
" display a warning if &paste is set
set statusline+=%#error#
set statusline+=%{&paste?'[paste]':''}
set statusline+=%*
set statusline+=%= "left/right separator
set statusline+=%{StatuslineCurrentHighlight()}\ \ "current highlight
set statusline+=%c, "cursor column
set statusline+=%l/%L "cursor line/total lines
set statusline+=\ %P "percent through file
set laststatus=2
" indent settings
set shiftwidth=2
set softtabstop=2
set expandtab
" folding settings
set foldmethod=indent "fold based on indent
set foldnestmax=1 "deepest fold is 3 levels
set foldenable "fold by default
set wildmode=list:longest "make cmdline tab completion similar to bash
set wildmenu "enable ctrl-n and ctrl-p to scroll thru matches
set wildignore=*.o,*.obj,*~ "stuff to ignore when tab completing
" display tabs and trailing spaces
set list
set listchars=tab:\ \ ,extends:>,precedes:<
set formatoptions-=o "dont continue comments when pushing o/O
" vertical/horizontal scroll off settings
set scrolloff=3
set sidescrolloff=7
set sidescroll=1
filetype plugin indent on
"some stuff to get the mouse going in term
set ttymouse=xterm2
"tell the term has 256 colors
set t_Co=256
"hide buffers when not displayed
set hidden
" Minibuffer Explorer Settings
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
" Change which file opens after executing :Rails command
let g:rails_default_file='config/application.rb'
syntax enable
" Plugin dependent integration {{{
" Pathogen integration
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
" Setup VimChat settings
let g:vimchat_statusicon = 0
let g:vimchat_buddylistwidth = 35
" setup gist plugin settings
let g:gist_browser_command = 'w3m %URL%'
let g:gist_clip_command = 'xclip -selection clipboard'
let g:gist_detect_filetype = 1
let g:gist_open_browser_after_post = 1
" NERDTree settings
let g:NERDTreeChDirMode = '2'
nmap <silent> <F9> :NERDTreeToggle<CR>
nmap <S-F9> :call LoadProject(input("Project name? "))<CR>
" Session settings
nmap <C-S> :SessionList<CR>
"make <c-l> clear the highlight as well as redraw
nnoremap <C-L> :nohls<CR><C-L>
inoremap <C-L> <C-O>:nohls<CR>
"map to bufexplorer
nnoremap <C-B> :BufExplorer<CR>
"map to fuzzy finder text mate stylez
nnoremap <C-F> :FuzzyFinderFile<CR>
" }}}
"map Q to something useful
noremap Q gq
"make Y consistent with C and D
nnoremap Y y$
"mark syntax errors with :signs
let g:syntastic_enable_signs=1
:colorscheme desert
" TaskList keybindings
map <F3> <Esc>:TaskList<CR>
" alt+n or alt+p to navigate between entries in QuickFix
map <silent> <M-p> <Esc>:cp<CR>
map <silent> <M-n> <Esc>:cn<CR>
" key bindings
" for tabs
map <C-Tab> <Esc>:tabn<CR>
map <C-S-Tab> <Esc>:tabp<CR>
map <C-S-N> <Esc>:tabnew<CR>
" Tab indenting sections of code
vmap <Tab> >gv
vmap <S-Tab> <gv
" Make highlighted area middle of screen for certain verbs/actions
nnoremap n nzz
nnoremap N Nzz
nnoremap * *zz
nnoremap # #zz
nnoremap g* g*zz
nnoremap g# g#zz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment