如何在 Vim 中查看旧的状态消息?

Ray*_*yne 9 vim

我有一种感觉,如果我知道这里的正确术语,我就不需要问这个问题,谷歌就足够了。唉。

使用http://www.vim.org/scripts/script.php?script_id=2423,当我运行 ':Gist' 命令时,插件会在终端窗口底部打印指向要点的链接通常输入命令。我不确定这叫什么。我无法在那里选择文本,因此无法复制它,当我做其他事情时,文本消失并被普通模式文本替换。

我知道有 q: 用于查看旧命令,但是有什么方法可以查看旧消息,例如 gist.vim 吐出的消息?或者至少有什么神奇的方式可以让我在做其他事情之前复制那个漂亮的文字然后它消失?

如果相关,我在 OS X Lion 上并在 iTerm 中运行 Vim。没什么特别的。

Eri*_* Hu 17

由于不同的插件,我正在为您的问题寻找任何答案。我偶然发现了:h message.

如果您的 vim 窗口仍处于打开状态,您似乎可以点击g<查看最后一条消息。

我认为:messages也有效。


Jin*_*Jin 3

在 中:help Gist,有一个设置可以自动将要点链接复制到剪贴板:Gist -c

If you set g:gist_clip_command, gist.vim will copy the gist code with option '-c'.

Mac:

let g:gist_clip_command = 'pbcopy'

Linux:

let g:gist_clip_command = 'xclip -selection clipboard'

Others (cygwin?):

let g:gist_clip_command = 'putclip'
Run Code Online (Sandbox Code Playgroud)

将此添加到您的中~/.vimrc,您就可以开始了。

编辑:

找到了一个黑客解决方案。

进入gist.vim并找到这个功能。

function! s:GistPost(user, token, content, private)

  " find GistID: in content, then we should just update

  ...  

  let location = substitute(location, '^[^:]\+: ', '', '')
  if len(location) > 0 && location =~ '^\(http\|https\):\/\/gist\.github\.com\/'
    redraw
    echo 'Done: '.location
  else

  ...

  return location
endfunction
Run Code Online (Sandbox Code Playgroud)

改成。echoechomsg

  if len(location) > 0 && location =~ '^\(http\|https\):\/\/gist\.github\.com\/'
    redraw
    echomsg 'Done: '.location
Run Code Online (Sandbox Code Playgroud)

现在重新启动 vim,输入 后:Gist,键入:message以从消息历史记录中获取链接。消息历史记录记录该会话的所有echomsg内容。echoerr