-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
176 lines (149 loc) · 4.41 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
syntax off
filetype plugin indent off
" Plugin Manager - Plug-
call plug#begin('~/.vim/plugged')
Plug 'frazrepo/vim-rainbow'
Plug 'preservim/nerdtree'
Plug 'tpope/vim-fugitive'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'vim-syntastic/syntastic'
Plug 'nvie/vim-flake8'
Plug 'jnurmine/Zenburn'
Plug 'altercation/vim-colors-solarized'
Plug 'posva/vim-vue'
Plug 'vim-airline/vim-airline'
Plug 'jvirtanen/vim-hcl'
Plug 'NoahTheDuke/vim-just'
"Plug 'numirias/semshi', {'do': ':UpdateRemotePlugins'}
call plug#end()
" ----------------------
"" Colorscheme
if has('gui_running')
set background=dark
colorscheme solarized
else
colorscheme zenburn
endif
"" Misc
filetype plugin indent on
if !exists("g:syntax_on")
syntax enable
endif
set number
set smartindent
set autoread
set hlsearch
" set vim not compatible with vi
set nocompatible
" encoding is utf 8
set encoding=utf-8
set fileencoding=utf-8
" by default, in insert mode backspace won't delete over line breaks, or
" automatically-inserted indentation, let's change that
set backspace=indent,eol,start
" keep the cursor visible within 3 lines when scrolling
set scrolloff=5
" Vim General Config----
"" Rainbow
let g:rainbow_active = 1
let g:rainbow_load_separately = [
\ [ '*' , [['(', ')'], ['\[', '\]'], ['{', '}']] ],
\ [ '*.tex' , [['(', ')'], ['\[', '\]']] ],
\ [ '*.cpp' , [['(', ')'], ['\[', '\]'], ['{', '}']] ],
\ [ '*.{html,htm}' , [['(', ')'], ['\[', '\]'], ['{', '}'], ['<\a[^>]*>', '</[^>]*>']] ],
\ ]
let g:rainbow_guifgs = ['RoyalBlue3', 'DarkOrange3', 'DarkOrchid3', 'FireBrick']
let g:rainbow_ctermfgs = ['lightblue', 'lightgreen', 'yellow', 'red', 'magenta']
let g:rainbow_active = 1
""Remove all trailing whitespace by pressing F5
nnoremap <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar><CR>
""Copy current line
nmap <silent> _y :.w !xsel --clipboard<CR><CR>
""Copy all file
nmap <silent> _Y :%w !xsel --clipboard<CR><CR>
""Copy selected lines
vmap <silent> _y :w !xsel --clipboard<CR><CR>
" Clear highlight on double escape
nnoremap <esc><esc> :noh<return>
" More untuitive page navigation
noremap J L
noremap K H
"" Enable folding
set foldmethod=indent
set foldlevel=99
"" Split navigation
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>
"" Set default split position
set splitbelow
set splitright
"" Enable terminal creation
nmap <C-T> :vert terminal<return>
"" Set the clipboard to be the system's
set clipboard=unnamed
"" Set swap file to reside in the given directory
set directory^=$HOME/.vim/tmp//
"" Faster rendering
set ttyfast
"" Re-execute the last command but with sudo :)
cmap w!! w !sudo tee > /dev/null %
"" General config
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set autoindent
"" Python config
au BufNewFile, BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=119|
\ set expandtab |
\ set autoindent |
\ set fileformat=unix |
\ set iskeyword-=_ |
au BufRead, BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
set cc=120
highlight ColorColumn ctermbg=1
let g:python_highlight_all=1
" Vimwiki Plugin -------
let wiki_1 = {}
let wiki_1.path = '~/vimwiki/'
let wiki_1.syntax = 'markdown'
let wiki_1.ext = '.md'
let g:vimwiki_list = [{'path': '~/vimwiki/',
\ 'syntax': 'markdown', 'ext': '.md'}]
let g:vimwiki_list = [wiki_1]
let g:vimwiki_ext2syntax = {'.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
" ----------------------
" NerdTree Plugin ------
map <C-n> :NERDTreeToggle<CR>
let NERDTreeIgnore = ['\.pyc$']
" ----------------------
" CTRLP Plugin ---------
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn|.pyc)$'
" ----------------------
"
" -------VueJS----------
autocmd BufRead,BufNewFile *.vue setlocal filetype=vue
let g:vim_vue_plugin_load_full_syntax = 1
let g:vim_vue_plugin_debug = 1
" ----------------------
" YCM -----------------
let g:ycm_add_preview_to_completeopt = 'menu,menuone,popup'
" Syntastic Plugin -----
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_aggrregate_errors = 1
let g:syntastic_python_checkers = ['flake8']
let g:syntastic_python_flake8_post_args="--max-line-length=120"
let g:pymode_lint_ignore = "E501,W"
" ----------------------