-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.vim
164 lines (138 loc) · 4.89 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
"if &compatible
"set nocompatible
"endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call plug#begin(fnamemodify(expand('<sfile>'), ':h').'/plugged')
Plug 'mhinz/vim-startify'
Plug 'scrooloose/nerdcommenter'
Plug 'tpope/vim-surround' " ds<delimiter> etc.
Plug 'terryma/vim-multiple-cursors' " normal mode, <c-n> to select, <c-c> to stop selection
"Plug 'nathanaelkane/vim-indent-guides'
"Plug 'Yggdroot/indentLine'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Plug 'mhinz/vim-janah'
"try
"colorscheme janah
"autocmd ColorScheme janah highlight Normal ctermbg=235
"catch /^Vim\%((\a\+)\)\=:E185/
"colorscheme default
"endtry
colorscheme koehler
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" common settings
set encoding=utf-8
set number
set undolevels=1000
" tab and shift width
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
" increase and highlight search
set incsearch
set hlsearch
" enable mouse
set mouse=a
" remove '=' from filename
set isfname-==
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
endif
" common mappings
let mapleader=','
nnoremap wi <c-w>
nnoremap <leader>ev :edit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
nnoremap <Tab> :bnext!<cr>
nnoremap <S-Tab> :bprev!<cr><paste>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" build mappings
nnoremap <F7> :make<cr>
inoremap <F7> <c-o>:make<cr>
autocmd FileType c,cpp setlocal makeprg=make\ \-C\ cmake-build-Release
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" fzf.vim
Plug 'junegunn/fzf', { 'dir' : '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
" Mapping selecting mappings
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
" Insert mode completion
imap <c-x><c-k> <plug>(fzf-complete-word)
imap <c-x><c-f> <plug>(fzf-complete-path)
imap <c-x><c-j> <plug>(fzf-complete-file-ag)
imap <c-x><c-l> <plug>(fzf-complete-line)
" Advanced customization using autoload functions
inoremap <expr> <c-x><c-k> fzf#vim#complete#word({'left': '15%'})
nnoremap <c-p> :Files<cr>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" jedi-vim
Plug 'davidhalter/jedi-vim'
let g:jedi#goto_command = "<leader>d"
let g:jedi#goto_assignments_command = "<leader>g"
let g:jedi#goto_definitions_command = ""
let g:jedi#documentation_command = "K"
let g:jedi#usages_command = "<leader>n"
let g:jedi#completions_command = "<C-Space>"
let g:jedi#rename_command = "<leader>r"
autocmd FileType python setlocal completeopt-=preview
autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
autocmd FileType python nnoremap <buffer> <F5> :exec 'terminal python3' shellescape(@%, 1)<cr>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim-highlightedyank
Plug 'machakann/vim-highlightedyank'
hi HighlightedyankRegion cterm=reverse gui=reverse
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" nerdtree
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
nnoremap <F4> :NERDTreeToggle<cr>
inoremap <F4> <c-o>:NERDTreeToggle<cr>
nnoremap <F2> :Startify<cr>
inoremap <F2> <c-o>:Startify<cr>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" airline
Plug 'vim-airline/vim-airline'
set laststatus=2
let g:airline#extensions#tabline#enabled=1
let g:airline#extensions#tabline#buffer_idx_mode = 1
nmap <leader>1 <Plug>AirlineSelectTab1
nmap <leader>2 <Plug>AirlineSelectTab2
nmap <leader>3 <Plug>AirlineSelectTab3
nmap <leader>4 <Plug>AirlineSelectTab4
nmap <leader>5 <Plug>AirlineSelectTab5
nmap <leader>6 <Plug>AirlineSelectTab6
nmap <leader>7 <Plug>AirlineSelectTab7
nmap <leader>8 <Plug>AirlineSelectTab8
nmap <leader>9 <Plug>AirlineSelectTab9
nmap <C-Left> <Plug>AirlineSelectPrevTab
nmap <C-Right> <Plug>AirlineSelectNextTab
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" neosnippet
Plug 'Shougo/neosnippet.vim'
Plug 'Shougo/neosnippet-snippets'
" Note: It must be "imap" and "smap". It uses <Plug> mappings.
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
" SuperTab like snippets behavior.
" Note: It must be "imap" and "smap". It uses <Plug> mappings.
"imap <expr><TAB>
" \ pumvisible() ? "\<C-n>" :
" \ neosnippet#expandable_or_jumpable() ?
" \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
" For conceal markers.
if has('conceal')
set conceallevel=2 concealcursor=niv
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" git
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" editorconfig
Plug 'editorconfig/editorconfig-vim'
call plug#end()