-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
244 lines (184 loc) · 6 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
""" .vimrc
""" Vundle
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible " be iMproved, required
filetype off " required
"" To paste code with no autoindent
set pastetoggle=<F10>
let g:ycm_server_python_interpreter = '/usr/bin/python3'
let g:ycm_python_binary_path = '/usr/bin/python3'
let g:ycm_autoclose_preview_window_after_insertion = 1
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
"""" PLUGINS AREA
call vundle#begin()
"Let the plugin manage itself. Required
Plugin 'gmarik/Vundle.vim'
""" PLUGINS
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Functionallity
Plugin 'ervandew/supertab'
Plugin 'scrooloose/nerdcommenter'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/syntastic'
Plugin 'maxbrunsfeld/vim-yankstack'
"Python pep8
Plugin 'nvie/vim-flake8'
"Git wrapper
Plugin 'tpope/vim-fugitive'
"Rust
Plugin 'rust-lang/rust.vim'
Plugin 'cespare/vim-toml'
"Web stuff
Plugin 'othree/html5.vim'
Plugin 'cakebaker/scss-syntax.vim'
Plugin 'pangloss/vim-javascript'
Plugin 'leafgarland/typescript-vim'
"Eye candy
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'flazz/vim-colorschemes'
Plugin 'w0ng/vim-hybrid'
"YCM
Plugin 'Valloric/YouCompleteMe'
call vundle#end() " required
"""" PLUGINS AREA END
filetype plugin indent on " required
""" syntax highlighting
syntax on
set t_Co=256
""" show (partial) command in the last line of the screen
set showcmd
""" display line numbers
set number
""" For airline
set laststatus=2
""" automatically change working directory to the directory of the current file
autocmd BufEnter * lcd %:p:h
set linebreak
set nolist " list disables linebreak
set textwidth=0
set wrapmargin=0
set showtabline=2
""" default indentation
set tabstop=4
set softtabstop=4
set shiftwidth=4
set smarttab
set expandtab
set autoindent
""" command-line completion
set wildmode=longest,full
set wildmenu
" case insensitive filename completion
set wildignorecase
set wildignore=*.swp,*.bak,*.pyc
set autowrite
" When vimrc is edited, reload it
autocmd! bufwritepost vimrc source ~/.vimrc
" With a map leader it's possible to do extra key combinations
" leader is press comma (,) key
" like <leader>w saves the current file
let mapleader=","
let g:mapleader=","
" Fast saving with leader + w
nmap <leader>w :w!<cr>
" Fast editing of the .vimrc
map <leader>e :e! ~/.vimrc<cr>
""" search
" ignore case when the pattern contains lowercase letters only.
set smartcase
" incremental search
set incsearch
""" set a marker on the 101st text column
set colorcolumn=101
""" folds
" automatic folds based on syntax
set foldmethod=indent
set foldnestmax=1
""" EYECANDY
colorscheme hybrid_reverse
let g:airline_theme="lucius"
""" Gvim cursor
highlight Cursor guifg=white guibg=red
highlight iCursor guifg=white guibg=steelblue
set guicursor+=a:blinkon0
if &term =~ "xterm\\|rxvt"
" use an orange cursor in insert mode
let &t_SI = "\<Esc>]12;orange\x7"
" use a red cursor otherwise
let &t_EI = "\<Esc>]12;223;116;180\x7"
silent !echo -ne "\033]12;red\007"
" reset cursor when vim exits
autocmd VimLeave * silent !echo -ne "\033]112\007"
" use \003]12;gray\007 for gnome-terminal and rxvt up to
version 9.21
endif
""" EasyMotion
let g:EasyMotion_leader_key = '\'
"let g:EasyMotion_do_shade = 0
"hi link EasyMotionTarget ErrorMsg
"hi link EasyMotionShade Comment
hi link EasyMotionTarget2First EasyMotionTarget
hi link EasyMotionTarget2Second EasyMotionTarget
"hi EasyMotionTarget ctermbg=none ctermfg=red
"hi EasyMotionShade ctermbg=none ctermfg=gray
"hi EasyMotionTarget2First ctermbg=none ctermfg=red
"hi EasyMotionTarget2Second ctermbg=none ctermfg=lightred
" set default encoding to utf-8
set encoding=utf-8
set listchars=tab:▸\ ,eol:¬
""" filetype specific settings
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" C
autocmd BufNewFile,BufRead *.h set filetype=c
autocmd FileType c setlocal tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab
" CSS
autocmd FileType css setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab
" HTML
autocmd FileType html setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab
" Java
autocmd FileType java setlocal tabstop=4 softtabstop=4 shiftwidth=4 expandtab
" JavaScript
autocmd FileType javascript setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab
" make
autocmd FileType make setlocal tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab
" Markdown
autocmd BufNewFile,BufRead *.md set filetype=markdown
" Python
autocmd FileType py setlocal textwidth=79 tabstop=4 softtabstop=4 shiftwidth=4 expandtab autoindent
" SQL
autocmd FileType sql setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab
" yaml
autocmd FileType yaml setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab
""" custom shortcuts
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" open a new tab with t
" note the trailing space in the command
nnoremap t :tabnew
" toggle spell checking
" http://vim.wikia.com/wiki/Toggle_spellcheck_with_function_keys
nnoremap ,s :setlocal spell!<CR>
""" Greek input and spell checking
function! <SID>GreekInputSpellChecking()
setlocal keymap=greek_utf-8
setlocal spell spelllang=en,el
endfunction
function! <SID>EnglishInputSpellChecking()
setlocal keymap=
setlocal spell spelllang=en,el
endfunction
"nnoremap ,g :call <SID>GreekInputSpellChecking()<CR>
"nnoremap ,e :call <SID>EnglishInputSpellChecking()<CR>
nnoremap ,g :setlocal keymap=greek_utf-8<CR>:setlocal spell spelllang=en,el<CR>
nnoremap ,e :setlocal keymap=<CR>:setlocal spell spelllang=en,el<CR>
nnoremap ,h :setlocal keymap=greek_utf-8<CR>:setlocal spell spelllang=el<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""" use the mouse in gvim
if has("gui_running")
nmap <LeftMouse> <LeftMouse>i
endif
" NERDTree key
map <C-n> :NERDTreeToggle<CR>
""" open folds when opening a file
au BufRead * normal zR