Skip to content

Commit

Permalink
Initial add
Browse files Browse the repository at this point in the history
  • Loading branch information
aral committed Aug 13, 2022
0 parents commit c2faed7
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0] - 2022-08-13

Initial release.
15 changes: 15 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ISC License

Copyright ⓒ 2022-present Aral Balkan, Small Technology Foundation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Send Output To Editor (sote)

_Pronounced sauté, get it? (Sorry.)_

Sends the output of the last command to your default editor.

If that’s something like [Helix Editor](https://helix-editor.com), you can use multiple cursors, etc., to manipulate it and copy it into the system clipboard (<kbd>space</kbd><kbd>y</kbd> in Helix) to use in future commands.

## Install

Install using [Fisher](https://github.com/jorgebucaran/fisher):

```shell
fisher install small-tech/sote
```

## Use

You can use the `sote` command or, even better, bind it to a keyboard shortcut. For example, to bind it to <kbd>ctrl</kbd><kbd>s</kbd>, add the following to your fish configuration (likely _~/.config/fish/config.fish_):

```fish
bind \cs sote
```

## How it works

Technically, like basically everything else in Fish shell, [it’s just a function](https://zerokspot.com/weblog/2016/01/16/fishy-functions/).

It gets your last history item (`$history[1]`), re-runs it using `eval()` (__so don’t use it on anything that has side-effects__), then splits the output into multiple lines and sends it to your `$EDITOR`.

## Like this? Fund us!

[Small Technology Foundation](https://small-tech.org) is a tiny, independent not-for-profit.

We exist in part thanks to patronage by people like you. If you share [our vision](https://small-tech.org/about/#small-technology) and want to support our work, please [become a patron or donate to us](https://small-tech.org/fund-us) today and help us continue to exist.

## Copyright

Copyright &copy; 2022-present [Aral Balkan](https://ar.al), [Small Technology Foundation](https://small-tech.org).

## License

Sote is released under [ISC](./LICENSE).
5 changes: 5 additions & 0 deletions conf.d/sote.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Send Output to Editor (sote)
function sote
set -l lastCommand (eval $history[1])
printf '%s\n' (string split0 (eval $history[1])) | "$EDITOR"
end

0 comments on commit c2faed7

Please sign in to comment.