-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.vim
251 lines (188 loc) · 6.6 KB
/
init.vim
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
244
245
246
247
248
249
250
251
""" init.vim
"dein Scripts-----------------------------
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=/home/georgetg/.config/nvim/dein/repos/github.com/Shougo/dein.vim
" Required:
if dein#load_state('/home/georgetg/.config/nvim/dein')
call dein#begin('/home/georgetg/.config/nvim/dein')
" Let dein manage dein
" Required:
call dein#add('/home/georgetg/.config/nvim/dein/repos/github.com/Shougo/dein.vim')
" Add or remove your plugins here:
call dein#add('Shougo/neosnippet.vim')
call dein#add('Shougo/neosnippet-snippets')
call dein#add('Shougo/deoplete.nvim')
call dein#add('Lokaltog/vim-easymotion')
call dein#add('ervandew/supertab')
call dein#add('scrooloose/nerdcommenter')
call dein#add('scrooloose/nerdtree')
call dein#add('scrooloose/syntastic')
call dein#add('chriskempson/tomorrow-theme', {'rtp': 'vim/'})
call dein#add('vim-scripts/CSApprox')
call dein#add('vim-airline/vim-airline')
call dein#add('vim-airline/vim-airline-themes')
" Required:
call dein#end()
call dein#save_state()
endif
" Required:
filetype plugin indent on
syntax enable
" If you want to install not installed plugins on startup.
if dein#check_install()
call dein#install()
endif
"End dein Scripts-------------------------
""" syntax highlighting
syntax on
""" deoplete enable
let g:deoplete#enable_at_startup = 1
set t_Co=256
""" show (partial) command in the last line of the screen
set showcmd
""" display line numbers
set number
""" 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 expandtab
set autoindent
""" command-line completion
set wildmode=longest,full
set wildmenu
" case insensitive filename completion
set wildignorecase
""" disable cursor blinking
set guicursor+=a:blinkon0
""" search
" If the 'ignorecase' option is on, the case of normal letters is ignored.
" 'smartcase' can be set to ignore case when the pattern contains lowercase
" letters only.
set ignorecase
set smartcase
" While typing a search command, show where the pattern, as it was typed
" so far, matches.
set incsearch
""" source code lines should be at most 80 characters wide
""" set a marker on the 81th text column
set colorcolumn=81
""" folds
" automatic folds based on syntax
set foldmethod=indent
set foldnestmax=1
"colorscheme Tomorrow
colorscheme Tomorrow-Night
"colorscheme Tomorrow-Night-Bright
"colorscheme Tomorrow-Night-Eighties
""" 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
nmap <leader>l :set list!<CR>
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
""" strip trailing whitespace
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
%s/\s\+$//e
let @/=_s
call cursor(l, c)
endfunction
" strip trailing whitespace on save
autocmd BufWritePre *.asm,*.c,*.css,*.h,*.html,*.jade,*.java,*.m,*.md,*.markdown,*.js,*.py,*.sh,*.styl,*.sql,*.txt,*.v :call <SID>StripTrailingWhitespaces()
" map the <SID>StripTrailingWhitespaces function to a shortcut
"nnoremap <silent> ,s :call <SID>StripTrailingWhitespaces()<CR>
nnoremap ,w :call <SID>StripTrailingWhitespaces()<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""" custom shortcuts
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" open a new tab with t
" note the trailing space in the command
nnoremap t :tabedit
" 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>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""" create parent directories on save
function s:MkNonExDir(file, buf)
if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/'
let dir=fnamemodify(a:file, ':h')
if !isdirectory(dir)
call mkdir(dir, 'p')
endif
endif
endfunction
augroup BWCCreateDir
autocmd!
autocmd BufWritePre * :call s:MkNonExDir(expand('<afile>'), +expand('<abuf>'))
augroup END
""" use the mouse in gvim
if has("gui_running")
nmap <LeftMouse> <LeftMouse>i
endif
" NERDTree show hidden files
let NERDTreeShowHidden=1
""" open folds when opening a file
au BufRead * normal zR
""" from "Vim as a Python IDE"
set clipboard=unnamed