-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.vimrc
146 lines (117 loc) · 3.3 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
" load pathogen
execute pathogen#infect()
" syntax highlighting
" syntax enable
let python_highlight_all=1
syntax on
" enable file type detection
filetype on
" set theme
set t_Co=256
set background=dark
set encoding=utf-8
colorscheme bubblegum
" show number lines the title of the window and the ruler
set number
set title
set ruler
" highlight current line
set cursorline
" show color column at 80
set colorcolumn=80
" disable swap files
set nobackup
set nowritebackup
set noswapfile
" highlight inc search
set hlsearch
set incsearch
"This clears the 'last search pattern' by hitting return
nnoremap <CR> :noh<CR><CR>
" open new slip panes to right and bottom, which feels more natural
set splitbelow
set splitright
" autocompletion options
set completeopt=menuone,longest,preview
:inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" lines longer than 80 columns will be broken
set textwidth=80
" operation >> indents 4 columns; << unindents 4 columns
set shiftwidth=4
" an hard TAB displays as 4 columns
set tabstop=4
" insert spaces when hitting TABs
set expandtab
" insert/delete 4 spaces when hitting a TAB/BACKSPACE
set softtabstop=4
" round indent to multiple of 'shiftwidth'
set shiftround
" align the new line indent with the previous line
set autoindent
set foldmethod=indent
" inside a method type 'za' to open and close a fold.
set foldlevel=99
" Alt + Arrow navigation
nmap <silent> <A-Up> :wincmd k<CR>
nmap <silent> <A-Down> :wincmd j<CR>
nmap <silent> <A-Left> :wincmd h<CR>
nmap <silent> <A-Right> :wincmd l<CR>
" Use system clipboard
set clipboard=unnamed
" --- PLUGINS ----
" remaps for vim-uninmpaired
nmap < [
nmap > ]
omap < [
omap > ]
xmap < [
xmap > ]
" load the plugin indent file for specific file types
filetype plugin indent on
" Remove trailing spaces
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWritePre * :%s/\s\+$//e
" vim-license
" Add apache license to new python files
let g:licenses_copyright_holders_name = 'Red Hat, Inc.'
autocmd BufNewFile *.py :Apache
" Flake8
" run the Flake8 check every time you write a Python file
autocmd BufWritePost *.py call Flake8()
" NERDTree
" configure NERDTree to close if it's the last tab and maps
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
map <C-n> :NERDTreeToggle<CR>
map <C-Right> :tabn<cr>
map <C-Left> :tabp<cr>
map <C-t> :tabnew<CR>
" Vim-Airline
set laststatus=2
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
"vim-gitgutter
let g:gitgutter_highlight_lines = 0
let g:gitgutter_realtime = 1
"vim-tagbar
nnoremap <silent><F3> :TagbarToggle<CR>
let g:tagbar_width = 30
let g:tagbar_autoclose = 1
"vim-isort
nnoremap <silent><F8> :Isort<CR>
"vim-ctrlp
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
"Add the virtualenv's site-packages to vim path"
py << EOF
import os.path
import sys
import vim
if 'VIRTUAL_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
sys.path.insert(0, project_base_dir)
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF