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

类似于DrScheme的Ruby文本编辑器/IDE

  •  2
  • Slartibartfast  · 技术社区  · 17 年前

    对于那些没有使用DrScheme的人来说,窗口分为两部分:一部分是您正在编辑的文件,另一部分是交互式shell。当我运行一个文件时,它会被加载到交互环境中,这样我就可以调用我定义的函数等。交互式环境仍然具有文本编辑器的所有功能(语法高亮显示、自动补全等)

    2 回复  |  直到 16 年前
        1
  •  4
  •   fjom    17 年前

    正是这个要求(甚至直到Scheme博士提出了这个要求)最终促使我学习Emacs。

    1. http://ftp.gnu.org/gnu/windows/emacs/emacs-22.3-bin-i386.zip

    2. 解压后,创建一个 包含 将目录复制到任意位置 ruby-inf.el (这些是misc目录下的ruby发行版附带的,也可以从以下网址下载 Ruby's source

    3. 修改您的 告诉它在哪里可以找到你的内含物,并使用它们

    ; directory to put various el files into
    (add-to-list 'load-path "C:/emacs-22.3/includes")
    ;(1)modify .emacs to use ruby-mode 
    (autoload 'ruby-mode "ruby-mode"
      "Mode for editing ruby source files" t)
    (setq auto-mode-alist
          (append '(("\\.rb$" . ruby-mode)) auto-mode-alist))
    (setq interpreter-mode-alist (append '(("ruby" . ruby-mode))
                                  interpreter-mode-alist))
    ;(2)set to load inf-ruby and set inf-ruby key definition in ruby-mode. 
    
    (autoload 'run-ruby "inf-ruby"
      "Run an inferior Ruby process")
    (autoload 'inf-ruby-keys "inf-ruby"
      "Set local key defs for inf-ruby in ruby-mode")
    (add-hook 'ruby-mode-hook
          '(lambda ()
             (inf-ruby-keys)
    ))
    

    (可选)我也安装了 mode-compile.el http://perso.tls.cena.fr/boubaker/distrib/mode-compile.el

    ; Install mode-compile
    (autoload 'mode-compile "mode-compile"
       "Compile current buffer based on the major mode" t)
    (global-set-key "C-cc" 'mode-compile)
    (autoload 'mode-compile-kill "mode-compile"
     "Kill compilation launched by `mode-compile'" t)
    (global-set-key "C-ck" 'mode-compile-kill)
    

    通过这些更改,Emacs将自动将.rb文件识别为ruby,并进行语法高亮显示。然后,使用和弦\C-C\C-s(Control-C,release,然后Control-s)irb将在文件下方的框中开始,您可以使用inf-ruby定义的所有键:(\M是Meta键,在Windows中表示Alt)

      "\C-c\C-b" 'ruby-send-block
      "\C-c\M-b" 'ruby-send-block-and-go
      "\C-c\C-x" 'ruby-send-definition
      "\C-c\M-x" 'ruby-send-definition-and-go
      "\C-c\C-r" 'ruby-send-region
      "\C-c\M-r" 'ruby-send-region-and-go
      "\C-c\C-z" 'switch-to-ruby
      "\C-c\C-l" 'ruby-load-file
      "\C-c\C-s" 'run-ruby
    

        2
  •  1
  •   Sebastian    17 年前

    我还没有使用DrScheme,但Netbeans 6.5包含一个功能齐全的IRB。你试过了吗?

    推荐文章