使用 VIM 编程方案(Racket) - 如何开始

发布于 2024-10-22 13:16:48 字数 322 浏览 5 评论 0原文

最近,我开始在DrRacket中编写Racket(以前的Scheme)。 我很快就开始想念 DrRacket 中 VIM 的所有功能,所以我想 使用 VIM 进行我的方案(球拍)编程。

我知道 Emacs 可能是密集 Lisp 编程的最佳选择,但所有 我想要的是编写一个方案(球拍)文件检查语法,然后运行它。

不幸的是,我不知道如何在命令行中调用“racket” 在文件上使其执行与 DrRacket 相同的操作。

我正在运行 Ubuntu 10.10 Maverick Meerkat,VIM 7.3,我下载并 从官方网站安装 Racket。

帮助入门将非常感激。

recently, I started programming Racket (formerly Scheme) in DrRacket.
I quite fast I began to miss all the features of VIM in DrRacket, so I would like
to use VIM for my scheme(racket) programming.

I know that Emacs might be the best choice for intense lisp programming, but all
I want is write a scheme(racket) file check syntax and then run it.

Unfortunately, I could not figure out, how to invoke "racket" in the commandline
on a file to get it doing the same as DrRacket.

I am running Ubuntu 10.10 Maverick Meerkat, VIM 7.3 and I downloaded and
installed Racket from the official website.

Help to get started would be very appreciated.

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

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

发布评论

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

评论(3

や三分注定 2024-10-29 13:16:48

如果您只想在命令行上将文件加载到 Racket 中并运行它,我认为这应该可行:

$ racket -f file.scm -i

-i 选项将使您在 REPL 中测试您的代码 文件.scm

但是,您可能想看看这篇博客文章:

http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/

您可以设置运行命令行 Racket 的 GNU 屏幕会话,并向其发送 s-表达式来自维姆。有一个指向 Vimscript 的链接,可以使此操作自动进行。我在 mit-scheme 中使用了一段时间,它相当有效。但它并不像 SLIME 或 DrRacket 那么强大。我刚刚在 OS X 上测试了描述的步骤,它适用于命令行球拍,它应该适用于 Ubuntu,这就是我第一次使用此方法时所使用的。

您可能还想看看这个:

http://evalwhen.com/scmindent/index.html< /a>

... 其中有一些有关 Vim 中 Lisp 和 Scheme 代码更好缩进的信息。

我最终改用了 Emacs,但不要让 Vim 的讨厌者让你失望。 Paul Graham 据说使用 vi,他一定是最杰出的 5 位 Lisp 程序员之一。

http://paul.graham.usesthis.com/

If you just want to load a file into Racket on the command-line and run it, I think that this should work:

$ racket -f file.scm -i

The -i option would leave you at the REPL to test your code in file.scm.

However, you might want to take a look at this blog post:

http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/

You can set up a GNU screen session running the command-line Racket, and send s-expressions to it from Vim. There's a link to a bit of Vimscript which will make this automatic. I used this for a while with mit-scheme, and it was reasonably effective. It's not quite the as powerful as SLIME or DrRacket though. I just tested the steps described on OS X and it works with the command-line racket, it should work on Ubuntu, that's what I was using when I first used this method.

You might also want to take a look at this:

http://evalwhen.com/scmindent/index.html

... which has some information on better indentation in Vim for Lisp and Scheme code.

I eventually switched to Emacs, but don't let the Vim haters get you down. Paul Graham supposedly uses vi and he's gotta be one of the top 5 most prominent Lisp programmers.

http://paul.graham.usesthis.com/

梦屿孤独相伴 2024-10-29 13:16:48

有几个附加组件可以使 Vim 中的 Racket 编码更加令人满意。

  • Vim 的 lisp 模式 (set lisp) - 改进了缩进和 w/e/b 单词的一些基础知识 -跳跃。
  • vim-racket -- 功能和语法的大量 vim 语法识别
  • syntastic -- 保存时识别错误(vim-racket 设置 makeprg 使其工作)
  • 彩虹括号 - 设置您自己的括号颜色以获得最大对比度!
  • vim-slime -- 与 Tmux 将 Vim 连接到 Racket REPL
  • surround -- 将表单和元素括在括号中
  • 针对普通人的 vim-sexp
  • 摩洛凯岛配色方案 -- 高对比度
  • VROD* -- 基于 K 的 Vim 文档,以及自动完成 Racket 功能
  • REPTL* -- 非常简单的连续机架单元测试运行器

我更喜欢 slime 而不是 slimv 因为它的简单性。

Vundle,这里有一种安装大多数提到的附加组件的方法:

Plugin 'tpope/vim-surround.git'
Plugin 'kien/rainbow_parentheses.vim'
Plugin 'scrooloose/syntastic.git'
Plugin 'MicahElliott/vrod'
Plugin 'guns/vim-sexp'
Plugin 'tpope/vim-sexp-mappings-for-regular-people'
Plugin 'wlangstroth/vim-racket'
Plugin 'tomasr/molokai.git'

如果您使用 将它们放入您的 ~/.vimrc 中,然后调用进行安装:

% vim +PluginInstall +qall

这是显示其中大部分内容的屏幕截图:

在此处输入图像描述

(* 披露:我编写了 VROD 和 REPTL ,而且它们还不成熟)

另外,这里是描述 Vim/SICP 设置的相关博客文章

Several add-ons are available to make coding in Racket more satisfying with Vim.

  • Vim’s lisp mode (set lisp) -- improves some basics for indenting and w/e/b word-hopping.
  • vim-racket -- sizable set of vim-syntax recognition for functions and syntax
  • syntastic -- identify errors upon save (vim-racket sets makeprg for this to work)
  • Rainbow Parentheses -- set your own paren colors for maximal contrast!
  • vim-slime -- use with Tmux to connect Vim to a Racket REPL
  • surround -- wrap forms and elements in parens
  • vim-sexp for normal people
  • Molokai color scheme -- high contrast
  • VROD* -- K-based Vim documenation, and auto-completion of Racket functions
  • REPTL* -- very simple continuous rackunit test runner

I prefer slime over slimv for its simplicity.

If you are using Vundle, here is a way to install most of the add-ons mentioned:

Plugin 'tpope/vim-surround.git'
Plugin 'kien/rainbow_parentheses.vim'
Plugin 'scrooloose/syntastic.git'
Plugin 'MicahElliott/vrod'
Plugin 'guns/vim-sexp'
Plugin 'tpope/vim-sexp-mappings-for-regular-people'
Plugin 'wlangstroth/vim-racket'
Plugin 'tomasr/molokai.git'

Put those into your ~/.vimrc, and then invoke to install:

% vim +PluginInstall +qall

Here is a screenshot showing off most of these:

enter image description here

(* disclosure: I wrote VROD and REPTL, and they are immature)

Also, here is a related blog post describing a Vim/SICP setup.

断桥再见 2024-10-29 13:16:48

大约一周前,SLIMV(SLIME for Vim)支持 Racket。 SLIMV 通常被认为是目前 Vim 最成熟的 Lisp 环境。

As of about a week ago, SLIMV (SLIME for Vim) supports Racket. SLIMV is generally regarded as the most mature Lisp environment for Vim at the moment.

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