在我的fortran折叠中发生了一些奇怪的事情。这是示例文件
module foo
contains
subroutine hello()
end subroutine hello
subroutine hello()
end subroutine
subroutine hello()
end subroutine
end module foo
subroutine hello()
end subroutine
subroutine hello()
end subroutine
subroutine hello()
end subroutine这是病毒
syntax on
au! BufRead,BufNewFile *.f90 setfiletype fortran
set foldmethod=syntax
let fortran_fold=1烦人之处如下。如果我在模块/结束模块块外剪切(dd)和粘贴(P)折叠子例程,则新粘贴的折叠保持关闭。如果将其粘贴到模块/端模块块中,则会出现新粘贴的折叠区域。你能重现这个问题(这里是7.2 )吗?你知道有什么解决办法吗?
发布于 2011-01-15 18:50:18
我认为这不是一个具体的fortran模块问题,而是一个一般性的问题。
有一个振尖,它为编辑文件时意外地打开折叠提供了解决方案。诀窍是在开始编辑时将foldmethod设置为manual:
autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif当您完成编辑(或离开窗口)时,将foldmethod重置为它的原始值:
autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endifhttps://stackoverflow.com/questions/3922267
复制相似问题