由于 Vimwiki 编辑 + 保存,tex 文件折叠不稳定 [英] Unstable folding with tex files due to Vimwiki editing + saving
问题描述
我正在使用 Vimwiki 和 LaTeX(使用 Vim-Latex-Suite.这是一个奇怪的观察:
I am using Vimwiki and LaTeX (Using Vim-Latex-Suite actively. Here goes one weird observation:
在存储在 ~\ftplugin
目录中的 tex.vim
文件中指定 setlocal nofoldenable
后,我摆脱了乳胶文件的折叠;在 vimwiki.vim
文件中也指定了相同的 setlocal
命令.
After having specified setlocal nofoldenable
in the tex.vim
file stored in ~\ftplugin
dir, I got rid of folding for latex files; Same setlocal
command had been also specifiecd in the vimwiki.vim
file.
但是,如果我执行以下操作,最终会得到一个连续折叠的 tex 文件:
However, if I do the following, I will end up with a continuously folded tex file:
(注意,在文件末尾的 ftplugin\*.vim
文件中设置 set nofoldenable
没有帮助;将这些设置移动到 _vimrc
也没有帮助禁用折叠问题.)
(Note, setting set nofoldenable
in the ftplugin\*.vim
file at the end of such file does not help; moving theses setting to the end of _vimrc
also did not help to disable the folding problem.)
- 打开
*.tex
文件; - 编辑并保存一个
*.wiki
文件(编辑保存时filetype
改为vimwiki
); - 打开一个新的 GVim.exe 会话并打开
*.tex
文件. 事实证明:
- Open
*.tex
file; - Edit and save a
*.wiki
file (thefiletype
changed to bevimwiki
when editing and saving); - Open a new GVim.exe session and open the
*.tex
file. It turns out that:
1) 所有章节和所有附属结构(小节、小节、段落、小段等)应已折叠;
1) All the sections and all subsidiary structures (subsection, subsubsection, paragraph, subparagraph, etc..) shall have been folded;
2) 保存并退出并重新启动 Gvim 会话将给出相同的折叠结构,无论折叠是否打开/删除;
2) Save and exiting and restarting Gvim session will give the same folded structure, regardless of whether foldings were opened/deleted or not;
3) 只要没有使用相同的 Gvim 会话保存 *.wiki
文件,将此类文件写入新位置将不会包含任何折叠.
3) Writing such file onto a fresh location will not contain any folding as long as no *.wiki
file is saved using the same Gvim session.
4) 在同一个 Gvim 会话中编辑和保存 *.wiki
文件会将新保存的文件发送回具有持久折叠结构的状态.
4) Editing and saving a *.wiki
file in the same Gvim session will send the newly saved file back to the state with persistent folding structure.
我不确定我是否应该包含 vim-scripts/restore_view 插件导致所有这些群众.
I am not sure if my including the vim-scripts/restore_view plugin should have lead to all these masses.
我还注意到,对*.tex
文件的污染是文件名特定的!(或绝对路径特定.)如果我将折叠的 *.tex
文件替换为干净目录中的精确副本,则无济于事,持久折叠仍然存在.只有当我重命名同一目录下的文件时才能解决折叠问题.
I also notice that, the pollution towards the *.tex
file is file-name specific! (or absolute-path specific.) It does not help if I replace the folded *.tex
file with its exact copy from a clean directory, the persistent folding remains. Only when I rename the file in the same directory will solve the folding issue.
截至目前,我只能在编写 *.tex
文件时限制自己编辑 *.wiki
文件.或者,在犯下在 Tex-Gvim 会话中编辑 *.wiki
文件"的罪行后重命名 *.tex
文件.
As of now, I can only restrain myself from editing a *.wiki
file when writing on a *.tex
file. Or, rename the *.tex
file after having commit the crime of "editing a *.wiki
file while in a Tex-Gvim session".
任何关于稳定折叠或保存一套手动折叠的想法也将非常有帮助!
Any thoughts on stabilizing the folding, or saving a set of manual folding will also be very helpful!
谢谢!
推荐答案
尝试在 viewoptions 中取消设置折叠.展开加载的 *.tex 文件后,在 vim 中运行以下命令,然后将文件另存为 wiki.
Try unsettings folds in viewoptions. Once you unfold a loaded *.tex file, run below command inside vim and then save your file as wiki.
:set viewoptions-=folds
我手头没有 Windows 系统,因此在建议之前无法自己尝试.对不起!:(
I don't have a windows system at hands, hence could not try it myself before suggesting. Sorry! :(
这篇关于由于 Vimwiki 编辑 + 保存,tex 文件折叠不稳定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!