在vim中显示函数参数 [英] show function parameters in vim

查看:404
本文介绍了在vim中显示函数参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在vim中是否有办法获得带有函数参数的弹出窗口? (如在视觉工作室/光滑编辑中)

Is there a way in vim to get a popup window with function parameters? (like in visual studio / slick edit)

例如。当我键入function_name(vim将打开一个弹出窗口(比如在新版本中执行 ctrl -n )并向我显示函数参数以及其中哪一个我'我正在打字。

e.g. when i type "function_name(" vim will open a popup window (like when doing ctrl-n in new versions) and show me the function parameters and which one of them I'm currently typing.

ps


  1. 我正在寻找比 ctrl-w ctrl - ]

我也在寻找类似的功能,在输入var->或var时会显示可用成员列表。

I'm also looking for a similar functionality that will show me list of available members when typing "var->" or "var."

我正在使用C


推荐答案

正如已经建议的那样,安装 autocomplpop 插件。然后,
触发omincompletion当您键入C文件时,可以将以下内容添加到.vimrc中:

As was already suggested, install the autocomplpop plugin. Then, to trigger omincompletion as you type for C files, you could add the following to your .vimrc:

let g:AutoComplPop_Behavior = { 
\ 'c': [ {'command' : "\<C-x>\<C-o>",
\       'pattern' : ".",
\       'repeat' : 0}
\      ]  
\}

如果您不想为键入的每个字符触发omnicompletion,请更改模式值以满足您的需要。有关如何进一步自定义的信息,请查看autocomplpop.vim的注释标题中的文档

If you don't want to trigger omnicompletion for every character typed, change the pattern value to suit your needs. For information on how to further customize, look at the documentation in the comment header of autocomplpop.vim

此外,要获得带有函数参数的弹出窗口,还要添加以下内容:你的.vimrc:

Moreover, to get a popup window with function parameters also add the following to your .vimrc:

let g:AutoComplPop_CompleteoptPreview = 1

为了使其正常工作,请确保使用ctags生成标签文件。

To make it work make sure you generated a tags file with ctags.

这篇关于在vim中显示函数参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