Created
August 15, 2013 18:54
-
-
Save jinie/6243645 to your computer and use it in GitHub Desktop.
.vimrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved | |
filetype on "Avoid errors on close | |
filetype off " required! | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
" Bundles {{{- | |
" let Vundle manage Vundle | |
" required! | |
Bundle 'gmarik/vundle' | |
Bundle 'tpope/vim-fugitive' | |
Bundle 'Lokaltog/vim-easymotion' | |
Bundle 'tpope/vim-rails.git' | |
Bundle 'L9' | |
Bundle 'FuzzyFinder' | |
" non github repos | |
Bundle 'git://git.wincent.com/command-t.git' | |
" Python and PHP Debugger | |
" Bundle 'fisadev/vim-debug.vim' | |
" Better file browser | |
Bundle 'scrooloose/nerdtree' | |
" Code commenter | |
Bundle 'scrooloose/nerdcommenter' | |
" Syntax checking | |
Bundle 'scrooloose/syntastic' | |
" Class/module browser | |
Bundle 'majutsushi/tagbar' | |
" Code and files fuzzy finder | |
Bundle 'kien/ctrlp.vim' | |
" Powerline | |
Bundle 'Lokaltog/vim-powerline' | |
" Surround | |
Bundle 'tpope/vim-surround' | |
" Autoclose | |
Bundle 'Townk/vim-autoclose' | |
" Indent text object | |
Bundle 'michaeljsmith/vim-indent-object' | |
" Python mode (indentation, doc, refactor, lints, code checking, motion and | |
" operators, highlighting, run and ipdb breakpoints) | |
Bundle 'klen/python-mode' | |
" Snippets manager (SnipMate), dependencies, and snippets repo | |
Bundle 'MarcWeber/vim-addon-mw-utils' | |
Bundle 'tomtom/tlib_vim' | |
Bundle 'honza/vim-snippets' | |
Bundle 'garbas/vim-snipmate' | |
Bundle 'scrooloose/snipmate-snippets' | |
Bundle 'plasticboy/vim-markdown' | |
Bundle 'croaker/mustang-vim' | |
Bundle 'vim-scripts/vim-python-virtualenv' | |
" Autocompletion | |
Bundle 'AutoComplPop' | |
" Python code checker | |
Bundle 'pyflakes.vim' | |
" Search results counter | |
Bundle 'IndexedSearch' | |
" XML/HTML tags navigation | |
Bundle 'matchit.zip' | |
" Gvim colorscheme | |
"Bundle 'Wombat' | |
" Yank history navigation | |
Bundle 'YankRing.vim' | |
Bundle 'mhinz/vim-signify' | |
Bundle 'vim-ruby/vim-ruby' | |
Bundle 'davidhalter/jedi-vim' | |
Bundle 'ervandew/supertab' | |
Bundle 'vim-scripts/autoproto.vim' | |
Bundle 'keyworks/vim-lodgeit' | |
Bundle 'tsaleh/vim-matchit' | |
" Bundle 'fholgado/minibufexpl.vim' | |
Bundle 'vim-scripts/pep8' | |
" vim org-mode | |
Bundle 'jceb/vim-orgmode' | |
" webapi-vim | |
Bundle 'mattn/webapi-vim' | |
" vim-gist | |
Bundle 'mattn/gist-vim' | |
" Settings {{{- | |
filetype plugin indent on " required! | |
" tabs and spaces handling | |
set expandtab | |
set tabstop=4 | |
set softtabstop=4 | |
set shiftwidth=4 | |
" tablength exceptions | |
autocmd FileType html setlocal shiftwidth=2 tabstop=2 | |
autocmd FileType htmldjango setlocal shiftwidth=2 tabstop=2 | |
autocmd FileType javascript setlocal shiftwidth=2 tabstop=2 | |
" always show status bar | |
set ls=2 | |
" incremental search | |
set incsearch | |
" highlighted search results | |
set hlsearch | |
map <F2> :nohl<CR> | |
" line numbers | |
set nu | |
" toggle Tagbar display | |
map <silent> <F4> :TagbarToggle<CR> | |
" autofocus on Tagbar open | |
let g:tagbar_autofocus = 1 | |
" NERDTree (better file browser) toggle | |
map <F3> :NERDTreeToggle<CR> | |
" tab navigation | |
map tn :tabn<CR> | |
map tp :tabp<CR> | |
map tm :tabm | |
map tt :tabnew | |
map ts :tab split<CR> | |
map <C-S-Right> :tabn<CR> | |
imap <C-S-Right> <ESC>:tabn<CR> | |
map <C-S-Left> :tabp<CR> | |
imap <C-S-Left> <ESC>:tabp<CR> | |
" navigate windows with meta+arrows | |
"map <M-Right> <c-w>l | |
"map <M-Left> <c-w>h | |
"map <M-Up> <c-w>k | |
"map <M-Down> <c-w>j | |
"imap <M-Right> <ESC><c-w>l | |
"imap <M-Left> <ESC><c-w>h | |
"imap <M-Up> <ESC><c-w>k | |
"imap <M-Down> <ESC><c-w>j | |
" automatically close autocompletion window | |
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif | |
autocmd InsertLeave * if pumvisible() == 0|pclose|endif | |
" old autocomplete keyboard shortcut | |
imap <C-J> <C-X><C-O> | |
" save as sudo | |
ca w!! w !sudo tee "%" | |
" colors and settings of autocompletion | |
highlight Pmenu ctermbg=4 guibg=LightGray | |
" highlight PmenuSel ctermbg=8 guibg=DarkBlue guifg=Red | |
" highlight PmenuSbar ctermbg=7 guibg=DarkGray | |
" highlight PmenuThumb guibg=Black | |
" debugger keyboard shortcuts | |
map <F5> :Dbg over<CR> | |
map <F6> :Dbg into<CR> | |
map <F7> :Dbg out<CR> | |
map <F8> :Dbg here<CR> | |
map <F9> :Dbg break<CR> | |
map <F10> :Dbg watch<CR> | |
map <F11> :Dbg down<CR> | |
map <F12> :Dbg up<CR> | |
" CtrlP (new fuzzy finder) | |
let g:ctrlp_map = ',e' | |
nmap ,g :CtrlPBufTag<CR> | |
nmap ,G :CtrlPBufTagAll<CR> | |
nmap ,f :CtrlPLine<CR> | |
nmap ,m :CtrlPMRUFiles<CR> | |
" to be able to call CtrlP with default search text | |
function! CtrlPWithSearchText(search_text, ctrlp_command_end) | |
execute ':CtrlP' . a:ctrlp_command_end | |
call feedkeys(a:search_text) | |
endfunction | |
" CtrlP with default text | |
nmap ,wg :call CtrlPWithSearchText(expand('<cword>'), 'BufTag')<CR> | |
nmap ,wG :call CtrlPWithSearchText(expand('<cword>'), 'BufTagAll')<CR> | |
nmap ,wf :call CtrlPWithSearchText(expand('<cword>'), 'Line')<CR> | |
nmap ,we :call CtrlPWithSearchText(expand('<cword>'), '')<CR> | |
nmap ,pe :call CtrlPWithSearchText(expand('<cfile>'), '')<CR> | |
nmap ,wm :call CtrlPWithSearchText(expand('<cword>'), 'MRUFiles')<CR> | |
" Don't change working directory | |
let g:ctrlp_working_path_mode = 0 | |
" Ignore files on fuzzy finder | |
let g:ctrlp_custom_ignore = { | |
\ 'dir': '\v[\/](\.git|\.hg|\.svn)$', | |
\ 'file': '\.pyc$\|\.pyo$', | |
\ } | |
" Ignore files on NERDTree | |
let NERDTreeIgnore = ['\.pyc$', '\.pyo$'] | |
" simple recursive grep | |
command! -nargs=1 RecurGrep lvimgrep /<args>/gj ./**/*.* | lopen | set nowrap | |
command! -nargs=1 RecurGrepFast silent exec 'lgrep! <q-args> ./**/*.*' | lopen | |
nmap ,R :RecurGrep | |
nmap ,r :RecurGrepFast | |
nmap ,wR :RecurGrep <cword><CR> | |
nmap ,wr :RecurGrepFast <cword><CR> | |
" python-mode settings | |
" Load the whole plugin | |
"let g:pymode = 1 | |
" Load run code plugin | |
let g:pymode_run = 1 | |
" Key for run python code | |
let g:pymode_run_key = '<leader>r' | |
" Load pylint code plugin | |
let g:pymode_lint = 1 | |
let g:pymode_lint_checker = "pyflakes,pep8,mccabe" | |
" Check code every save | |
let g:pymode_lint_write = 0 | |
" Load rope plugin | |
let g:pymode_rope = 0 | |
" Enable python folding | |
let g:pymode_folding = 0 | |
" Enable python objects and motion | |
let g:pymode_motion = 1 | |
" Auto fix vim python paths if virtualenv enabled | |
let g:pymode_virtualenv = 1 | |
" Set default pymode python options | |
let g:pymode_options = 1 | |
let g:pep8_map='-leader>8' | |
" rope (from python-mode) settings | |
nmap ,d :RopeGotoDefinition<CR> | |
nmap ,D :tab split<CR>:RopeGotoDefinition<CR> | |
nmap ,o :RopeFindOccurrences<CR> | |
" don't let pyflakes allways override the quickfix list | |
let g:pyflakes_use_quickfix = 0 | |
" colors for gvim | |
"" colorscheme Mustang | |
colorscheme zenburn | |
" minibufexpl | |
" let g:miniBufExplMapWindowNavVim = 1 | |
" let g:miniBufExplMapWindowNavArrows = 1 | |
" let g:miniBufExplMapCTabSwitchBufs = 1 | |
" let g:miniBufExplModSelTarget = 1 | |
" :MiniBufExplorer on | |
" when scrolling, keep cursor 3 lines away from screen border | |
set scrolloff=3 | |
" autocompletion of files and commands behaves like shell | |
" (complete only the common part, list the options that match) | |
set wildmode=list:longest | |
" Fix to let ESC work as espected with Autoclose plugin | |
let g:AutoClosePumvisible = {"ENTER": "\<C-Y>", "ESC": "\<ESC>"} | |
" Disable autocomplete in python mode - conflicts with jedi | |
let g:acp_enableAtStartup = 1 | |
fun! CheckAcpStatus() | |
if &ft =~ 'python' | |
:AcpDisable | |
else | |
:AcpEnable | |
endif | |
endfun | |
autocmd WinEnter,BufRead,BufNewFile * call CheckAcpStatus() | |
" autocmd WinEnter * if &ft==python | :AcpDisable | else | :AcpEnable | endif | |
" autocmd WinEnter * if &omnifunc!='' | :AcpDisable | else | :AcpEnable | endif | |
" autocmd WinEnter,TabEnter * call CheckAcpStatus() | |
" Stop that darned noise | |
:set visualbell | |
" Seriously, shut up! | |
:set noerrorbells | |
" I have enough stuff already, no need for more files | |
set nobackup | |
set noswapfile | |
:syntax on | |
"set guifont=Inconsolata:h13 | |
set guifont=Source\ Code\ Pro:h12 | |
:let mapleader="," | |
set smartindent | |
nmap <C-D-e> :cnext<CR> | |
set listchars=tab:▸\ ,eol:¬,trail:- | |
:set guioptions-=m "remove menu bar | |
:set guioptions-=T "remove toolbar | |
:set autochdir | |
nmap <leader>H :%!xxd<CR> |
Found this on reddit after being fed up with some IDE's. Really enjoyed it. I hope you don't mind the fork!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice... this may lure my back to vim after the last 20 years or so.