-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunc.vim
More file actions
31 lines (26 loc) · 806 Bytes
/
func.vim
File metadata and controls
31 lines (26 loc) · 806 Bytes
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
" 插入当前时间
func! GetTimeInfo()
"return strftime('%Y-%m-%d %A %H:%M:%S')
return strftime('%Y-%m-%d %H:%M:%S')
endfunction
inoremap <c-q>sj <C-r>=GetTimeInfo()<cr>
" 与其他应用协作
function! ToggleInteractive()
if !exists('#InteractiveGroup#BufEnter')
setlocal autoread
augroup InteractiveGroup
autocmd!
au FocusGained,BufEnter <buffer> :silent! ! "trigger reload
au TextChanged,InsertLeave <buffer> if &readonly == 0 | silent write | endif
" au FocusLost,WinLeave * :silent! noautocmd w "do not trig other auto
augroup END
echo 'Interactive ON'
else
setlocal noautoread
augroup InteractiveGroup
autocmd!
augroup END
echo 'Interactive OFF'
endif
endfunction
nnoremap <F4> :call ToggleInteractive()<CR>