Advertisement
Guest User

vimrc

a guest
Oct 28th, 2018
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 5.19 KB | None | 0 0
  1. "Run this command to install vundle(VIM package manager): git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
  2. "Remember to install JEDI too
  3. set nocompatible              " required
  4. filetype off                  " required
  5.  
  6. " set the runtime path to include Vundle and initialize
  7. set rtp+=~/.vim/bundle/Vundle.vim
  8. call vundle#begin()
  9.  
  10. " alternatively, pass a path where Vundle should install plugins
  11. "call vundle#begin('~/some/path/here')
  12.  
  13. " let Vundle manage Vundle, required
  14. Plugin 'gmarik/Vundle.vim'
  15.  
  16. " add all your plugins here (note older versions of Vundle
  17. " used Bundle instead of Plugin)
  18. Plugin 'vim-scripts/indentpython.vim'
  19. Plugin 'vim-syntastic/syntastic'
  20. Plugin 'nvie/vim-flake8'
  21. "Plugin 'Shougo/echodoc.vim'
  22. " Plugin 'davidhalter/jedi-vim'
  23. Plugin 'Valloric/YouCompleteMe'
  24. Plugin 'scrooloose/nerdtree'
  25. Plugin 'benmills/vimux'
  26. Plugin 'tpope/vim-surround'
  27. Plugin 'tpope/vim-commentary'
  28. Plugin 'tpope/vim-fugitive'
  29. " Plugin 'powerline/powerline'
  30. Plugin 'vim-airline/vim-airline'
  31. Plugin 'vim-airline/vim-airline-themes'
  32. Plugin 'ryanoasis/vim-devicons'
  33. Plugin 'Yggdroot/indentLine'
  34. Plugin 'liuchengxu/vim-which-key'
  35. Plugin 'sophacles/vim-processing'
  36. " ...
  37.  
  38. " All of your Plugins must be added before the following line
  39. call vundle#end()            " required
  40. filetype plugin indent on    " required
  41.  
  42. "So you can actually see function params from echodoc
  43. "set cmdheight=2
  44.  
  45. " nnoremap <silent> <leader> :WhichKey '\'<CR>
  46.  
  47. " change indent level bars
  48. let g:indentLine_char = '·'
  49.  
  50. "Change airline theme
  51. let g:airline_theme='violet'
  52. set ttimeoutlen=50
  53.  
  54. " Helpful Syntastic commands
  55. set statusline+=%#warningmsg#
  56. set statusline+=%{SyntasticStatuslineFlag()}
  57. set statusline+=%*
  58.  
  59. let g:syntastic_always_populate_loc_list = 1
  60. let g:syntastic_auto_loc_list = 1
  61. let g:syntastic_check_on_open = 1
  62. let g:syntastic_check_on_wq = 0
  63. let g:syntastic_python_checkers = ['pyflakes'] " add other checkers in brackets for example ['pyflakes', 'pylint'] pytlint can be useful for style checking run 'pip3 install pyflakes' to install
  64. " make the syntastic error highlighting gutter readable
  65. highlight QuickFixLine ctermbg=089
  66.  
  67. "VIMUX COMMANDS
  68. nnoremap <leader>c :VimuxCloseRunner<CR>
  69. let g:VimuxUseNearest = 0
  70. " Vimux run python interactive binding
  71. autocmd FileType python  nnoremap <F5> :call VimuxRunCommandInDir("clear; python3 -i ", 1)<CR>:VimuxInspectRunner<CR>:call VimuxSendKeys("q")<CR>
  72.  
  73.  
  74. "Vimux Mac change theme bindings: this doesnt work right now because the tmux
  75. "session will not sync env variables between panes so you must close the
  76. "runner on your own - <leader>c
  77. nnoremap <F2> :silent exec "!~/dot-files/scripts/togglebg.sh"<CR>
  78.     \:redraw!<CR>:AirlineRefresh<CR>
  79.  
  80. "Set so vim fonts work right
  81. set encoding=UTF-8
  82.  
  83. " Enable vimrc auto reloading
  84. autocmd! bufwritepost .vimrc source %
  85. " enable syntax highlighting
  86. syntax enable
  87.  
  88. "Assume 256 color support
  89. set term=screen-256color " This gets airline to work in tmux
  90.  
  91. "Set encoding
  92. set encoding=utf-8
  93.  
  94. " show line numbers
  95. set number
  96.  
  97. "Get backspace working correctly
  98. set backspace=2
  99.  
  100. "Set spacing correctly for python
  101. au BufNewFile,BufRead *.py
  102.     \ set tabstop=4 |
  103.     \ set softtabstop=4 |
  104.     \ set shiftwidth=4 |
  105. "    \ set textwidth=79 |
  106.     \ set expandtab |
  107.     \ set autoindent |
  108.     \ set fileformat=unix |
  109. "    \ set colorcolumn=80
  110.  
  111. "split navigations
  112.  nnoremap <C-J> <C-W><C-J>
  113.  nnoremap <C-K> <C-W><C-K>
  114.  nnoremap <C-L> <C-W><C-L>
  115.  nnoremap <C-H> <C-W><C-H>
  116.  
  117. " sort with \s in visual mode
  118. vnoremap <leader>s :sort<CR>
  119.  
  120. "remove trailing white space
  121. nnoremap <leader>ws :%s/\s\+$//e<CR>
  122.  
  123. "make it so :Q works as :q and :W works as :w
  124. :command W w
  125. :command Q q
  126. :command WQ wq
  127.  
  128. "bind to fix tabs
  129. nnoremap <leader>rt :retab<CR>
  130. "
  131. " show a visual line under the cursor's current line
  132. "set cursorline
  133.  
  134. " show the matching part of the pair for [] {} and ()
  135. set showmatch
  136.  
  137. " enable all Python syntax highlighting features
  138. let python_highlight_all = 1
  139.  
  140. " Enable folding
  141. set foldmethod=indent
  142. set foldlevel=99
  143.  
  144. " Enable folding with the spacebar
  145. nnoremap <space> za
  146.  
  147. "recursive subdirectory searching for file operations
  148. set path+=**
  149.  
  150. "show what matches a wild card then using commands such as :find
  151. set wildmenu
  152.  
  153. "enable tag jumping
  154. command! MakeTags !ctags -G .
  155.  
  156. "Create file and edit under cursor
  157. map <leader>gf :e <cfile><cr>
  158.  
  159. "Enable python skeleton program (remember you can append movement commands to
  160. "the end of this command)
  161. nnoremap ,python :-1read $HOME/.vim/skeletons/skeleton.python<CR>
  162. nnoremap ,pydoc :-1read $HOME/.vim/skeletons/skeleton.python.document<CR>
  163. " toggle bind for file tree
  164. map <leader>t :NERDTreeToggle<CR>
  165. " auto open nerd treee when no file is specified
  166. autocmd StdinReadPre * let s:std_in=1
  167. autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
  168.  
  169. " auto switch between relative line numbers and exact based on mode
  170. set number relativenumber
  171.  
  172. augroup numbertoggle
  173.   autocmd!
  174.   autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
  175.   autocmd BufLeave,FocusLost,InsertEnter   * set norelativenumber
  176. augroup END
  177.  
  178. "Show tab/newline/carridge return characters
  179. set listchars=eol:¬,tab:⇥\
  180. set list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement