All Projects → tokenizer → xontrib-output-search

tokenizer / xontrib-output-search

Licence: BSD-2-Clause license
Get identifiers, paths, URLs and words from the previous command output and use them for the next command in xonsh shell.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to xontrib-output-search

xontrib-prompt-bar
The bar prompt for xonsh shell with customizable sections and Starship support.
Stars: ✭ 27 (+3.85%)
Mutual labels:  console, xonsh, xontrib
Zoxide
A smarter cd command. Supports all major shells.
Stars: ✭ 4,422 (+16907.69%)
Mutual labels:  xonsh, xontrib
carapace-bin
multi-shell multi-command argument completer
Stars: ✭ 42 (+61.54%)
Mutual labels:  xonsh, xontrib
xontrib-z
Tracks your most used directories, based on 'frecency'.
Stars: ✭ 15 (-42.31%)
Mutual labels:  xonsh, xontrib
wink-tokenizer
Multilingual tokenizer that automatically tags each token with its type
Stars: ✭ 51 (+96.15%)
Mutual labels:  tokenizer, tokenization
simplemma
Simple multilingual lemmatizer for Python, especially useful for speed and efficiency
Stars: ✭ 32 (+23.08%)
Mutual labels:  tokenizer, tokenization
awesome-xonshrc
👓 🐚 Make your xonsh RC file installable with awesome snippets of code.
Stars: ✭ 43 (+65.38%)
Mutual labels:  xonsh, xontrib
Text-Classification-LSTMs-PyTorch
The aim of this repository is to show a baseline model for text classification by implementing a LSTM-based model coded in PyTorch. In order to provide a better understanding of the model, it will be used a Tweets dataset provided by Kaggle.
Stars: ✭ 45 (+73.08%)
Mutual labels:  tokenizer
TweebankNLP
[LREC 2022] An off-the-shelf pre-trained Tweet NLP Toolkit (NER, tokenization, lemmatization, POS tagging, dependency parsing) + Tweebank-NER dataset
Stars: ✭ 84 (+223.08%)
Mutual labels:  tokenization
lexertk
C++ Lexer Toolkit Library (LexerTk) https://www.partow.net/programming/lexertk/index.html
Stars: ✭ 26 (+0%)
Mutual labels:  tokenizer
lunasec
LunaSec - Dependency Security Scanner that automatically notifies you about vulnerabilities like Log4Shell or node-ipc in your Pull Requests and Builds. Protect yourself in 30 seconds with the LunaTrace GitHub App: https://github.com/marketplace/lunatrace-by-lunasec/
Stars: ✭ 1,261 (+4750%)
Mutual labels:  tokenization
suika
Suika 🍉 is a Japanese morphological analyzer written in pure Ruby
Stars: ✭ 31 (+19.23%)
Mutual labels:  tokenizer
tty-editor
Opens a file or text in the user's preferred editor
Stars: ✭ 26 (+0%)
Mutual labels:  console
Tokenizer
A tokenizer for Icelandic text
Stars: ✭ 27 (+3.85%)
Mutual labels:  tokenizer
teletype.js
A hyper-text terminal for web browsers.
Stars: ✭ 18 (-30.77%)
Mutual labels:  console
grasp
Essential NLP & ML, short & fast pure Python code
Stars: ✭ 58 (+123.08%)
Mutual labels:  tokenizer
snapdragon-lexer
Converts a string into an array of tokens, with useful methods for looking ahead and behind, capturing, matching, et cetera.
Stars: ✭ 19 (-26.92%)
Mutual labels:  tokenizer
strip-ansi-stream
Strip ANSI escape codes
Stars: ✭ 32 (+23.08%)
Mutual labels:  console
capybara-chromedriver-logger
Enables console.log/error/info output from Javascript feature specs running with Chromedriver
Stars: ✭ 54 (+107.69%)
Mutual labels:  console
kube-design
Kube Design for KubeSphere Console
Stars: ✭ 88 (+238.46%)
Mutual labels:  console

Get identifiers, names, paths, URLs and words from the previous command output and use them for the next command in xonsh.

Save time. Forget about using mouse, touchpad or trackball to get any words from output to the next command. Secure. The xontrib-output-search is not writing any output on the hard disk. Only latest not empty output stored in the memory. It works the same way as xonsh shell and the security level is the same. Universal. Forget about searching autocomplete plugins for every app you use and get the identifiers from the output.

If you like the idea click on the repo and and tweet.

Note!

After release xonsh 0.10.0 (4283) you should set $XONSH_CAPTURE_ALWAYS=True in your ~/.xonshrc to use xontrib-output-search. Be aware that after this you can catch some issues around capturable tools (4283).

Install

xpip install -U xontrib-output-search
echo 'xontrib load output_search' >> ~/.xonshrc
# Reload xonsh

Usage

After xontrib load output_search you have two ways to select tokens from latest not empty output:

  • Windows/Linux: Press Alt + f hotkeys after getting the output of the previous command
  • Mac: Press Control + f hotkeys after getting the output of the previous command
  • Any OS: Type f__ or f__<beginning of the word you want> and press Tab

If you use this key combination for another function and your muscle memory is strong just change the key combination before loading the xontrib:

# Alt+i combination. Meaning for prompt-toolkit: @bindings.add('escape', 'i')
$XONTRIB_OUTPUT_SEARCH_KEY='i'
xontrib load output_search
# This approach is recommended for Mac users because `c-<key>` is represented 
# the Control key that has less intersections with other Mac hotkeys. 
#
# Control+g combination. Meaning for prompt-toolkit: @bindings.add('c-g')
$XONTRIB_OUTPUT_SEARCH_KEY_BINDING='c-g'
xontrib load output_search
# Right+Left combination. Meaning for prompt-toolkit: @bindings.add('right', 'left')
$XONTRIB_OUTPUT_SEARCH_KEY_META='right'
$XONTRIB_OUTPUT_SEARCH_KEY='left'  # the text placeholder will be `left__`
xontrib load output_search

In tmux there is the tmux fallback in case the output of last cmd is not available.

Use cases

Get URL from output

echo "Try https://github.com/xxh/xxh"
# Try https://github.com/xxh/xxh
git clone xx<Alt+F>
git clone https://github.com/xxh/xxh

Get key or value from JSON, Python dict and JavaScript object

echo '{"Try": "xontrib-output-search"}'
# {"Try": "xontrib-output-search"}
echo I should try se<Alt+F>
echo I should try xontrib-output-search

Get the path from environment

env | grep ^PATH=
# PATH=/one/two:/three/four
ls fo<Alt+F>
ls /three/four  

Complete the complex prefix

Get the URL from previous output after typing git+:

echo "Try https://github.com/anki-code/xontrib-output-search"
# Try https://github.com/anki-code/xontrib-output-search

pip install git+xo<Alt+F>
pip install git+https://github.com/anki-code/xontrib-output-search

Get the port number from previous output while typing the URL:

echo "The port number is 4242"
# The port number is 4242

curl http://127.0.0.1:4<Alt+F>
curl http://127.0.0.1:4242

Get arguments from command help

lolcat -h
...
lolcat --s<Alt+F>
lolcat --seed=SEED

Development

The xontrib-output-search is using tokenize-output for tokenizing.

Checking that output_search xontrib has been loaded:

xontrib list output_search
# output_search  installed  loaded

completer list | grep output_search
# xontrib_output_search

Known issues

Not working after xonsh 0.10.0 (4283)

Workaround: Check XONSH_CAPTURE_ALWAYS environment variable to bring the capturing of the output back i.e. $XONSH_CAPTURE_ALWAYS=True.

cat file is not captured (xonsh/issues/3744)

Workaround: cat file | head or cat file | grep text.

Alt+F combination may not working in PyCharm terminal

Workaround: f__ + Tab.

The readline shell type was not tested

We're using the xonsh recommended prompt-toolkit shell type to test the output search xontrib. There could be the issues in the readline shell type. PRs are welcome!

The Alt+F in the readline is to move forward

Workaround: set $XONTRIB_OUTPUT_SEARCH_KEY='i' before xontrib load output_search.

Links

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].