Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
763
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. " plugins
  2. set nocompatible
  3. filetype off
  4. let need_to_install_plugins=0
  5. if empty(system("grep lazy_load ~/.vim/bundle/vundle/autoload/vundle.vim"))
  6. echo "Installing Vundle..."
  7. echo ""
  8. silent !mkdir -p ~/.vim/bundle
  9. silent !rm -rf ~/.vim/bundle/vundle
  10. silent !git clone https://github.com/gmarik/vundle ~/.vim/bundle/vundle
  11. let need_to_install_plugins=1
  12. endif
  13. set rtp+=~/.vim/bundle/vundle/
  14. call vundle#begin()
  15.  
  16. Plugin 'gmarik/vundle'
  17. Plugin 'zeis/vim-kolor.git'
  18. Plugin 'tpope/vim-surround.git'
  19. Plugin 'ervandew/supertab.git'
  20. Plugin 'tpope/vim-sensible.git'
  21. Plugin 'scrooloose/syntastic.git'
  22. Plugin 'vim-scripts/The-NERD-tree.git'
  23. Plugin 'jistr/vim-nerdtree-tabs.git'
  24. Plugin 'majutsushi/tagbar.git'
  25. Plugin 'lepture/vim-jinja.git'
  26. Plugin 'klen/python-mode.git'
  27.  
  28. call vundle#end()
  29. filetype plugin indent on
  30. syntax on
  31. set modeline
  32. set modelines=3
  33.  
  34. if need_to_install_plugins==1
  35. echo "Installing plugins..."
  36. silent! PluginInstall
  37. echo "Done!"
  38. q
  39. endif
  40.  
  41. " always show the status bar
  42. set laststatus=2
  43.  
  44. " enable 256 colors
  45. set t_Co=256
  46.  
  47. " turn on line numbering
  48. set number
  49.  
  50. " sane text files
  51. set fileformat=unix
  52. set encoding=utf-8
  53. set fileencoding=utf-8
  54.  
  55. " sane editing
  56. set tabstop=4
  57. set shiftwidth=4
  58. set softtabstop=4
  59. set colorcolumn=80
  60. set viminfo='25,\"50,n~/.viminfo
  61.  
  62. " word movement
  63. imap <S-Left> <Esc>bi
  64. nmap <S-Left> b
  65. imap <S-Right> <Esc><Right>wi
  66. nmap <S-Right> w
  67.  
  68. " convert all typed tabs to spaces
  69. set expandtab
  70.  
  71. " unindent with shift-tab
  72. imap <S-Tab> <Esc><<i
  73. nmap <S-tab> <<
  74.  
  75. " color scheme
  76. syntax on
  77. colorscheme kolor
  78. filetype on
  79. filetype plugin indent on
  80.  
  81. " code folding
  82. set foldmethod=indent
  83. set foldlevel=99
  84.  
  85. " move through split windows
  86. nmap <leader><Up> :wincmd k<CR>
  87. nmap <leader><Down> :wincmd j<CR>
  88. nmap <leader><Left> :wincmd h<CR>
  89. nmap <leader><Right> :wincmd l<CR>
  90.  
  91. " move through buffers
  92. nmap <leader>[ :bp<CR>
  93. nmap <leader>] :bn<CR>
  94.  
  95. " code completion
  96. au FileType python set omnifunc=pythoncomplete#Complete
  97. let g:SuperTabDefaultCompletionType = "context"
  98. let g:SuperTabNoCompleteAfter = ['^', ',', '\s']
  99. set completeopt=menuone,longest,preview
  100.  
  101. " restore place in file from previous session
  102. if has("autocmd")
  103. au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
  104. endif
  105.  
  106. " file browser
  107. map <leader>n :NERDTreeTabsToggle<CR>
  108. let NERDTreeIgnore=['\.pyc$', '__pycache__', '\.sqlite$', '\.sqlite3$']
  109.  
  110. " tag list
  111. map <leader>t :TagbarToggle<CR>
  112.  
  113. " Add the virtualenv's site-packages to vim path
  114. py << EOF
  115. import os.path
  116. import sys
  117. import vim
  118. if 'VIRTUAL_ENV' in os.environ:
  119. project_base_dir = os.environ['VIRTUAL_ENV']
  120. sys.path.insert(0, project_base_dir)
  121. activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
  122. if os.path.exists(activate_this):
  123. execfile(activate_this, dict(__file__=activate_this))
  124. EOF
  125.  
  126. " disable autoindent when pasting text
  127. function! WrapForTmux(s)
  128. if !exists('$TMUX')
  129. return a:s
  130. endif
  131. let tmux_start = "\<Esc>Ptmux;"
  132. let tmux_end = "\<Esc>\\"
  133. return tmux_start . substitute(a:s, "\<Esc>", "\<Esc>\<Esc>", 'g') . tmux_end
  134. endfunction
  135.  
  136. let &t_SI .= WrapForTmux("\<Esc>[?2004h")
  137. let &t_EI .= WrapForTmux("\<Esc>[?2004l")
  138.  
  139. function! XTermPasteBegin()
  140. set pastetoggle=<Esc>[201~
  141. set paste
  142. return ""
  143. endfunction
  144.  
  145. inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement