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

Inline​Shell

by randolph555 ST4 MacLinux New

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

Details

  • 1.0.2
  • github.​com
  • github.​com
  • 17 hours ago
  • 49 minutes ago
  • 11 hours ago

Installs

  • Total 0
  • Win 0
  • Mac 0
  • Linux 0
Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5 Mar 4 Mar 3 Mar 2 Mar 1 Feb 28 Feb 27 Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9 Feb 8 Feb 7 Feb 6 Feb 5 Feb 4 Feb 3 Feb 2 Feb 1 Jan 31 Jan 30 Jan 29 Jan 28 Jan 27 Jan 26
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 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
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