考虑将 Rails 开发从 TextMate 迁移到 vim。我需要什么?

发布于 2024-08-21 14:37:38 字数 605 浏览 5 评论 0原文

我几乎专门从事 Ruby on Rails 开发。我目前使用 TextMate 在 OS X 中进行开发。我运行了一个虚拟机来尽可能模拟我的应用程序将部署到的环境,并且我将 Samba 共享上的代码从 VM guest 装载到 OS X 中。从那里我使用 TextMate 打开并编写代码。

我开始认为,通过适当的插件和花时间学习,我可以直接在虚拟机上使用 vim 提高工作效率。现在我的 TextMate 基本上是库存的,尽管我确实发现 ProjectPlus 插件不可或缺。我正在寻找一些 vim 资源和插件的建议(如果这是正确的术语),以紧密模拟我不愿意在 TextMate 中放弃的功能。或者至少,有令人信服的理由让我愿意放弃它们。下面是一个简短的列表:

  • 能够让(最好是)可折叠的项目树始终可见或轻松切换。
  • 能够一目了然地查看 SCM 状态,无论是在此项目树中(最好)还是其他位置。 (如果这有什么区别的话,我几乎只使用 git。)
    • 能够在 vim 中查看并排差异也很棒
  • 能够随意搜索整个项目(我想 :stop; grep -nr; fg;会完成这个,除非有更好的方法来做到这一点。)
  • 代码完成,如果可能的话

I do Ruby on Rails development pretty much exclusively. I currently develop in OS X using TextMate. I have a virtual machine running to emulate as closely as possible the environment my app will be deployed into, and I mount the code on a Samba share into OS X from the VM guest. From there I open with TextMate and code away.

