Skip to content

Instantly share code, notes, and snippets.

@romuald
Created January 22, 2020 16:18
Show Gist options
  • Save romuald/2bf303f194e001841c8f6d11cc0077f8 to your computer and use it in GitHub Desktop.
Save romuald/2bf303f194e001841c8f6d11cc0077f8 to your computer and use it in GitHub Desktop.
Sublime text alias, with +lineno option
#!/bin/bash
# Allow to use the subl command with +linenumber to go to line number (like vim)
# example: subl filename.py +208
original=/usr/bin/subl
last="${@: -1}"
prev="${@:~1:1}"
if [ "$#" -gt 1 ] && [ -n "$last" ] && [ -n "$prev" ] && [[ "$last" =~ ^\+ ]]; then
$original "${@:1:$#-1}" "$prev:${last:1:64}"
else
$original $@
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment