diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2a1fce3 --- /dev/null +++ b/CHANGELOG.md @@ -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. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a865842 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6bf0c02 --- /dev/null +++ b/README.md @@ -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 (spacey 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 ctrls, 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 © 2022-present [Aral Balkan](https://ar.al), [Small Technology Foundation](https://small-tech.org). + +## License + +Sote is released under [ISC](./LICENSE). diff --git a/conf.d/sote.fish b/conf.d/sote.fish new file mode 100644 index 0000000..790eb3f --- /dev/null +++ b/conf.d/sote.fish @@ -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