-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
132 lines (107 loc) · 3.97 KB
/
.vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
set nocompatible " required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" Add all your plugins here (note older versions of Vundle used Bundle instead of Plugin)
Plugin 'tmhedberg/SimpylFold'
Plugin 'vim-scripts/indentpython.vim'
Bundle 'Valloric/YouCompleteMe'
Plugin 'scrooloose/syntastic'
Plugin 'scrooloose/nerdcommenter'
Plugin 'nvie/vim-flake8'
Plugin 'jnurmine/Zenburn'
Plugin 'altercation/vim-colors-solarized'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'kien/ctrlp.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'powerline/powerline', {'rtp': 'powerline/bindings/vim/'}
Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-easytags'
Plugin 'JamshedVesuna/vim-markdown-preview'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" Powerline customisations
set laststatus=2 " Always display the statusline in all windows
set showtabline=2 " Always display the tabline, even if there is only one tab
set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the statusline)
"split navigations
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>
" Enable folding
set foldmethod=indent
set foldlevel=99
" Enable folding with the spacebar
nnoremap <space> za
" PEP-8 formatting
" This will give you the standard four spaces when you hit tab,
" ensure your line length doesn’t go beyond 80 characters,
" and store the file in a unix format so you don’t get a bunch of
" conversion issues when checking into GitHub and/or sharing with other users.
au BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=79 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix|
" Flag whitespace
highlight BadWhitespace ctermbg=red guibg=darkred
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
set encoding=utf-8
" You-Complete-Me settings for autocomplete
"
" Ensures that the autocomplete window goes away when you’re done with it
let g:ycm_autoclose_preview_window_after_completion=1
" Defines a shortcut for goto definition
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
" python with virtualenv support
" determines if you are running inside a virtualenv, and then switches to that
" specific virtualenv and sets up your system path so that YouCompleteMe will
" find the appropriate site packages
py << EOF
import os
import sys
if 'VIRTUAL_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF
" Make your code look pretty
let python_highlight_all=1
syntax on
if has('gui_running') " 'gui_running' is set, for instance, when you execute GVim
set background=dark
colorscheme solarized
else
set t_Co=256
set background=dark
colorscheme zenburn
endif
" Switch between Light and Dark themes of Solarized
call togglebg#map("<F5>")
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
" Line numbering
set nu
" JSON pretty-print - the leader key is backslash ('\') by default
map <leader>J :%!python -m json.tool
" Where to look for the `tags` database; for `Go To Definition` with ctags
let g:easytags_file = '~/.vim/tags'
let g:easytags_on_cursorhold=0
let g:easytags_auto_update=0
let g:easytags_auto_highlight=0
" GitHub-flavoured MarkDown (mostly for my GitHub repos)
" Uses Python Grip, which makes a request to GitHub's API and may require auth.
let vim_markdown_preview_github=0
let vim_markdown_preview_hotkey='C-a'
let vim_markdown_preview_browser='firefox'
let g:easytags_async=1