Vim命令日志 [英] Vim commands log
问题描述
是否可以记录我在VIM中键入的所有命令以供以后分析?我的意思是每个简单的命令,例如动作或更改文本,即jjjjjjkkkcw<newword>
Is it possible to log all commands I type in VIM for later analyzing? I mean each simple command like motions or changing the text, i.e. jjjjjjkkkcw<newword>
如果在VIM中无法实现,也许Linux上有一个键盘记录器,可以将其附加到特定的窗口/进程?
If it is not possible in VIM, maybe there is a keylogger on linux, which can be attached to specific window/process?
我更喜欢在vim中进行日志记录,因为它可以选择为不同的vim模式设置不同的日志.另外,我也不想记录冒号"命令.
I'd prefer in-vim logging, because it could have options to have different logs for different vim modes. Also I don't want to log "colon" commands.
推荐答案
是的!启动vim时,使用vim -W ~/vimcommands.log
到>>到文件,或使用-w
覆盖文件.
Yes, there is! When launching vim use vim -W ~/vimcommands.log
to >> to a file, or -w
to overwrite the file.
-w {scriptout} 您键入的所有字符都记录在文件{scriptout}中,直到退出Vim. 如果您想创建一个脚本文件来与"vim -s"或:source!"一起使用,这将很有用. 如果{scriptout}文件存在,将附加字符. -W {scriptout} 类似于-w,但是现有文件将被覆盖.
-w {scriptout} All the characters that you type are recorded in the file {scriptout}, until you exit Vim. This is useful if you want to create a script file to be used with "vim -s" or ":source!". If the {scriptout} file exists, characters are appended. -W {scriptout} Like -w, but an existing file is overwritten.
您可能想要添加bash别名以基于文件名存储vim日志.我很想知道您打算如何分析日志,我想这样做.
You may want to add a bash alias to store vim logs based on file name. I am interested to see how you intend to analyse your logs, I would like to do the same.
这篇关于Vim命令日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!