陈斌彬的技术博客

Stay foolish,stay hungry

Slap-editor

Slap

slap is a Sublime-like terminal-based text editor that strives to make editing from the terminal easier. It has:

  • first-class mouse support (even over an SSH connection)
  • a Sublime-like file sidebar
  • double-click to select word, highlight other occurrences
  • configurable Sublime-like keybindings* (Ctrl+S save, Ctrl+Z undo, etc.)
  • copying/pasting with OS clipboard support
  • infinite undo/redo
  • syntax highlighting for 100+ languages
  • bracket matching
  • autoindentation
  • heavily customizeable via plugins
  • … many other features that will make you leave nano, vim, and emacs behind

img

Installation

$ curl -sL https://raw.githubusercontent.com/slap-editor/slap/master/install.sh | sh

If you already have NodeJS installed:

$ sudo npm install -g slap@latest

Usage

$ slap fish.c
$ slap fish1.c fish2.c
$ slap redfish/ # open dir in browser
$ slap # new file in current dir

Configuration

Use ~/.slap/config to override the defaults in slap/slap.ini:

[header.style]
bg = "red"

Alternatively, pass options in via command line:

$ slap --header.style.bg red file.c

OS support

OSX

iTerm2 supports the mouse and most keybindings out of the box. For optimal Terminal.app usage, see slap-Terminal.app-profile.

Linux

If you are using X.Org, ensure xclip is installed for OS clipboard support.

Windows

Most terminal emulators in Windows do not support mouse events, PuTTY being a notable exception. In Cygwin, slap crashes on startup due to joyent/node#6459.

Resource Reference