Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2
Get identifiers, paths, URLs and words from the previous command output and use them for the next command in@xonsh.
License
anki-code/xontrib-output-search
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Get identifiers, names, paths, URLs and words from the previous command output and use them for the next command inxonsh.
💡Universal. Forget about searching autocomplete plugins for every app you use. Just get the identifiers from the previous output.
⏳Save time. Forget about using mouse, touchpad or trackball to get any words from screen to the next command.
🔒Secure. It works the same way as xonsh shell and the security level is the same.
xpip install -U xontrib-output-search
There are three ways to use output search:
- Recommended. Usetmux to run xonsh and use output search. See instructions below.
- Not recommended. Set
$XONSH_CAPTURE_ALWAYS=Trueand be ready some tools will freeze because of capturing e.g.git config --help. Details: afterxonsh release 0.10.0 (4283) you should set$XONSH_CAPTURE_ALWAYS=Truein your~/.xonshrcto make output capturable. This approach has issues and we decided that the best solution for output search is to use the terminal window managers and we supporttmux. In this case the output will be captured from the screen. - Alternative. You canadd support any terminal emulator or terminal window manager like tmux that can capture the content of the terminal. PR is welcome!
The recommended way as described above:
zshaliastx="tmux new-session xonsh ';' set -g status off"# add alias to run xonsh in tmux without bottom status bartx# run xonsh in tmuxxontribloadoutput_search# add this to ~/.xonshrc
After loading you can select tokens from latest not empty output:
- Windows/Linux: PressAlt +f hotkeys after getting the output of the previous command.
- Mac: PressControl +f hotkeys after getting the output of the previous command.
- Any OS: Type
f__orf__<beginning of the word you want>and pressTab.
If you use this key combination for another function and your muscle memory is strong just changethekey combination beforeloading the xontrib:
# Alt+i combination. Meaning for prompt-toolkit: @bindings.add('escape', 'i')$XONTRIB_OUTPUT_SEARCH_KEY='i'xontribloadoutput_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'xontribloadoutput_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__`xontribloadoutput_search
Intmux there isthe tmux fallback in case the output of last cmd is not available.
echo"Try https://github.com/xxh/xxh"# Try https://github.com/xxh/xxhgit clone xx<Alt+F>git clone https://github.com/xxh/xxh
echo'{"Try": "xontrib-output-search"}'# {"Try": "xontrib-output-search"}echo I should try se<Alt+F>echo I should try xontrib-output-search
env| grep ^PATH=# PATH=/one/two:/three/fourls fo<Alt+F>ls /three/four
Get the URL from previous output after typinggit+:
echo"Try https://github.com/anki-code/xontrib-output-search"# Try https://github.com/anki-code/xontrib-output-searchpip 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 4242curl http://127.0.0.1:4<Alt+F>curl http://127.0.0.1:4242
lolcat -h# ...lolcat --s<Alt+F>lolcat --seed=SEED
Usetokenize-output as a tool
$(echo'Hello "world"!'|tokenize-output-p).split()# ['Hello', 'world']
$XONTRIB_OUTPUT_SEARCH_WARNING- show warnings from xontrib. DefaultTrue.
The xontrib-output-search is usingtokenize-output for tokenizing.
Checking thatoutput_search xontrib has been loaded:
xontrib list output_search# output_search installed loadedcompleter list| grep output_search# xontrib_output_search
Workaround:f__ +Tab.
Workaround: set$XONTRIB_OUTPUT_SEARCH_KEY='i' beforexontrib load output_search.
Not working afterxonsh 0.10.0 (4283)
Workaround: CheckXONSH_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 orcat file | grep text.
See alsotmux feature request: Hyperlinks.Tryzellij as workaround.
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!
- This package is the part ofergopack - the pack of ergonomic xontribs.
- This package was created withxontrib cookiecutter template.
- I was inspired byxontrib-histcpy. Thanks @con-f-use!
About
Get identifiers, paths, URLs and words from the previous command output and use them for the next command in@xonsh.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.