VIM下写Lisp,slime.vim配置使用小结

本文转自:http://nicklhy.blogspot.com/2012/04/vimlispslimevim.html

  年前因为学习Common Lisp而去尝试了一下Emacs(其实也就是跟着Tutorial走了一遍),发现还是用着不太顺手,但是在Vim下写Lisp的感觉又着实不好,以至 于读Lisp的快感竟然在那段时间远超于写代码了,还好最近找到一个叫slime.vim的插件,用着感觉很不错,总算能在Vim下舒服的写Lisp 了。。。由于在查找相关配置及使用方法时感觉中文资料几乎没有,没办法硬着头皮看了好一会英文的官方教程和帮助文档,在此简单记录一下以备日后所需。。。 汗

首先要做的必然是安装此插件了,ArchLinux可以直接yaourt -S vim-slimv安装,其他发行版软件源若是没有此插件的可以官网下载: http://www.vim.org/scripts/script.php?script_id=2531 ,下载完毕后照旧把所有文件解压到~/.vim里去。
下面可以开始测试是否安装成功。用Vim打开或新建一个Lisp文件,然后用",c"测试,如果Vim窗口里出现了一个新的buffer,并且里面是你熟悉的Lisp提示符,那么恭喜,说明安装完全正确,如果有报错的话,在~/.vimrc里添加一句话
let g:slimv_swank_cmd = '! xterm -e sbcl --load ~/.vim/slime/start-swank.lisp &'
这里选择的是sbcl,官方文档说也可以支持clisp等其他Lisp实现,比如改clisp的话就变成:
let g:slimv_swank_cmd = '! xterm -e clisp -i /home/leo/.vim/slime/start-swank.lisp &'

然后后面那个start-swank.lisp的完整路径很重要,具体可以参考文档,如果是yaourt安装的话,应该使用下面这句话:
let g:slimv_swank_cmd = '! xterm -e sbcl --load /usr/share/common-lisp/source/slime/start-swank.lisp &'
然后还应该确保系统中已经装了xterm软件。
现在再重复一下",c",此时应该可以正常出现那个Lisp的Buffer了
另外这个插件中一个括号自动补全的函数我感觉不太适应,可以用下面这句话取消:
let g:paredit_mode = 0

让Buffer在当前窗口右边,默认在上边
let g:slimv_repl_split = 4
下面是文档里快捷键的设置,我就不一一翻译了。。。


     Set#1     Set#2       Command
       ---------------------------------------------------
       ,,           ,,             Slimv Menu

       Edit commands (Insert mode):
       <C-X>0                     Close Form
       <Tab>                       Complete Symbol
       <Space>                   Function Arglist

       Edit commands (Normal mode):
       ,)           ,tc           Close Form
       ,(           ,(t           Paredit Toggle

       Evaluation commands:
["x],d   ["x],ed           Eval Defun (current top level form) [put in register x]
["x],e   ["x],ee           Eval Current expression_r(current subform) [put in reg. x]
["x],r   ["x],er           Eval Region (visual selection) [or text from register x]
       ,b           ,eb           Eval Buffer
       ,v           ,ei           Interactive eval_r(evaluates in frame when in SLDB)
       ,u           ,eu           Undefine Function

       Debug commands:
       ,1           ,m1           Macroexpand-1
       ,m           ,ma           Macroexpand All
       ,t           ,dt           Toggle Trace
       ,T           ,du           Untrace All
       ,B           ,db           Set Breakpoint
       ,l           ,dd           Disassemble
       ,i           ,di           Inspect (inspects in frame when in SLDB)
       ,a           ,da           Abort
       ,q           ,dq           Quit to Toplevel
       ,n           ,dc           Continue
       ,H           ,dl           List Threads
       ,K           ,dk           Kill Thread
       ,G           ,dg           Debug Thread

       Compile commands:
       ,D           ,cd           Compile Defun
       ,L           ,cl           Compile and Load File
       ,F           ,cf           Compile File
["x],R   ["x],cr           Compile Region [or text from register x]

       Cross Reference commands
       ,xc         ,xc           Who Calls
       ,xr         ,xr           Who References
       ,xs         ,xs           Who Sets
       ,xb         ,xb           Who Binds
       ,xm         ,xm           Who Macroexpands
       ,xp         ,xp           Who Specializes
       ,xl         ,xl           List Callers
       ,xe         ,xe           List Callees

       Profile commands:
       ,p           ,pp           Toggle Profile
       ,B           ,pb           Profile by Substring
       ,U           ,pa           Unprofile All
       ,?           ,ps           Show Profiled
       ,o           ,pr           Profile Report
       ,x           ,px           Profile Reset

       Documentation commands:
       ,s           ,ds           Describe Symbol
       ,A           ,da           Apropos
       ,h           ,dh           Hyperspec
       ,]           ,dt           Generate Tags

       Repl commands:
       ,c           ,rc           Connect to Server
       ,y           ,ri           Interrupt Lisp Process


       Set#1     Set#2       Command
       ---------------------------------------------------
       ,\           ,\             REPL Menu (separate menu, valid only for the REPL buffer)

       REPL menu commands:
       ,.           ,rs           Send Input
       ,/           ,ro           Close and Send Input
       ,g           ,rp           Set Package
       <C-C>     <C-C>       Interrupt Lisp Process
       ,<Up>     ,rp           Previous Input
       ,<Down> ,rn           Next Input
       ,z           ,rr           Refresh REPL Buffer
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值