是否可以使用类似于“vim关闭/退出”的-Event来执行vim退出之前的一些最后命令?
我在配置中使用这一行,让vim设置我的屏幕标题:
如果$TERM=='xterm-color‘
exe "set title titlestring=vim:%t“exe "set title t_ts=\k t_fs=\\”
endif
但是当我结束vim时,标题设置为:“感谢飞行Vim”(无论来自何方)。
我的目标是,将标题重置为旧的--如果可能的话--如果可能的话--设置为类似于使用"exe"-Command的"bash“。
所以..。在vim中有类似于“近距离事件”的东西吗?
谢谢:)
发布于 2009-11-04 13:18:39
是的,有一个“近距离事件”--实际上是其中两个。
引用vim的:help {event}:
Startup and exit
|VimEnter| after doing all the startup stuff
|GUIEnter| after starting the GUI successfully
|TermResponse| after the terminal response to |t_RV| is received
|VimLeavePre| before exiting Vim, before writing the viminfo file
|VimLeave| before exiting Vim, after writing the viminfo file你在追VimLeave-Event.
工作样本如下所示:
function! ResetTitle()
" disable vim's ability to set the title
exec "set title t_ts='' t_fs=''"
" and restore it to 'bash'
exec ":!echo -e '\033kbash\033\\'\<CR>"
endfunction
au VimLeave * silent call ResetTitle()此外,您还可以使用v:挂起捕捉异常退出情况。
https://stackoverflow.com/questions/1673649
复制相似问题