Skip to content

Instantly share code, notes, and snippets.

@edef1c
Created June 9, 2019 12:58
Show Gist options
  • Save edef1c/30d54baf271db252eb2dda3ea2b0a43a to your computer and use it in GitHub Desktop.
Save edef1c/30d54baf271db252eb2dda3ea2b0a43a to your computer and use it in GitHub Desktop.
define-command nix-jump %{
execute-keys <esc><a-i><a-w>
edit %sh{
if [[ "$kak_selection" =~ ^\<(.*)\>$ ]]; then
path="$(nix-instantiate --find-file "${BASH_REMATCH[1]}")"
else
cd "$(dirname "$kak_buffile")"
path="$(realpath "$kak_selection")"
fi
if [ -d "$path" ]; then
echo "$path/default.nix"
else
echo "$path"
fi
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment