我不知道这是否可行,但仍然......没有伤害。
我正在使用Vim来编辑旧的和新的(.for和.f90)fortran文件。我正在尝试完成,类似于Visual Studio的,所以当我在文件中定义了几个子例程时:
subroutine init ( ibc, nquad, ul, ur, xl, xr )
subroutine output ( f, ibc, indx, nsub, nu, ul, ur, xn )
subroutine phi ( il, x, phii, phiix, xleft, xrite )
我把它们叫到某个地方:
call init(<cursor is here>
我得到了参数列表,所以我不必记住它们。如果我理解正确的VS称之为“智能感知”。
在Vim(GVim72)中是否有类似的东西,如果是,如何让它工作? 任何提示赞赏。
ldigas编辑: 如果我能获得申报行,我也会感到满意,比如说,当我输入时:
call init(<cursor is here>
并按完成键,Vim在整行中打孔,例如
call init( ibc, nquad, ul, ur, xl, xr )
ldigas edit2: 到目前为止已撤回2个答案......很有趣。
答案 0 :(得分:3)
最近的一个应该是vim intellisense。不幸的是,它还不支持Fortran ......
答案 1 :(得分:3)
部分答案:
哦,我得到了第一部分:Vim的整线完成由
调用<Ctrl-X, Ctrl-L>
(如果它在同一个文件中,顺便说一下,通常不是这样)
不幸的是,如果子程序声明看起来像是
call assemble ( adiag, aleft, arite, f, h, indx, nl, node, nu, nquad, &
nsub, ul, ur, xn, xquad )
(其中“&amp;”是续号)这种方式不起作用。有没有人(来自你的脚本vimmers)知道一种避免这种行为的方法?
答案 2 :(得分:2)
我认为你能得到的最接近的是一个与intellisense类似的vim功能,但是让你使用语法高亮文件作为基础。看一下我的.vimrc文件,以获取示例。基本上它为每个列出的类型设置自动完成:如果omnisense支持文件类型,它使用它,否则它使用语法高亮文件。
syntax on
colorscheme elflord
set tabstop=4
set shiftwidth=4
set nu!
set et!
filetype on
filetype plugin on
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType sql set omnifunc=sqlcomplete#Complete
autocmd FileType c set omnifunc=ccomplete#Complete
if has("autocmd") && exists("+omnifunc")
autocmd Filetype *
\ if &omnifunc == "" |
\ setlocal omnifunc=syntaxcomplete#Complete |
\ endif
endif
另一种可能性是查看vim.org网站。例如,我在那里找到了以下内容(即使它不是你正在寻找的那只是一个例子)
fortran_codecomplete.vim : Complete fortran constructs with
希望这有帮助
答案 3 :(得分:2)
快速&amp;脏:Exuberant CTAGS
VIM非常了解标签。不幸的是,这并不是你想要的那种光滑的行为:你最终会在窗户之间蹦蹦跳跳,但我觉得这很精彩,因为我什么都没有。
可能有用的是Photran,但我从未使用它。但是,由于它是开源的和可配置的,您可能会找到一个已经走在路上的人,例如,似乎有VIM plugin。 YMMV。