I'm beginning to think that with the proper plugins and time spent learning, I could be much more productive in vim directly on the VM. Right now my TextMate is basically stock, though I do find the ProjectPlus plugin indispensable. What I'm looking for are some suggestions of vim resources and plugins (if that's the right terminology) to closely emulate the features I am unwilling to give up in TextMate. Or at least, compelling reasons why I should be willing to give them up. Here's a short list:

  • Ability to have a (preferably) collapsible project tree visible either at all times or easily toggle-able.
  • Ability to see SCM status at a glance, either within this project tree (preferable) or otherwise. (I use git almost exclusively if this makes any difference.)
    • Being able to view a side-by-side diff from within vim would be great too
  • Ability to search through the entire project at will (I suppose :stop; grep -nr; fg; would accomplish this, unless there's a better way to do it.)
  • Code completion, if possible

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

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

发布评论

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

评论(10

挽袖吟 2024-08-28 14:37:39

我今天发表了一篇关于这个主题的扩展文章,其中解释了如何在 VIM 中复制 Textmate 的 100 个功能。它是大量时间研究的成果。

例如,我解释:

  • 如何复制项目抽屉
  • 如何管理选项卡
  • 如何执行 Rails 特定命令(让我们面对现实:很多 Textmate 用户都是 Rails 程序员)
  • 如何查找和替换
  • 如何进行项目范围搜索

阅读原文: Textmate 到 VIM

I published an extended post on this topic today, in which I explain how to replicate 100 features from Textmate within VIM. It's the product of a great deal of hours research.

For example I explain:

  • How to replicate a Project Drawer
  • How to manage tabs
  • How to do Rails specific commands (Lets face it: A lot of Textmate users are Rails programmers)
  • How to do find and replaces
  • How to do project wide searches

Read Original Article: Textmate To VIM

请远离我 2024-08-28 14:37:38

NERD Tree 插件为您提供了一个可折叠的项目树。就我个人而言,我发现 netrw 插件就足够了,而且通常会安装这个插件与维姆。虽然 NERD 树感觉好像它试图模拟其他 IDE(以及 TextMate 的项目抽屉)的行为,但我觉得 netrw 插件以 Vim 的方式做事。我建议您都尝试一下,看看您更喜欢哪一个。

fugitive 插件为 Vim 提供了一个 git 接口(参见 Vimcasts:部分1, 2, 3, 45) 。

ack 插件非常适合搜索整个项目。您需要阅读 Vim 的 quickfix 列表,以充分利用此功能。

TextMate 的单词补全由 escshift-esc 触发。在 Vim 中,您可以使用 ctrl自动完成 功能>-nctrl-p 处于插入模式。检查 :help ins-completion (很多!)更多信息。

我正在 vimcasts.org 上播放一系列有关学习 Vim 的截屏视频。我的背景是使用 TextMate,但我现在已经全职使用 Vim 一段时间了。当我写这篇文章时,我只看了 6 集,但我确实计划在未来的剧集中涵盖您提出的每个要点。我会尝试回来编辑这个答案,并在截屏视频可用时提供链接。

The NERD Tree plugin gives you a collapsible project tree. Personally, I find that the netrw plugin is more than sufficient, and this usually comes installed with Vim. Whereas the NERD tree feels as though it tries to emulate the behaviour of other IDEs (and TextMate's project drawer), I feel that the netrw plugin does things the Vim way. I suggest you try both out, and see which one you prefer.

The fugitive plugin provides a git interface to Vim (See Vimcasts: parts 1, 2, 3, 4 and 5).

The ack plugin is great for searching an entire project. You'll want to read up on Vim's quickfix list to get the most out of this.

TextMate's word completion is triggered with esc, and shift-esc. In Vim, you get similar autocomplete functionality using ctrl-n and ctrl-p in insert mode. Check :help ins-completion for (much!) more info.

I am running a series of screencasts about learning Vim over at vimcasts.org. My background is with TextMate, but I've been using Vim fulltime for a while now. As I write this, I'm only 6 episodes in, but I do plan on covering each of the points you've raised in future episodes. I'll try and come back to edit this answer with links to the screencasts as they become available.

蓝天白云 2024-08-28 14:37:38

我目前的处境与您类似(从 TextMate 迁移到 Vim)

一个非常好的资源是:

http://robots.thoughtbot.com/post/166073596/intro-rails-vim

祝你好运!

I'm currently in a similar position to you (moving from TextMate to Vim)

One really good resource is this:

http://robots.thoughtbot.com/post/166073596/intro-rails-vim

Good luck with it!

你列表最软的妹 2024-08-28 14:37:38

对于文件导航来说简直就是喜欢 CommandT
这个功能与 textmate 中深受喜爱的 commandT 功能非常相似。

For file navigation is simply love CommandT
This functions very much the same as the beloved commandT function in textmate.

情仇皆在手 2024-08-28 14:37:38

您可能想从我的 Ruby/Rails 相关 vimfiles 开始,其中包括对 rvm 和 git 的支持。

You might want to start with my Ruby/Rails related vimfiles which includes support for rvm and git.

天气好吗我好吗 2024-08-28 14:37:38

这个截屏视频也很棒 http://blip.tv/file/1372096

我确实使用 VIM 并且我特别喜欢如何从模型/视图和控制器相关的旋转。

This screencast is great as well http://blip.tv/file/1372096

I do use VIM and i specially like how to rotate from model/view and controller related..

仄言 2024-08-28 14:37:38

查看博客文章: 从 Textmate 到 VIM for Rails 编码员

那里的评论可能对您也很有价值。

Check out the blog post: From Textmate to VIM for Rails coders.

The comments there may also valuable for you.

荆棘i 2024-08-28 14:37:38

所有其他答案加上:

能够让(最好是)可折叠的项目树始终可见或轻松切换。

  • project.vim 插件的工作方式并不像 TextMate 的项目抽屉那样,但是很接近了。
  • 使用 NERDTree,您可以设置书签并使其工作起来有点像项目抽屉。
  • :help mkview:help mksession 也可以提供帮助。

能够一目了然地查看 SCM 状态,无论是在此项目树中(首选)还是其他位置。 (如果这有什么区别的话,我几乎只使用 git。)

  • vcscommand.vim 为多个SCM提供相同的命令集,它可以与Git、SVN、Mercurial一起使用...
  • 您可以使用前面提到的fugitive插件在状态行中显示Git状态,:help fugitive-statusline

能够在 vim 中查看并排差异也很棒

  • :Gdiff 命令就可以做到这一点。
  • 最近发布的一个名为 Gitv 的插件尝试在 Vim 中模拟 GitK。我非常喜欢它,而且作者的回复也很及时。在树视图中,点击 在另一个窗口中打开以前的提交,然后点击 D 查看双重差异。

代码完成(如果可能)

  • 如果您不需要自动完成,有一些解决方案 和 < code>就足够了,如果你想要“自动完成”,你可以尝试 这几个插件。我最喜欢的是 autocomplpop

All of the other answers plus:

Ability to have a (preferably) collapsible project tree visible either at all times or easily toggle-able.

  • The project.vim plugin doesn't really work like TextMate's Project drawer but it's close.
  • With NERDTree, you can setup bookmarks and make it work a little like a project drawer.
  • :help mkview and :help mksession can help, too.

Ability to see SCM status at a glance, either within this project tree (preferable) or otherwise. (I use git almost exclusively if this makes any difference.)

  • vcscommand.vim provides the same set of commands for multiple SCMs, it works with Git, SVN, Mercurial…
  • You can use the aforementioned fugitive plugin to display the Git status in the status line, :help fugitive-statusline.

Being able to view a side-by-side diff from within vim would be great too

  • fugitive provides the :Gdiff command that does just that.
  • A recently released plugin called Gitv tries to emulate GitK in Vim. I like it a lot and the author is very responsive. In the tree view, hit <CR> to open a previous commit in another window and D to see a double diff.

Code completion, if possible

  • There are a few solutions, if you don't need it to be automatic <C-x><C-o>, <C-n> and <C-p> will be more than enough, if you want "autocompletion" you may try these few plugins. My favorite is autocomplpop.
贪了杯 2024-08-28 14:37:38

此处搜索整个项目。

代码补全:通常使用 ctrl-X 然后 ctrl-O

Git 集成:git.vim

项目树:Nerdtree.vim

祝你好运

Search an entire project here.

Code completion: Normally done with ctrl-X then ctrl-O while in insert mode.

Git Integration: git.vim

Project Tree: Nerdtree.vim

Good luck

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