惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
L
LangChain Blog
aimingoo的专栏
aimingoo的专栏
IT之家
IT之家
B
Blog
博客园_首页
博客园 - 司徒正美
有赞技术团队
有赞技术团队
博客园 - 聂微东
I
InfoQ
美团技术团队
GbyAI
GbyAI
阮一峰的网络日志
阮一峰的网络日志
H
Help Net Security
大猫的无限游戏
大猫的无限游戏
MyScale Blog
MyScale Blog
WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Cloudflare Blog

jdhao's digital space

Conversion between base64 and OpenCV or PIL Image 腾讯云对象存储博客图床开启 CDN 加速(不需要购买额外域名) Search and Replace in Multiple Files in Vim/Neovim Change Table Column Width in LaTeX Image or Table Side by Side in LaTeX LaTeX 并排显示图像或表格 Firenvim: Neovim inside Your Browser Content inside HTML tags missing in Latest Hugo? Creating Markdown Front Matter with Ultisnips Labelme JSON 标注格式转 voc XML 格式 Nifty Nvim Techniques That Make My Life Easier -- Series 6 macOS 下如何为视频制作字幕 Running Command Asynchronously inside Neovim Resolving Merge Conflict after Git Stash Pop Pylint: command not found? A Hands-on Experience with Neovim's Built-in LSP Support How to Convert PDF to Images with Imagemagick 互联网上常用缩略语集锦 File Backup in Neovim Converting PDF Pages to Images with Poppler Nifty Nvim Techniques That Make My Life Easier -- Series 5 Neovim Configuration for System-wide Use How to sort a list of tuple or list in Python -- lambda or itemgetter? Building A Vim Statusline from Scratch 人类第一颗原子弹爆炸始末 Distributed Training in PyTorch with Horovod Learning Expect Programming Essential Knowledge about SSH Nifty LaTeX Techniques -- Series 1 更改 Adsense 邮寄地址,重新寄送 PIN
Set Up Lisp Dev Environment in Neovim
2020-11-08 · via jdhao's digital space

A quick summary on how to set up Lisp Development environment in Neovim.

First we need to install a Lisp distribution. sbcl is a good start.

Install sbcl#

Install using package manager#

On Linux, we can install sbcl using package manager:

sudo apt update && sudo apt install sbcl

# or use the following for CentOS
# yum install sbcl

Install binary release#

We can also install a binary release if we do not have root right. All binary releases can be found here. One caveat is that if you install the latest version of sbcl and run it, it may not run due to dependency issues.

For example, on my system (CentOS 7.4), running sbcl fails since it requires a newer libc.so. It complains that:

sbcl: /lib64/libc.so.6: version `GLIBC_2.28’ not found (required by sbcl)

The following steps are tested on CentOS 7.4 and works as expected.

wget https://master.dl.sourceforge.net/project/sbcl/sbcl/1.4.14/sbcl-1.4.14-x86-64-linux-binary.tar.bz2
tar xvf sbcl-1.4.14-x86-64-linux
cd sbcl-1.4.14-x86-64-linux
INSTALL_ROOT=$HOME/tools/sbcl sh install.sh

Also update PATH and SBCL_HOME env variable

export PATH="$HOME/tools/sbcl/bin:$PATH"
export SBCL_HOME="$HOME/tools/sbcl/lib/sbcl"

Install quicklisp#

Quicklisp is a package manager for Lisp. Here is how to install it.

On the command line:

curl -O https://beta.quicklisp.org/quicklisp.lisp
sbcl --load quicklisp.lisp

Then inside REPL, run:

(quicklisp-quickstart:install :path "~/.quicklisp")

This will install quicklisp under ~/.quicklisp.

Also inside REPL, run:

This will load quicklisp every time you start your Lisp.

Fix arrow key issues#

By default, inside sbcl, we can not use up and down arrow keys to navigate the history. There is also no support for tab completion. We can use the package linedit to fix this.

Inside REPL, run (ql:quickload "linedit") to install this package. Add the following settings to ~/.sbclrc to load linedit by default when starting sbcl:

;;; Check for --no-linedit command-line option.
(if (member "--no-linedit" sb-ext:*posix-argv* :test 'equal)
    (setf sb-ext:*posix-argv*
      (remove "--no-linedit" sb-ext:*posix-argv* :test 'equal))
    (when (interactive-stream-p *terminal-io*)
      (require :sb-aclrepl)
      (require :linedit)
      (funcall (intern "INSTALL-REPL" :linedit) :wrap-current t)))

Ref:

https://common-lisp.net/project/linedit/

Install vlime#

Finally, install the Vim plugin vlime using vim-plug:

Plug 'vlime/vlime', {'rtp': 'vim/'}

Then run sbcl sbcl --load path/to/vlime_plugin/vlime/lisp/start-vlime.lisp to start the vlime server. The actual path depends on where you install your plugins.

Some handy shortcuts provided by Vlime:

  • \cc: create a server connection.
  • \cs: choose a server connection.
  • \ss: send the current line to REPL for evaluation.
  • \i: toggle interactive mode (in interactive mode, press <CR> will execute the code)

References#