Skip to content

Instantly share code, notes, and snippets.

@raelmax
Last active August 16, 2016 15:32
Show Gist options
  • Save raelmax/ca72771ba706a2399ce5 to your computer and use it in GitHub Desktop.
Save raelmax/ca72771ba706a2399ce5 to your computer and use it in GitHub Desktop.
Vim Config FIle
"""
" Vim Config File
"""
"NeoBundle Scripts-----------------------------
if has('vim_starting')
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
" Required:
call neobundle#begin(expand('~/.vim/bundle'))
" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'
" Add or remove your Bundles here:
NeoBundle 'ctrlpvim/ctrlp.vim'
NeoBundle 'flazz/vim-colorschemes'
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'gcmt/taboo.vim.git'
NeoBundle 'xolox/vim-misc'
NeoBundle 'xolox/vim-session'
NeoBundle 'bronson/vim-trailing-whitespace'
NeoBundle 'Yggdroot/indentLine'
NeoBundle 'scrooloose/syntastic'
NeoBundle 'vim-scripts/tcd.vim'
NeoBundle 'jiangmiao/auto-pairs'
NeoBundle 'cakebaker/scss-syntax.vim'
NeoBundle 'davidhalter/jedi-vim'
NeoBundle 'mileszs/ack.vim'
" You can specify revision/branch/tag.
NeoBundle 'Shougo/vimshell', { 'rev' : '3787e5' }
" Required:
call neobundle#end()
" Required:
filetype plugin indent on
" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
NeoBundleCheck
"End NeoBundle Scripts-------------------------
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set nobackup " do not keep a backup file, use versions instead
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
" 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.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" Custom Configs
" Colorscheme
" colorscheme molokai
set background=dark
colorscheme solarized
" Window Navigation
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" More natural split opening
set splitbelow
set splitright
" CTRLP Options
set wildmode=list:longest,list:full
set wildignore+=*.o,*.obj,.git,*.rbc,*.pyc,__pycache__,.idea,node_modules
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn|tox)$'
" NERDTree
" autocmd vimenter * NERDTree
let g:NERDTreeChDirMode=2
let g:NERDTreeIgnore=['\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '__pycache__', 'htmlcov', 'node_modules', '.idea', '.git']
let g:NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$']
let g:NERDTreeShowBookmarks=1
let g:nerdtree_tabs_focus_on_files=1
let g:NERDTreeMapOpenInTabSilent = '<RightMouse>'
" let g:NERDTreeWinSize = 20
map <C-n> :NERDTreeToggle<CR>
" Numbers
set number
" Disable arrow keys
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
" Disable search highlight after hit enter
nnoremap <CR> :noh<CR><CR>
" Tabs. May be overriten by autocmd rules
set tabstop=4
set softtabstop=0
set shiftwidth=4
set expandtab
" Map leader to ,
let mapleader=','
noremap <leader>b :CtrlPBuffer<CR>
" Sessions and Taboo
set sessionoptions+=tabpages,globals
set sessionoptions-=buffers
let g:session_autosave = 'no'
" Syntastic
let g:syntastic_python_checkers=['python', 'flake8']
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_python_flake8_post_args='--ignore=W391,E501 --exclude=*migrations/*'
let g:syntastic_always_populate_loc_list=1
let g:syntastic_error_symbol='✗'
let g:syntastic_warning_symbol='⚠'
let g:syntastic_style_error_symbol = '✗'
let g:syntastic_style_warning_symbol = '⚠'
let g:syntastic_auto_loc_list=1
let g:syntastic_aggregate_errors = 1
" Clipboard
set clipboard=unnamed
" Keep selection after indent
vnoremap < <gv
vnoremap > >gv
" Replace from selection
nnoremap <Leader>s :%s/\<<C-r><C-w>\>//gc<Left><Left><Left>
" Tabs
noremap <Left> :tabprev<CR>
noremap <Right> :tabnext<CR>
" Buffer Navigation
nnoremap <leader>n :bnext<CR>
nnoremap <leader>p :bprevious<CR>
" FileTypes
au BufNewFile,BufRead *.html setlocal filetype=htmldjango shiftwidth=2 tabstop=2
au BufNewFile,BufRead *.css,*.scss setlocal shiftwidth=2 tabstop=2
au BufNewFile,BufRead *.js setlocal shiftwidth=4 tabstop=4
au BufNewFile,BufRead *.py setlocal colorcolumn=80
" Jedi
let g:jedi#use_splits_not_buffers = "right"
" Remove scroolbar (macvim)
set guioptions-=L
set guioptions-=r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment