" Plugins via vbundle set rtp+=~/.vim/bundle/vundle/ call vundle#rc() Bundle 'gmarik/vundle' Bundle 'scrooloose/nerdtree' Bundle 'kien/ctrlp.vim' Bundle 'bling/vim-airline' Bundle 'flazz/vim-colorschemes' Bundle 'rking/ag.vim' Bundle 'sjl/gundo.vim' Bundle 'MarcWeber/vim-addon-mw-utils' Bundle 'tomtom/tlib_vim' Bundle 'mattn/emmet-vim' "Bundle 'garbas/vim-snipmate' " Snippets Bundle 'SirVer/ultisnips' Bundle 'honza/vim-snippets' let g:UltiSnipsExpandTrigger = "" let g:UltiSnipsJumpForwardTrigger = "" let g:UltiSnipsJumpBackwardTrigger = "" let g:UltiSnipsListSnippets = "" "List possible snippets based on current file Bundle 'tpope/vim-surround' Bundle 'tpope/vim-repeat' " shortcut 'gc' Bundle 'tpope/vim-commentary' " Git integration Bundle 'tpope/vim-fugitive' let g:fugitive_git_executable="LC_ALL=en_US.UTF-8 git" " Plugin for Autocompletion Bundle 'davidhalter/jedi-vim' Bundle 'klen/python-mode' " Override go-to.definition key shortcut to Ctrl-] " let g:pymode_rope_goto_definition_bind = "" "Bundle 'Valloric/YouCompleteMe' " ! Mac: brew install cmake " ! Linux: apt-get install build-essential cmake python-dev " ! cd ~/.vim/bundle/YouCompleteMe " ! ./install.sh --clang-completer "let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file "let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure "let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword "let g:ycm_complete_in_comments = 0 " Completion in comments "let g:ycm_complete_in_strings = 1 " Completion in string "let g:ycm_key_list_select_completion = [''] Bundle 'Shougo/neocomplete' " Disable AutoComplPop. let g:acp_enableAtStartup = 0 " Use neocomplete. let g:neocomplete#enable_at_startup = 1 " Use smartcase. let g:neocomplete#enable_smart_case = 1 " Set minimum syntax keyword length. let g:neocomplete#sources#syntax#min_keyword_length = 2 let g:neocomplete#lock_buffer_name_pattern = '\*ku\*' " " Define dictionary. let g:neocomplete#sources#dictionary#dictionaries = { \ 'default' : '', \ 'vimshell' : $HOME.'/.vimshell_hist', \ 'scheme' : $HOME.'/.gosh_completions' \ } " Define keyword. if !exists('g:neocomplete#keyword_patterns') let g:neocomplete#keyword_patterns = {} endif let g:neocomplete#keyword_patterns['default'] = '\h\w*' " Plugin key-mappings. inoremap neocomplete#undo_completion() inoremap neocomplete#complete_common_string() " Recommended key-mappings. " : close popup and save indent. inoremap =my_cr_function() function! s:my_cr_function() "return neocomplete#close_popup() . "\" " For no inserting key. return pumvisible() ? neocomplete#close_popup() : "\" endfunction " : completion. inoremap pumvisible() ? "\" : "\" " , : close popup and delete backword char. inoremap neocomplete#smart_close_popup()."\" inoremap neocomplete#smart_close_popup()."\" inoremap neocomplete#close_popup() inoremap neocomplete#cancel_popup() " Close popup by . "inoremap pumvisible() ? neocomplete#close_popup() : "\" " Enable omni completion. autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS autocmd FileType python setlocal omnifunc=pythoncomplete#Complete autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags " Enable heavy omni completion. if !exists('g:neocomplete#sources#omni#input_patterns') let g:neocomplete#sources#omni#input_patterns = {} endif " Plugin for sessions Bundle 'xolox/vim-misc' Bundle 'xolox/vim-session' "let g:session_directory = "~/.vim/session" let g:session_autoload = "no" let g:session_autosave = "no" let g:session_command_aliases = 1 " Plugin auto-pairs Bundle 'jiangmiao/auto-pairs' Bundle 'sukima/xmledit' " Plugin for Ack (better fgrep) Bundle 'mileszs/ack.vim' " Plugin for TabEdit Bundle "godlygeek/tabular" " Plugin for visual selecting ({}) with viv Bundle "gorkunov/smartpairs.vim" " Plugin for visual indent guidline Bundle "nathanaelkane/vim-indent-guides" " Plugin for tags Bundle "majutsushi/tagbar" " shortcut for open nerdtree nnoremap :NERDTreeToggle " shortcut for gundo nnoremap :GundoToggle " shortcut for Tagbar nnoremap :TagbarToggle " automatic reloading of .vimrc autocmd! bufwritepost .vimrc source % map a h :w " let nerdtree filter *.pyc files let NERDTreeIgnore = ['\.pyc$'] autocmd BufNewFile,BufReadPost *.md set filetype=markdown autocmd Filetype html nnoremap c I autocmd Filetype javascript nnoremap c I//> set encoding=utf-8 set wildmenu set hidden " better copy & paste " when you want to paste large blocks of code into vim, press f2 before you " paste. at the bottom you should see ``-- insert (paste) --``. set pastetoggle= set clipboard=unnamed " airline let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#left_sep = ' ' let g:airline#extensions#tabline#left_alt_sep = '|' if !exists('g:airline_symbols') let g:airline_symbols = {} endif let g:airline_symbols.space = "\ua0" let g:airline_theme="jellybeans" let g:airline_powerline_fonts=1 let g:airline_section_b = '%{fugitive#statusline()}' let g:airline_section_c = '%{getcwd()} :: %t' " mouse and backspace set mouse=a " on osx press alt and click set bs=2 " make backspace behave like normal again " rebind key " i like to have it here becuase it is easier to reach than the default and " it is next to ``m`` and ``n`` which i use for navigating between tabs. let mapleader = "," " bind nohl " removes highlight of your last search " ```` stands for ``ctrl`` and therefore ```` stands for ``ctrl+n`` noremap :nohl vnoremap :nohl inoremap :nohl " quicksave command noremap :update vnoremap :update inoremap :update " quick quit command noremap e :quit " quit current window noremap e :qa! " quit all windows " custom unvisibles set list set listchars=tab:▸\ ,eol:¬,trail:⋅,extends:❯,precedes:❮ set showbreak=↪ nmap l :set list! " bind ctrl+ keys to move around the windows, instead of using ctrl+w + " every unnecessary keystroke that can be saved is good for your health :) map j map k map l map h " easier moving between tabs map n :tabprevious map m :tabnext " map sort function to a key vnoremap s :sort " easier moving of code blocks " try to go into visual mode (v), thenselect several lines of code here and " then press ``>`` several times. vnoremap < >gv " better indentation " show whitespace " must be inserted before the colorscheme command autocmd colorscheme * highlight extrawhitespace ctermbg=red guibg=red au insertleave * match extrawhitespace /\s\+$/ " color scheme set t_Co=256 colorscheme jellybeans " enable syntax highlighting " you need to reload this file for the change to apply filetype off filetype plugin indent on syntax on " showing line numbers and length set number " show line numbers set tw=79 " width of document (used by gd) set nowrap " don't automatically wrap on load set fo-=t " don't automatically wrap text when typing set colorcolumn=80 highlight colorcolumn ctermbg=233 " easier formatting of paragraphs "" vmap q gq "" nmap q gqap " useful settings set history=700 set undolevels=700 " real programmers don't use tabs but spaces set tabstop=4 set softtabstop=4 set shiftwidth=4 set shiftround set expandtab " make search case insensitive set hlsearch set incsearch set ignorecase set smartcase " disable stupid backup and swap files - they trigger too many events " for file system watchers set nobackup set nowritebackup set noswapfile " setup pathogen to manage your plugins " mkdir -p ~/.vim/autoload ~/.vim/bundle " curl -so ~/.vim/autoload/pathogen.vim https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim " now you can install any plugin into a .vim/bundle/plugin-name/ folder " call pathogen#infect() " ============================================================================ " python ide setup " ============================================================================ " settings for vim-powerline " cd ~/.vim/bundle " git clone git://github.com/lokaltog/vim-powerline.git set laststatus=2 " settings for ctrlp " cd ~/.vim/bundle " git clone https://github.com/kien/ctrlp.vim.git let g:ctrlp_max_height = 30 set wildignore+=*.pyc set wildignore+=*_build/* set wildignore+=*/coverage/* " settings for python-mode " note: i'm no longer using this. leave this commented out " and uncomment the part about jedi-vim instead " cd ~/.vim/bundle " git clone https://github.com/klen/python-mode map g :call ropegotodefinition() let ropevim_enable_shortcuts = 1 let g:pymode_rope_goto_def_newwin = "vnew" let g:pymode_rope_extended_complete = 1 let g:pymode_breakpoint = 0 let g:pymode_syntax = 1 let g:pymode_syntax_builtin_objs = 0 let g:pymode_syntax_builtin_funcs = 0 " settings for jedi-vim " cd ~/.vim/bundle " git clone git://github.com/davidhalter/jedi-vim.git let g:jedi#usages_command = "z" let g:jedi#popup_on_dot = 0 let g:jedi#popup_select_first = 0 " map b oimport ipdb; ipdb.set_trace() # breakpoint " better navigating through omnicomplete option list " see http://stackoverflow.com/questions/2170023/how-to-map-keys-for-popup-menu-in-vim set completeopt=longest,menuone function! Omnipopup(action) if pumvisible() if a:action == 'j' return "\" elseif a:action == 'k' return "\" endif endif return a:action endfunction inoremap =Omnipopup('j') inoremap =Omnipopup('k') " python folding " mkdir -p ~/.vim/ftplugin " wget -o ~/.vim/ftplugin/python_editing.vim http://www.vim.org/scripts/download_script.php?src_id=5492 set nofoldenable " unmap the arrow keys "no "no "no "no "ino "ino "ino "ino " Bubble single lines nmap ddkP nmap ddp " Bubble multiple lines vmap xkP`[V`] vmap xp`[V`]`]]`" set cursorline hi CursorLine cterm=NONE ctermbg=234 ctermfg=NONE "let g:Powerline_symbols = 'fancy' " Snippets " inoreabbrev teh the cnoreabbrev Wq wq cnoreabbrev WQ wq cnoreabbrev W w cnoreabbrev Q q " shortcut for buffer switch with CtrlP nnoremap b :CtrlPBuffer