几个vim问题

发布于 2024-07-08 18:35:35 字数 465 浏览 7 评论 0原文

所以我希望一些老派的 Vim'ers 能够帮助我。 这些都是单独的问题,通常我会把它们单独提出,但我不确定这是否符合这里的问题。

另外,我认为如果您了解得足够多,可以提出这些问题,那么它们都会在不久的将来出现:

  1. 我正在编写一个库以及一系列使用该库的应用程序。 似乎没有一种简单的方法(据我所知)为库构建一个 ctags 文件 并为我的每个应用程序构建一个文件,并确保当我“时一个引用另一个”我在 vim 中。
  2. 使用 gf 从命令模式打开文件非常棒,但是我的很多包含文件 不包含完整路径。 它们引用了我在 IDE 中设置的包含目录。 如何将此目录设置为 Vim 开始查找文件的另一个点?
  3. 有没有办法在 Vim 中编译文件并将输出发送到缓冲区? 我目前正在使用 MSVS 2k3,但几周后我将移植到 Linux,因此如果这在任一系统上可行,我将不胜感激。

So I was hoping that some old school Vim'ers could help me out. These are all separate questions and normally I would put them up each on their own but I'm not sure if that qualifies as question whoring here.

Plus I think if you know enough to be asking any of these questions they will all be coming up in the near future:

  1. I have a library I'm writing and a series of applications that use that library. There doesn't seem to be an easy way(from what I can tell) to build a ctags file for the library and build one for each of my applications and make sure one references the other when I'm in vim.
  2. Using gf to open files from command mode is awesome, but a lot of my include files
    don't contain the full path. They refer to an include directory I set in the IDE. How can I set this directory as another point for Vim to start looking for files?
  3. Is there a way to compile a file inside Vim and send the output to a buffer? I'm currently using MSVS 2k3 but I'll be porting over to Linux in a few weeks so if this is possible on either system I'd appreciate it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

瀟灑尐姊 2024-07-15 18:35:35

回复 3)

如果你将 makefile 放在根目录中,你可以简单地写
:make

这将运行 make 并 (iirc) 将任何错误放入单独的缓冲区中,并使 vim 转到第一个编译错误。 从那里您可以使用 :next-error 导航所有错误行

另外,请参阅此页面
http://wiki.beyondunreal.com/Legacy:Vim


http://linux.byexamples.com/archives /287/perform-grep-and-make-in-vim/

了解如何在单独的控制台中显示结果的详细信息。

Re 3)

If you put a makefile in your root dir, you can simply write
:make

This will run make and (iirc) put any errors into a seperate buffer, and make vim goto the first compile error. From there you can navigate all erroring lines using :next-error

Also, see this page
http://wiki.beyondunreal.com/Legacy:Vim

and
http://linux.byexamples.com/archives/287/perform-grep-and-make-in-vim/

for details on how to show the result in a seperate console.

寂寞美少年 2024-07-15 18:35:35

1-标签文件是独立的,可以一起使用。 请参阅 :h 'tags'

我不知道构建标签文件的简单方法是什么。 我有一个包含使用我的两个插件的插件:

  • 一个 (草稿)插件知道如何更新 C++ 标记文件(应该很容易使其适应其他文件类型),
  • 以及另一个(local_vimrc) 帮助我定义目录本地 .vimrc。 因此,对于给定目录层次结构中的任何文件,我可以调整 &tags 选项以使用相关标记文件,以及将自动重建(或触发键绑定时)的当前标记文件。 (像项目这样的插件也应该可以做到这一点)

2- :h 'path'

3- :h :make

HTH。

1- tags files are independent, and can be used together. See :h 'tags'

I can't tell what is the easy way to build tags files. I have one that consists in using two plugins of mine:

  • one (draft) plugin that knows how to update C++ tags files (it should be easy to adapt it to other filetypes),
  • and another (local_vimrc) that helps me define directories-local .vimrc. Thus for any files within a given directory hierarchy, I can adapt the &tags options to use the relevant tag files, and the current tag file that will be rebuilt automatically (or when a keybinding is triggered). (Plugins like project should do the trick as well)

2- :h 'path'

3- :h :make

HTH.

独享拥抱 2024-07-15 18:35:35

2)

:cd {path}

寻求帮助:

:he cd

其他一些如 :lcd 可能更适合。 只需向下滚动该帮助页面即可。

2)

:cd {path}

For help:

:he cd

A few others like :lcd might be better suited. Just scroll down that help page.

风尘浪孓 2024-07-15 18:35:35

这是相当偏离主题的,但可能仍然有用:如果您经常使用 Visual Studio 并且喜欢 Vim,您可能需要查看 ViEmu。 这是我所见过的最好的 Vim 仿真 IDE,而且成本非常低。 :) 不,我没有得到佣金。 :P

This is rather off topic, but might still be useful: if you're using Visual Studio a lot and like Vim, you might want to look at ViEmu. It's the best Vim-emulation for any IDE I've yet seen, and the cost is really low. :) And no, I'm not getting a commission. :P

哀由 2024-07-15 18:35:35

这并不明显,但如果您打开目录而不是文件,则可以很好地浏览。

例如

:e。 (冒号-e-点)
:e ..(冒号-e-点-点)

将允许您从当前目录或其父目录进行浏览。

(了解您可能希望能够让 vim 接受例如

:e abc.txt

并让它在多个目录中查找,我不知道该怎么做。)

It's not obvious, but if you open a directory instead of a file, it's nicely browseable.

e.g.

:e . (colon-e-dot)
:e .. (colon-e-dot-dot)

will let you browse from your current directory or its parent.

(understanding that you were probably hoping for a capability to have vim accept e.g.

:e abc.txt

and have it look in several directories, which I don't know how to do.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文