代码之家  ›  专栏  ›  技术社区  ›  msorc

什么是用于Rails开发的有用的Emacs特性

  •  11
  • msorc  · 技术社区  · 16 年前

    3 回复  |  直到 16 年前
        1
  •  7
  •   Bozhidar Batsov    16 年前

    以前的两个版本 emacs-rails 模式,和 Rinari (Rails开发中最流行的两种模式)功能非常丰富,但是过于臃肿和繁琐。为了保持一个小巧,干净,可靠,功能性和可破解的核心瑞纳利将回避许多钟声和口哨类型的功能。不过,这并不是说这些额外的好处可能没有用处。

    这个页面应该作为一些其他工具/包的链接的封送处理点,这些工具/包通常可以很好地与Rinari和Rails一起工作。如果您对该列表中的新增功能或新的Rinari功能有任何想法,请访问 http://groups.google.com/group/emacs-on-rails .

    这些资料大多是从里纳里的文件中复制的。正如你可能猜到的,我更喜欢Rinary而不是emacs rails。从这两个项目的活动来看——EmacsRails大约一年来没有任何变化,而rinary仍在开发中。

        2
  •  4
  •   gregor    16 年前

    我用 emacs-rails 以及一些编辑css、js的模式( espresso-mode yas-snippet ). 有关概述,请查看emacs wiki pages on Ruby on Rails. .

        3
  •  0
  •   Teemu Leisti    13 年前

    我试过了 Aptana Studio IDE(开源),它处理Rails项目。我发现我主要使用它在Rails项目的文件中导航,而且由于我更喜欢使用Emacs来编辑文件,所以我暂时将Aptana放在一边。(但在以后进行调试时,它可能会派上用场,所以我不会完全忽略它。)

    projectile ,这是Bozhidar Batsov在上面的评论中提到的。它增加了在项目中查找文件和在其中重映射的便利性。它也不是只针对Rails项目的。

    tabbar 扩展,其工作方式有点像浏览器的选项卡栏。我将打开的选项卡之间的导航绑定到了M-leftarrow和M-rightarrow键,这使得在缓冲区之间切换比以前方便得多。

    继续使用Emcas,有 bubble-buffer (下面的代码),只需按一个键(在我的例子中是F5)就可以将缓冲区内容切换到最近访问过的文件——尽管 标签栏 这有点多余。我还提供了使用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)