Skip to content

Instantly share code, notes, and snippets.

@davidjbeveridge
Created March 10, 2014 16:44
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 davidjbeveridge/9468751 to your computer and use it in GitHub Desktop.
Save davidjbeveridge/9468751 to your computer and use it in GitHub Desktop.
if has('vim_starting')
set nocompatible " Be iMproved
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
call neobundle#rc(expand('~/.vim/bundle/'))
" Let NeoBundle manage NeoBundle
NeoBundleFetch 'Shougo/neobundle.vim'
" Recommended to install
" After install, turn shell ~/.vim/bundle/vimproc, (n,g)make -f your_machines_makefile
" NeoBundle 'Shougo/vimproc'
" NeoBundle 'tpope/vim-fugitive'
" NeoBundle 'Lokaltog/vim-easymotion', '09c0cea8' " This plugin is locked at revision 09c0cea8
" NeoBundle 'rstacruz/sparkup', {'rtp': 'vim/'}
" vim-scripts repos
" NeoBundle 'L9'
" NeoBundle 'FuzzyFinder'
" NeoBundle 'rails.vim'
NeoBundle 'scrooloose/nerdcommenter'
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'kchmck/vim-coffee-script'
NeoBundle 'altercation/vim-colors-solarized'
NeoBundle 'dag/vim-fish'
NeoBundle 'derekwyatt/vim-scala'
NeoBundle "MarcWeber/vim-addon-mw-utils"
NeoBundle "tomtom/tlib_vim"
NeoBundle "garbas/vim-snipmate"
NeoBundle "honza/vim-snippets"
NeoBundle "scrooloose/syntastic"
NeoBundle "bling/vim-airline"
NeoBundle "mmozuras/snipmate-mocha"
NeoBundle "jamescarr/snipmate-nodejs"
NeoBundle "mileszs/ack.vim"
NeoBundle "groenewege/vim-less"
NeoBundle "slim-template/vim-slim"
NeoBundleLazy 'jelera/vim-javascript-syntax', {'autoload':{'filetypes':['javascript']}}
" Non github repos
NeoBundle 'git://git.wincent.com/command-t.git'
" gist repos
" NeoBundle 'gist:Shougo/656148', {
" \ 'name': 'everything.vim',
" \ 'script_type': 'plugin'}
filetype plugin indent on " Required!
" set shell to something POSIX-compliant:
if &shell =~# 'fish$'
set shell=sh
endif
" set leader key to ','
let mapleader=","
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file
endif
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")
" Don't use Ex mode, use Q for formatting
map Q gq
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
" And enable vim-colors-solarized
if &t_Co > 2 || has("gui_running")
set hlsearch
set background=dark
colorscheme solarized
syntax on
endif
"map C-l to clear last search
:noremap <silent> <c-l> :nohls<cr><c-l>
" enable line numbers by default
set number
" use 2 spaces for indentation by default
set shiftwidth=2
set tabstop=2
set softtabstop=2
" make "tab" insert indents instead of tabs at the beginning of a line
set smarttab
" don't turn 8 spaces into tabs
set expandtab
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" 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
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
" Also don't do it when the mark is in the first line, that is the default
" position when opening a file.
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
" Strip the newline from the end of a string
function! Chomp(str)
return substitute(a:str, '\n$', '', '')
endfunction
set backupdir=~/tmp
" Disasble arrow keys in vim
map <Left> <Nop>
map <Right> <Nop>
map <Up> <Nop>
map <Down> <Nop>
" Toggle NERDTree on Leader+n
map <Leader>n :NERDTreeToggle<CR>
" strip trailing spaces on Leader+qq
map <Leader>qq :%s/[\t ]\+$//g<CR>
" ignore files:
set wildignore+=node_modules
set wildignore+=bower_components
set wildignore+=target
set wildignore+=*.min.*
set wildignore+=*.class
set wildignore+=*.so
" turn on line guide at 80 chars
set colorcolumn=81,161,241,321,401,481
" autowrap at 80 chars
set textwidth=80
set wrapmargin=2
" Syntastic settings:
" Syntax checkers for Syntastic
let g:syntastic_coffee_coffeelint_args = "--csv"
" enable Powerline fonts (for Airline)
let g:airline_powerline_fonts = 1
" use :C<line number> to jump to CoffeeScript line #, given a JS line #
command -nargs=1 C CoffeeCompile | :<args>
" Compile CoffeeScript w/ <Leader>C
vmap <leader>C <esc>:'<,'>:CoffeeCompile<CR>
map <leader>C :CoffeeCompile<CR>
" Select all with alt-a
nnoremap <leader>a ggVG
vnoremap <leader>a <Esc>ggVG
" remap jk to exit normal mode
inoremap ii <Esc>
map <leader>w :w<CR>
map <leader>q :q<CR>
map <leader>r :source! $MYVIMRC<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment