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

Inline​Shell

by randolph555 ST4 MacLinux

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

Details

Installs

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