【发布时间】:2010-05-04 15:15:47
【问题描述】:
哪些 Emacs 功能、包、附加组件等可以帮助您进行日常 Ruby On Rails 开发?
【问题讨论】:
-
逗号太多了。它是正确命名法中的 C-x C-c
标签: ruby-on-rails ruby emacs
哪些 Emacs 功能、包、附加组件等可以帮助您进行日常 Ruby On Rails 开发?
【问题讨论】:
标签: ruby-on-rails ruby emacs
emacs-rails 模式和Rinari(Rails 开发中最流行的两种模式)的早期版本功能非常丰富,但臃肿且笨重。为了保持一个小巧、干净、可靠、实用且可破解的核心,Rinari 将避开许多“花里胡哨”类型的功能。然而,这并不是说这些额外的好东西可能没有用。
这个页面应该作为链接到其他一些工具/包的链接点,这些工具/包通常可以很好地与 Rinari 和 Rails 一起工作。如果您对添加到此列表或 Rinari 新功能有任何想法,请通过 http://groups.google.com/group/emacs-on-rails 告诉我们。
使用 Rails 的基本主要模式
Ruby 模式和其他一些通用模式 Ruby-Emacs 的好东西可以在 ruby 的 /misc 目录 分布和在 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/misc/(它也默认与 Emacs 23.1 捆绑在一起)
CSS 模式 http://www.emacswiki.org/cgi-bin/emacs/css-mode-simple.el
JavaScript 模式 http://www.emacswiki.org/cgi-bin/wiki/JavaScriptMode#toc1 其他工具
Rhtml 模式次要编辑模式 rhtml 文件(没有 MMM 模式)请参阅 rhtml-模式
片段 http://code.google.com/p/yasnippet/ 和 Rails sn-ps http://github.com/eschulte/yasnippets-rails/tree/master
ruby 调试支持 http://groups.google.com/group/emacs-on-rails/browse_thread/thread/dfaa224905b51487
ido 模式 http://www.emacswiki.org/cgi-bin/wiki/InteractivelyDoThings
nxhtml-mode - Emacs 中 Web 开发的最佳模式 - 用于编辑 erb 文件的 rhtml 模式的绝佳替代品。
大部分内容都是从 Rinari 的文档中复制而来的。正如您可能已经猜到的那样,我更喜欢 Rinary 而不是 emacs-rails。查看这两个项目的活动 - emacs-rails 大约一年没有任何变化,而 rinary 仍在开发中。
【讨论】:
projectile 扩展为我提供了我需要的项目导航功能,而我并不真正关心 Rinari 的其余功能。
projectile 的答案。顺便说一句,你太谦虚了,没有提到这是你的工作。 :)
我使用emacs-rails 和一些模式来编辑 css、js (espresso-mode)、haml、sass、yaml 和 sn-p 模式 (yas-snippet)。有关概览,请查看 emacs wiki pages on Ruby on Rails.。
【讨论】:
我尝试了处理 Rails 项目的 Aptana Studio IDE(开源)。我发现我主要使用它在 Rails 项目的文件中导航,而且由于我更喜欢使用 Emacs 来编辑文件,所以我暂时将 Aptana 放在一边。 (但它可能会在稍后进行调试时派上用场,所以我并没有完全忽略它。)
我最近尝试了不同的 Emacs 扩展来帮助 Rails 开发:ECB(Emacs 代码浏览器)、Rinari 以及我忘记的其他一些东西,但没有一个我完全满意,或者无法正常工作。但是,我现在很高兴使用 Bozhidar Batsov 在上面的评论中提到的 projectile。它增加了在项目中查找文件并在其中查找文件的便利。它也不仅仅针对 Rails 项目。
我最近发现的另一个非常有用的 Emacs 插件是 tabbar 扩展,它的工作方式有点像浏览器的标签栏。我已将打开选项卡之间的导航绑定到我的 M-leftarrow 和 M-rightarrow 键,这使得在缓冲区之间切换比以前更方便。
继续使用 Emcas,有 bubble-buffer(下面的代码),我只需按一个键(在我的情况下为 F5)即可将缓冲区内容切换到最近访问过的文件——尽管 tabbar 使这有点多余。我还包括使用 C-DEL 立即终止缓冲区的代码,以及几个不错的小功能,可以在保持点不变的同时上下滚动缓冲区,只要它不偏离屏幕;此处的代码将它们绑定到数字键盘的* 和/。 (这些都不是我自己的作品。)
;; Use F5 to switch between buffers. Use C-DEL to remove the current buffer
;; from the stack and retrieve the next buffer. The most-frequented buffers are
;; always on the top of the stack. (Copied, with changes and a bugfix, from
;; http://geosoft.no/development/emacs.html.)
(defvar LIMIT 1)
(defvar time 0)
(defvar mylist nil)
(defun time-now ()
(car (cdr (current-time))))
(defun bubble-buffer ()
(interactive)
(if (or (> (- (time-now) time) LIMIT) (null mylist))
(progn (setq mylist (copy-alist (buffer-list)))
(delq (get-buffer " *Minibuf-0*") mylist)
(delq (get-buffer " *Minibuf-1*") mylist)))
(bury-buffer (car mylist))
(setq mylist (cdr mylist))
(setq newtop (car mylist))
(switch-to-buffer (car mylist))
(setq rest (cdr (copy-alist mylist)))
(while rest
(bury-buffer (car rest))
(setq rest (cdr rest)))
(setq time (time-now)))
(global-set-key [f5] 'bubble-buffer)
(defun kill-buffer-without-questions ()
;; Kill default buffer without the extra emacs questions
(interactive)
(kill-buffer (buffer-name)))
(global-set-key [C-delete] 'kill-buffer-without-questions)
;; Scroll up and down without moving the cursor by pressing the numeric keypad's
;; "/" and "*" keys.
(defun scroll-down-keep-cursor ()
;; Scroll the text one line down while keeping the cursor
(interactive)
(scroll-down 1))
(defun scroll-up-keep-cursor ()
;; Scroll the text one line up while keeping the cursor
(interactive)
(scroll-up 1))
(global-set-key [kp-divide] 'scroll-down-keep-cursor)
(global-set-key [kp-multiply] 'scroll-up-keep-cursor)
【讨论】: