-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
173 lines (153 loc) · 4.26 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
scriptencoding utf-8
set encoding=utf-8
let mapleader = "\<Space>"
"generals
inoremap <silent> <Leader>jj <Esc>
nnoremap <silent> <Leader>wq :wq<CR>
nnoremap <silent> <Leader>q :q<CR>
noremap <silent> <Leader>a myggVG$
inoremap <silent> <Leader>a <Esc>myggVG$
nnoremap <silent> <Leader>vr :new ~/.vimrc<CR>
nnoremap <silent> <Leader>r :source ~/.vimrc<CR>
noremap <silent> <Leader><Leader> <C-w>w
map <silent> <leader>n :call RenameFile()<CR>
map <silent> <leader>? :Cheat<CR>
function! RenameCurrentFile()
let old = expand('%')
let new = input('新規ファイル名: ', old , 'file')
if new != '' && new != old
exec ':saveas ' . new
exec ':silent !rm ' . old
redraw!
endif
endfunction
"vim-fugitive
nnoremap <leader>ga :Git add %:p<CR><CR>
nnoremap <leader>gc :Gcommit<CR><CR>
nnoremap <leader>gs :Gstatus<CR>
nnoremap <leader>gp :Gpush<CR>
nnoremap <leader>gd :Gdiff<CR>
nnoremap <leader>gl :Glog<CR>
nnoremap <leader>gb :Gblame<CR>
"jp -> en in normal mode
nnoremap あ a
nnoremap い i
nnoremap う u
nnoremap お o
nnoremap dd dd
nnoremap yy yy
set colorcolumn=80
highlight ColorColumn guibg=#202020 ctermbg=lightgray
set autoindent
set ambiwidth=double
set background=dark
set expandtab
set history=5000
set hlsearch
set ignorecase
set incsearch
set noswapfile
set number
set smartcase
set statusline=%F%r%h%=d
set belloff=all
set whichwrap=b,s,h,l,<,>,[,],~
set wildmenu wildmode=list:full
" 検索後にジャンプした際に検索単語を画面中央に持ってくる
nnoremap n nzz
nnoremap N Nzz
nnoremap * *zz
nnoremap # #zz
nnoremap g* g*zz
nnoremap g# g#zz
nnoremap j gj
nnoremap k gk
" complementation
inoremap [ []<left>
inoremap ( ()<left>
inoremap { {}<left>
inoremap " ""<left>
inoremap ' ''<left>
" move window
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
colorscheme default
"colorscheme pyceberg
syntax enable
" ハイライトグループを知るコマンド:SyntaxInfoを実装
function! s:get_syn_id(transparent)
let synid = synID(line("."), col("."), 1)
if a:transparent
return synIDtrans(synid)
else
return synid
endif
endfunction
function! s:get_syn_attr(synid)
let name = synIDattr(a:synid, "name")
let ctermfg = synIDattr(a:synid, "fg", "cterm")
let ctermbg = synIDattr(a:synid, "bg", "cterm")
let guifg = synIDattr(a:synid, "fg", "gui")
let guibg = synIDattr(a:synid, "bg", "gui")
return {
\ "name": name,
\ "ctermfg": ctermfg,
\ "ctermbg": ctermbg,
\ "guifg": guifg,
\ "guibg": guibg}
endfunction
function! s:get_syn_info()
let baseSyn = s:get_syn_attr(s:get_syn_id(0))
echo "name: " . baseSyn.name .
\ " ctermfg: " . baseSyn.ctermfg .
\ " ctermbg: " . baseSyn.ctermbg .
\ " guifg: " . baseSyn.guifg .
\ " guibg: " . baseSyn.guibg
let linkedSyn = s:get_syn_attr(s:get_syn_id(1))
echo "link to"
echo "name: " . linkedSyn.name .
\ " ctermfg: " . linkedSyn.ctermfg .
\ " ctermbg: " . linkedSyn.ctermbg .
\ " guifg: " . linkedSyn.guifg .
\ " guibg: " . linkedSyn.guibg
endfunction
command! SyntaxInfo call s:get_syn_info()
" 挿入モードでクリップボードからペーストする時に自動でインデントさせないようにする
if &term =~ "xterm"
let &t_SI .= "\e[?2004h"
let &t_EI .= "\e[?2004l"
let &pastetoggle = "\e[201~"
function XTermPasteBegin(ret)
set paste
return a:ret
endfunction
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin("")
endif
" use vim-plug
call plug#begin()
"Plug 'tpope/vim-sensible'
Plug 'airblade/vim-gitgutter'
Plug 'bronson/vim-trailing-whitespace'
Plug 'jiangmiao/auto-pairs'
Plug 'junegunn/vim-peekaboo'
Plug 'Shougo/neosnippet.vim'
Plug 'reireias/vim-cheatsheet'
Plug 'scrooloose/syntastic'
Plug 'simeji/winresizer'
Plug 'thinca/vim-quickrun'
Plug 'Townk/vim-autoclose'
Plug 'tpope/vim-fugitive'
Plug 'vim-airline/vim-airline'
Plug 'Yggdroot/indentLine'
call plug#end()
let g:cheatsheet#cheat_file = '~/.cheatsheet.md'
let g:indentLine_setColors = 0
let g:syntastic_enable_signs = 1
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
let g:syntastic_javascript_checkers=['eslint']
let g:syntastic_python_checkers = ['flake8']