-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc.plugin
168 lines (138 loc) · 5.51 KB
/
.vimrc.plugin
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
"--------------------------------------------------------------------
" vim-lightline
"--------------------------------------------------------------------
" export TERM=xterm-256color
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [['mode', 'paste'], ['fugitive', 'readonly', 'filename', 'modified']]
\ },
\ 'component_function': {
\ 'fugitive': 'MyFugitive'
\ }
\ }
function! MyFugitive()
return exists('*fugitive#head') ? fugitive#head() : ''
endfunction
" Start interactive EasyAlign in visual mode (e.g. vip<Enter>)
vmap <Enter> <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
"--------------------------------------------------------------------
" vim-fugitive
"--------------------------------------------------------------------
nnoremap <leader>gs :Gstatus<CR>
nnoremap <leader>ga :Gwrite<CR>
nnoremap <leader>gc :Gcommit<CR>
nnoremap <leader>gca :Gcommit -a<CR>
nnoremap <leader>gd :Gdiff<CR>
nnoremap <leader>gr :Gread<CR>
"--------------------------------------------------------------------
" vim-toggle
"--------------------------------------------------------------------
nmap <C-T> <Plug>ToggleN
vmap <C-T> <Plug>ToggleN
"--------------------------------------------------------------------
" vim-neosnippet
"--------------------------------------------------------------------
let g:neosnippet#snippets_directory = '~/.vim/snippets'
" Plugin key-mappings.
imap <C-x> <Plug>(neosnippet_expand_or_jump)
smap <C-x> <Plug>(neosnippet_expand_or_jump)
xmap <C-x> <Plug>(neosnippet_expand_target)
" SuperTab like snippets behavior.
imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: pumvisible() ? "\<C-n>" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: "\<TAB>"
" For snippet_complete marker.
if has('conceal')
set conceallevel=2 concealcursor=i
endif
nnoremap <Space>se :NeoSnippetEdit<CR>
"---------------------------------------------------------------------
" vim-neocomplte
"---------------------------------------------------------------------
let g:acp_enableAtStartup = 0
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#sources#syntax#min_keyword_length = 2
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
" Define dictionary.
let g:neocomplete#sources#dictionary#dictionaries = {
\ 'default' : ''
\ }
" Define keyword.
if !exists('g:neocomplete#keyword_patterns')
let g:neocomplete#keyword_patterns = {}
endif
let g:neocomplete#keyword_patterns['default'] = '\h\w*'
" Plugin key-mappings.
inoremap <expr><C-g> neocomplete#undo_completion()
inoremap <expr><C-l> neocomplete#complete_common_string()
" Recommended key-mappings.
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><C-y> neocomplete#close_popup()
inoremap <expr><C-e> neocomplete#cancel_popup()
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
" Enable heavy omni completion.
if !exists('g:neocomplete#sources#omni#input_patterns')
let g:neocomplete#sources#omni#input_patterns = {}
endif
"let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
"let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
"---------------------------------------------------------------------
" vim-unite:
"---------------------------------------------------------------------
nnoremap [unite] <Nop>
nmap <leader>u [unite]
" ファイル一覧
nnoremap <silent> [unite]f :<C-u>UniteWithCurrentDir -buffer-name=files file file/new<CR>
" 最近使用したファイル一覧
nnoremap <silent> [unite]h :<C-u>Unite file_mru<CR>
" snippet一覧
nnoremap <silent> [unite]s :<C-u>Unite snippet<CR>
" ファイル名検索
"call unite#filters#matcher_default#use(['matcher_fuzzy'])
nnoremap <silent> [unite]d :<C-u>Unite file_rec/git<CR>
" grep
nnoremap <silent> [unite]g :<C-u>Unite grep/git<CR>
" ショートカット
map <Space>f :tabedit<CR>[unite]f
map <Space>h :tabedit<CR>[unite]h
map <Space>s :tabedit<CR>[unite]s
map <Space>d :tabedit<CR>[unite]d
map <Space>g :tabedit<CR>[unite]g
autocmd FileType unite call s:unite_my_settings()
function! s:unite_my_settings()"{{{
" Overwrite settings.
" ESCキーを2回押すと終了する
nmap <buffer> <ESC> <Plug>(unite_exit)
nmap <buffer> <ESC><ESC> <Plug>(unite_exit)
imap <buffer> jj <Plug>(unite_insert_leave)
nnoremap <silent><buffer> <C-k> :<C-u>call unite#mappings#do_action('preview')<CR>
imap <buffer> <C-w> <Plug>(unite_delete_backward_path)
endfunction"}}}
call unite#custom#profile('default', 'context', {
\ 'start_insert': 1,
\ 'ignore_case': 1,
\ 'smart_case': 1
\})
"---------------------------------------------------------------------
" vim-session
"---------------------------------------------------------------------
" vimを辞める時に自動保存
let g:session_autosave = 'yes'
" 引数なしでvimを起動した時にsession保存ディレクトリのdefault.vimを開く
let g:session_autoload = 'yes'
" 1分間に1回自動保存
let g:session_autosave_periodic = 1