-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.vim
236 lines (206 loc) · 6.17 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
""
"" * setting
""
set lazyredraw " fast
set clipboard=unnamed " macのクリップボードとyankを共有
set showmatch " 括弧移動
set matchtime=1 " 時間短縮
set autoread " 開いているがvim上で変更のないファイルについて、外部で変更があった時に自動的に読み込む
set enc=utf8 " utf8
set fenc=utf-8 " utf8にエンコード
set shiftwidth=4
set tabstop=4
set hidden " 保存されていないファイルがあるときでも別のファイルを開くことが出来る
set history=100 " コマンドラインの履歴を100件保存する
set hlsearch " 検索文字列をハイライトする
set incsearch " インクリメンタルサーチを行う
set isk+=- " ハイフンをiskeywordに含める
set ttyfast
set nobackup " 勝手に作るファイルを無効にする
set noswapfile
set number " 行番号の表示
set noruler " 右下に表示されるやつを消す
set visualbell " ビープ音を消す
set wildmenu " ファイル名補完
set wildmode=full
set wrap " 画面の端で、行を折り返して表示してくれるようになる
set backspace=indent,eol,start " インサートモード中の BS、CTRL-W、CTRL-U による文字削除を柔軟にする
set autoindent "改行時に前の行のインデントを継続する"
" set list
" set listchars=tab:»-,trail:-,extends:»,precedes:«,nbsp:%
xnoremap <expr> p 'pgv"'.v:register.'ygv<esc>' " paste時にyankしない
""
"" * 挿入モードで縦棒カーソル表示(vimの時)
""
if has('vim_starting')
let &t_SI .= "\e[6 q"
let &t_EI .= "\e[2 q"
let &t_SR .= "\e[4 q"
endif
""
"" * fileからディレクトリに戻る
""
nnoremap - :<C-u>e %:h<CR>
""
"" * vim-plugin
""
call plug#begin('~/.vim/plugged')
" lsp
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
" filer
Plug 'mattn/vim-molder'
Plug 'mattn/vim-molder-operations'
" fzf
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
" vim-ripgrep
Plug 'jremmen/vim-ripgrep'
" test
Plug 'vim-test/vim-test'
Plug 'preservim/vimux'
" スニペット
Plug 'hrsh7th/vim-vsnip'
Plug 'hrsh7th/vim-vsnip-integ'
" status bar
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tpope/vim-fugitive' " status barにgit branchを表示させるため
" git
Plug 'tyru/open-browser.vim'
Plug 'tyru/open-browser-github.vim'
Plug 'APZelos/blamer.nvim'
Plug 'airblade/vim-gitgutter'
Plug 'iberianpig/tig-explorer.vim' " vimからtigを開く
Plug 'rbgrouleff/bclose.vim'
" etc
Plug 'tpope/vim-commentary' " gccでコメントアウトできるようにする
Plug 'unblevable/quick-scope' " 横移動をいい感じにする
Plug 'terryma/vim-expand-region' " 選択範囲をいい感じにする
Plug 'cohama/lexima.vim' " 閉じかっこ補完
Plug 'tomasr/molokai' " color thema
" go
Plug 'mattn/vim-goimports'
" terraform
Plug 'hashivim/vim-terraform'
" ytt
Plug 'cappyzawa/starlark.vim'
Plug 'vmware-tanzu/ytt.vim'
" protobuf
Plug 'uarun/vim-protobuf'
call plug#end()
""
"" * fzf
""
nnoremap <Space>b :Buffers<CR>
nnoremap <Space>f :Files<CR>
let $FZF_DEFAULT_COMMAND="rg --files --hidden -g '!.git/**' -g '!bazel-server'"
""
"" * vim-ripgrep
""
function! FZGrep(query, fullscreen)
let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case -- %s || true'
let initial_command = printf(command_fmt, shellescape(a:query))
let reload_command = printf(command_fmt, '{q}')
let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
endfunction
command! -nargs=* -bang RG call FZGrep(<q-args>, <bang>0)
nnoremap <Space>l :RG<CR>
""
"" * terryma/vim-expand-region
""
map K <Plug>(expand_region_expand)
map J <Plug>(expand_region_shrink)
""
"" * colorscheme
""
syntax on
colorscheme molokai
if !has('gui_running') && &term =~ '^\%(screen\|tmux\)'
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif
""
"" * lsp
""
nmap <silent> <Space>d :LspDefinition<CR>
nmap <silent> rn :LspRename<CR>
nmap <silent> <Space>T :LspTypeDefinition<CR>
nmap <silent> <Space>i :LspImplementation<CR>
nmap <silent> <Space>a :LspCodeAction<CR>
nmap <silent> rr :LspReferences<CR>
let g:lsp_diagnostics_enabled = 1
let g:lsp_diagnostics_echo_cursor = 1 " Show diagnostics message to status line
let g:asyncomplete_popup_delay = 200
""
"" * mattn/vim-lsp-settings
""
highlight link LspWarningHighlight Error
""
"" * mattn/vim-molder
""
let g:molder_show_hidden = 1
""
"" * airblade/vim-gitgutter
""
set updatetime=250
set signcolumn=yes
""
"" * vim-test/vim-test
""
nmap <silent> <Space>t :TestNearest<CR>
let test#strategy = "vimux"
""
"" * vim-vsnip
""
imap <expr> <C-l> vsnip#available(1) ? '<Plug>(vsnip-expand-or-jump)' : '<C-l>'
let g:lsp_settings = {
\ 'gopls': {
\ 'initialization_options': {
\ 'usePlaceholders': v:true,
\ },
\ },
\ }
""
"" * mattn/vim-goimports
""
let g:goimports = 1
let g:goimports_simplify = 1
""
"" * prabirshrestha/asyncomplete.vim
""
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? asyncomplete#close_popup() . "\<cr>" : "\<cr>"
""
"" * vim-airline/vim-airline
""
let g:airline_theme='violet'
let g:airline#extensions#tabline#enabled = 1
let g:airline_statusline_ontop = 1
let g:airline_powerline_fonts = 0
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline_section_b='%{airline#extensions#branch#get_head()}'
let g:airline_section_x=''
let g:airline_section_y=''
let g:airline_section_z=''
let g:airline#extensions#whitespace#enabled = 0
" remove separators for empty sections
let g:airline_skip_empty_sections = 1
autocmd VimEnter * set laststatus=0
""
"" * tig
""
nmap <silent> tt :TigStatus<CR>
""
"" * highlight
""
highlight Normal ctermbg=NONE guibg=NONE
highlight NonText ctermbg=NONE guibg=NONE
highlight LineNr ctermbg=NONE guibg=NONE
highlight Folded ctermbg=NONE guibg=NONE
highlight EndOfBuffer ctermbg=NONE guibg=NONE