ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Inline​Shell

by randolph555 ST4 MacLinux

sublime里选中任意文本执行命令

Details

Installs

  • Total 3
  • Win 0
  • Mac 1
  • Linux 2
Jun 2 Jun 1 May 31 May 30 May 29 May 28 May 27 May 26 May 25 May 24 May 23 May 22 May 21 May 20 May 19 May 18 May 17 May 16 May 15 May 14 May 13 May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

InlineShell

Run shell commands inline in Sublime Text, with streaming output and history completion.

Features

  • Run the current line or selected text as a shell command
  • Pipe selected text into a command using a trailing |command
  • Stream output inline, without blocking the editor
  • History completion for previously run commands
  • Confirmation prompt for dangerous commands
  • Blocks interactive commands that require a real terminal

Install

Package Control

Search for InlineShell in Package Control (once the package is accepted).

Manual

  1. Open Sublime Text
  2. Menu: Preferences -> Browse Packages...
  3. Create a folder named InlineShell
  4. Copy the plugin files into that folder

Usage

Run a command

  1. Type a command, for example ls -la
  2. Run the command palette entry Inline Shell: Run Line or Selection
  3. Output appears on the next line

Run a selection

Select any text and run Inline Shell: Run Line or Selection.

Pipe selection into a command

Select content that ends with a pipe command:

{"name": "test", "value": 123}
|grep name

Or use an inline pipe:

{"name": "test"} |grep name

History completion

Run Inline Shell: History Complete to pick a previous command.

Key bindings

This package does not define default key bindings to avoid overriding Sublime defaults. Add your own in your user keymap if you want them. Example:

[
  {"keys": ["super+enter"], "command": "run_command_run_line"},
  {"keys": ["ctrl+tab"], "command": "run_command_history_complete"}
]

Shell aliases

If you want custom aliases or PATH entries, create a lightweight shell rc file:

zsh: ~/.zshrc_lite

alias ll='ls -la'
alias g='git'
export PATH="$HOME/.local/bin:$PATH"

bash: ~/.bashrc_lite

alias ll='ls -la'

Blocked commands

The following interactive commands are blocked and will prompt you to use a terminal:

  • vim, vi, nano
  • top, htop
  • less, more, man
  • watch

Dangerous command protection

Commands like these require confirmation:

  • rm -rf, rm -f
  • sudo rm
  • dd of=/dev/...
  • mkfs
  • chmod 777 /
  • shutdown, reboot

Requirements

  • Sublime Text 4
  • macOS or Linux
  • zsh or bash

License

MIT