diff --git a/bundle/vim-chat/autoload/chat/windows.vim b/bundle/vim-chat/autoload/chat/windows.vim index 2ae3e2c2d..e208a2a55 100644 --- a/bundle/vim-chat/autoload/chat/windows.vim +++ b/bundle/vim-chat/autoload/chat/windows.vim @@ -35,6 +35,7 @@ let s:c_base = '>>> ' let s:c_begin = '' let s:c_char = '' let s:c_end = '' +let s:c_r_mode = 0 let s:msg_win_opened = 0 let s:last_channel = '' let s:current_channel = '' @@ -72,7 +73,14 @@ function! chat#windows#open() abort if char != "\" let s:complete_num = 0 endif - if char == "\" + if s:c_r_mode + if char =~# '^[a-zA-Z0-9"+:/]$' + let reg = '@' . char + let paste = get(split(eval(reg), "\n"), 0, '') + let s:c_begin = s:c_begin . paste + endif + let s:c_r_mode = 0 + elseif char == "\" call s:enter() elseif char ==# "\" " 向右移动光标 @@ -82,6 +90,9 @@ function! chat#windows#open() abort elseif char ==# "\" " ctrl+u clean the message let s:c_begin = '' + elseif char ==# "\" + call timer_start(2000, function('s:disable_r_mode')) + let s:c_r_mode = 1 elseif char == "\" " use complete str if s:complete_num == 0 @@ -190,6 +201,10 @@ function! s:get_str_with_width(str,width) abort return result endfunction +function! s:disable_r_mode(timer) abort + let s:c_r_mode = 0 +endfunction + function! s:get_lines_with_width(str, width) abort let str = a:str let lines = []