恢复以前的 vim 会话后语法突出显示不起作用
因为每次划分和加载每个窗口有点麻烦,所以我使用:保存了我的会话
mksession ~/session1.vim
,并使用:恢复了它,
vim -S session1.vim
或者
source session1.vim
它完美地恢复了前一个会话,但根本不显示任何语法突出显示。
我在这里发现了类似的问题:终端中会话恢复后没有语法突出显示 但没有多大帮助。
有人知道吗?
since dividing and loading each windows every time are kinda bothersome, I saved my session using:
mksession ~/session1.vim
and restored it using:
vim -S session1.vim
or
source session1.vim
it restores the previous session perfectly, but doesn't show any syntax highlighting at all.
I found a similar question over here: No syntax highlighting after session restore in terminal
but doesn't help much.
does anyone have any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我也有同样的问题;如果我在 sessionoptions 中保存没有“选项”的会话,那么当我重新加载 Vim 时,缓冲区会重新加载,但不会突出显示语法。
解决方案是在重新加载时使用嵌套的 autocmd。
Wikia 有一篇内容丰富的文章关于加载和保存会话。底部提到了“嵌套”选项。
我使用 这个 StackOverflow 答案,如下:
I had the same problem; if I saved sessions without 'options' in sessionoptions, when I reloaded Vim, the buffers were reloaded, but without syntax highlighting.
The solution is to use an autocmd with nested when reloading.
Wikia has an extensive article about loading and saving sessions. The 'nested' option is mentioned at the bottom.
I use a modified version of this StackOverflow answer, here it is:
我可以使用 Obsession vim 插件和 Neovim 来解决这个问题。该线程中的答案帮助我找到了解决方案,尽管就我而言,此处提供的解决方案并未立即起作用。
我查看了 sessionoptions 帮助页面。对我来说,解决问题的设置是
set sessionoptions+=localoptions
。然后在配置中使用此选项重新加载 vim 并重新加载语法突出显示后,突出显示将保存在会话中。I can across this Issue using the Obsession vim plugin and Neovim aswell. The answer in this thread helped me finding the solution although in my case the solution provided here didn't work immediately.
I took a look at the sessionoptions help page. For me the setting that fixed the problem was
set sessionoptions+=localoptions
. Then after reloading vim with this option in the config and after reloading the syntax highlighting, the highlighting was saved in the session.我有同样的问题。我删除了会话文件,然后用 mks 重新创建了它,这解决了问题。可能是处于不一致的状态。
I had the same issue. I deleted my session file, I re-created it with mks and that fixed the issue. Probably it was in an inconsistent state.