Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
vim config using vim-bundle (vundle)
" disable vi compatibility
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle
Bundle 'gmarik/vundle'
" ----------------------------------------
" Bundles here:
" Themes
" Bundle 'altercation/vim-colors-solarized'
Bundle 'junegunn/seoul256.vim'
"Bundle 'scrooloose/syntastic'
" (snipMate)
Bundle 'MarcWeber/vim-addon-mw-utils'
Bundle 'tomtom/tlib_vim'
Bundle 'garbas/vim-snipmate'
Bundle 'honza/vim-snippets'
" (end snipMate)
" VIM enhancements
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
Bundle 'Lokaltog/vim-easymotion'
Bundle 'scrooloose/nerdtree'
Bundle 'scrooloose/nerdcommenter'
Bundle 'mileszs/ack.vim'
Bundle 'davidhalter/jedi-vim'
Bundle 'szw/vim-ctrlspace'
Bundle 'xolox/vim-misc'
Bundle 'millermedeiros/vim-statline'
" vim-scripts:
Bundle 'ShowTrailingWhitespace'
Bundle ''
" Git
Bundle 'gitignore.vim'
" nginx
Bundle 'vim-scripts/nginx.vim'
" Javascript & HTML5
Bundle 'othree/html5.vim'
Bundle 'pangloss/vim-javascript'
Bundle 'elzr/vim-json'
" CofeeScript
Bundle 'kchmck/vim-coffee-script'
Bundle 'skammer/vim-css-color'
Bundle 'vim-scripts/Css-Pretty'
Bundle 'hail2u/vim-css3-syntax'
" css/less/sass/html color preview for vim
Bundle 'gorodinskiy/vim-coloresque'
" Python
Bundle 'hynek/vim-python-pep8-indent'
Bundle 'klen/python-mode'
Bundle 'jmcantrell/vim-virtualenv'
Bundle 'vim-scripts/sort-python-imports'
" Django
Bundle 'vim-scripts/django.vim'
Bundle 'vim-scripts/'
Bundle 'cwood/vim-django'
" Node.js
Bundle 'mmalecki/vim-node.js'
Bundle 'digitaltoad/vim-jade'
" Scala
Bundle 'derekwyatt/vim-scala'
" Ruby & rails
Bundle 'vim-scripts/rails.vim'
" js beautify
Bundle 'maksimr/vim-jsbeautify'
Bundle 'einars/js-beautify'
" Lua
Bundle 'xolox/vim-lua-ftplugin'
" Go Lang
Bundle 'fatih/vim-go'
" Haskell
Bundle 'jberryman/haskomplete.vim'
" Rust Lang
Bundle 'wting/rust.vim'
" Markdown
Bundle 'plasticboy/vim-markdown'
" Bundle 'Command-T' native extension segfaults
" ----------------------------------------
call vundle#end() " required
filetype plugin indent on
set encoding=utf-8
" ----------------------------------------------------------------------------
" Text Formatting
" ----------------------------------------------------------------------------
set autoindent " automatic indent new lines
set smartindent " be smart about it
inoremap # X<BS>#
" set nowrap " do not wrap lines
set softtabstop=2 " yep, two
set shiftwidth=2 " ..
set tabstop=4
set expandtab " expand tabs to spaces
set nosmarttab " fuck tabs
set formatoptions+=n " support for numbered/bullet lists
set textwidth=80 " wrap at 80 chars by default
set colorcolumn=+1 " color column 81
set virtualedit=block " allow virtual edit in visual block ..
" ----------------------------------------------------------------------------
" Remapping
" ----------------------------------------------------------------------------
" lead with ,
let mapleader = ","
" exit to normal mode with 'jj'
inoremap jj <ESC>
" exit to normal mode with ':w<CR>'
inoremap :w<CR> <ESC>:w<CR>i
" reflow paragraph with Q in normal and visual mode
nnoremap Q gqap
vnoremap Q gq
" sane movement with wrap turned on
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
nnoremap <Down> gj
nnoremap <Up> gk
vnoremap <Down> gj
vnoremap <Up> gk
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
" ----------------------------------------------------------------------------
" UI
" ----------------------------------------------------------------------------
set ruler " show the cursor position all the time
set noshowcmd " don't display incomplete commands
set nolazyredraw " turn off lazy redraw
set number " line numbers
set wildmenu " turn on wild menu
set wildmode=list:longest,full
set ch=2 " command line height
set backspace=2 " allow backspacing over everything in insert mode
" set whichwrap+=<,>,h,l,[,] " backspace and cursor keys wrap to
set shortmess=filtIoOA " shorten messages
set report=0 " tell us about changes
set nostartofline " don't jump to the start of line when scrolling
" ----------------------------------------------------------------------------
" Visual Cues
" ----------------------------------------------------------------------------
set showmatch " brackets/braces that is
set mat=5 " duration to show matching brace (1/10 sec)
set incsearch " do incremental searching
set laststatus=2 " always show the status line
set ignorecase " ignore case when searching
" set smartcase " but be case sensitive when there's uppercase chars
set hlsearch " highlight searches
set visualbell " shut the fuck up
" ---------------------------------------------------------------------------
" Strip all trailing whitespace in file
" ---------------------------------------------------------------------------
function! StripWhitespace ()
exec ':%s/ \+$//gc'
map ,s :call StripWhitespace ()<CR>
" ---------------------------------------------------------------------------
" My Settings
" ---------------------------------------------------------------------------
" filetype detection
filetype plugin on
filetype on
filetype indent on
" auto-complete
set ofu=syntaxcomplete#Complete
set completeopt=menuone,longest,preview
" Auto close the preview window
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" split and tab navigation
func! GoLeft()
let oldw = winnr()
silent! exe "normal! \<c-w>h"
let neww = winnr()
if oldw == neww
exe "normal! \gT"
func! GoRight()
let oldw = winnr()
silent! exe "normal! \<c-w>l"
let neww = winnr()
if oldw == neww
exe "normal! \gt"
" window-tab navigation
nnoremap <silent> <C-h> :call GoLeft()<CR>
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <silent> <C-l> :call GoRight()<CR>
" NERDTree
let NERDTreeQuitOnOpen = 1
let NERDTreeChDirMode=2
nnoremap <leader>n :NERDTreeToggle<CR>
nnoremap <leader>f :NERDTreeFind<CR>
" TagList
map <F3> :TlistToggle<CR>
let Tlist_GainFocus_On_ToggleOpen = 1
let Tlist_Close_On_Select = 1
let Tlist_Exit_OnlyWindow = 1
let Tlist_Inc_Winwidth = 0
let Tlist_Sort_Type = "order"
let Tlist_Show_One_File = 1
" (ctags) go to definition in a new tab
"map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
map <C-\> :tab split<CR>:exec("tjump ".expand("<cword>"))<CR>
" use currently open buffer
:se switchbuf=usetab
" avoid hidden buffers
" :se nohidden
" command-t open in new tab by default
" let g:CommandTAcceptSelectionMap='<S-CR>'
" let g:CommandTAcceptSelectionSplitMap='<C-s>'
" let g:CommandTAcceptSelectionTabMap='<CR>'
" rainbow parenthesis
" au VimEnter * RainbowParenthesesToggle " default enabled
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
au Syntax * RainbowParenthesesLoadChevrons
nnoremap <Leader>r :RainbowParenthesesToggle<CR>
" js beautify
map <c-f> :call JsBeautify()<cr>
autocmd FileType javascript noremap <buffer> <c-f> :call JsBeautify()<cr>
" ack mapping
nnoremap <Leader>a :Ack
nnoremap <Leader>/ :noh<CR>
" code folding
set foldmethod=syntax
nnoremap <Space> za
set nofoldenable " folds disabled by default
" syntax highliting
syntax on
" Unified color scheme (default: dark)
color seoul256
set background=dark
" buffer-explorer settings
nmap <Tab> <Leader>be
nmap <S-Tab> <Leader>bs
let g:bufExplorerShowRelativePath=1
" highlight trailing whitespace
highlight ShowTrailingWhitespace ctermbg=DarkRed guibg=DarkRed
" Vim-CtrlSpace Config
hi CtrlSpaceSelected term=reverse ctermfg=187 ctermbg=23 cterm=bold
hi CtrlSpaceNormal term=NONE ctermfg=244 ctermbg=232 cterm=NONE
hi CtrlSpaceSearch ctermfg=220 ctermbg=NONE cterm=bold
hi CtrlSpaceStatus ctermfg=230 ctermbg=234 cterm=NONE
" jedi-vim
let g:jedi#popup_on_dot = 0
let g:jedi#goto_assignments_command = "<leader>g"
let g:jedi#goto_definitions_command = "<leader>d"
let g:jedi#documentation_command = "K"
let g:jedi#usages_command = "<leader>n"
let g:jedi#completions_command = "<C-Space>"
let g:jedi#rename_command = "<leader>r"
let g:jedi#show_call_signatures = "1"
" vim-django
let g:django_projects = '~/repos/matagus' "Sets all projects under project
let g:django_activate_virtualenv = 1 "Try to activate the associated virtualenv
let g:django_activate_nerdtree = 1 "Try to open nerdtree at the project root.
" syntastic
let g:syntastic_auto_loc_list=1
" plasticboy/vim-markdown
let g:vim_markdown_folding_disabled=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment