Skip to content

nianjie/underbar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

underbar

A plugin for Oh My Fish.

MIT License Fish Shell Version Oh My Fish Framework


Install

$ omf install underbar

The installation also attempts to add following key sequences.

  • bind \eg underbar #alt+g
  • bind \ei underbar_paste #alt+i

Usage

This plugin wraps a command so the contents of stdout will be captured into a dedicated variable, named underbar. It is supposed to work with a custom key binding(default is alt+g).

For example:

# bind alt+g
$ bind \eg underbar
# type a command in command line, then press alt+g to let the function wraps your command.
$ echo 'foo
bar'
# will become
$ set -g underbar (echo 'foo
bar')
# then the content of stdout is kept in the global variable `underbar' after execution, and you can manipulate it like any other fish variables,
# or inspect.
$ set --show underbar

$underbar: set in global scope, unexported, with 2 elements
$underbar[1]: |foo|
$underbar[2]: |bar|

By pressing the binding key again, the wrap is toggle-off.

Bonus

underbar_paste(default bind to alt+i)

This function allows user to select one of items the $underbar variable contains to insert into current command line to complete.

If fzf is available, items can be filtered out. Without fzf, it will show items in cdh style.

underbar_show

It inspects the variable.

As it will repaint the command line after showing information, by binding to a key , it will tell you what is saved in the $underbar as typing commands with no distraction.

# bind alt+i
$ bind \ei underbar_show
# then press alt+i, `set --show underbar` is executed

License

MIT © nj

About

a plugin for omf

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages