Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dviererbe/d33d0ff996f3e9c0c369bfbf121d8e99 to your computer and use it in GitHub Desktop.
Save dviererbe/d33d0ff996f3e9c0c369bfbf121d8e99 to your computer and use it in GitHub Desktop.
Adapter script to call Codium from sensible-editor with the +n syntax.
#!/usr/bin/env bash
set -eo pipefail
case "$#" in
"0")
codium --wait
;;
"1")
codium --wait "$1"
;;
"2")
lineposition="$(echo "$1" | grep -oP "(?<=^\+)(\\d+$)" || echo "$1" | grep -oP "(?<=^\+)(\\d+,\\d+$)")"
codium --wait --goto "$2:${lineposition//,/:}"
;;
"*")
echo "Too many arguments"
exit 1
;;
esac
@dviererbe
Copy link
Author

dviererbe commented May 18, 2023

To install you have to create a config file in your home folder to tell sensible-editor where to find the script.

echo 'SELECTED_EDITOR="/path/to/script"' > ~/.selected_editor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment