Skip to content

Instantly share code, notes, and snippets.

@jdugarte
Created January 26, 2023 16:50
Show Gist options
  • Save jdugarte/bdfe4c4cf58a280cb58537b8a02e56ce to your computer and use it in GitHub Desktop.
Save jdugarte/bdfe4c4cf58a280cb58537b8a02e56ce to your computer and use it in GitHub Desktop.
TextMate - Copy current file relative path
#!/usr/bin/env bash
[[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
TM_PROJECT_DIRECTORY="$TM_PROJECT_DIRECTORY/"
echo -n "${TM_FILEPATH#$TM_PROJECT_DIRECTORY}" | pbcopy
echo 'Relative path copied to clipboard: '"${TM_FILEPATH#$TM_PROJECT_DIRECTORY}"
@jdugarte
Copy link
Author

  • Bundles -> Edit Bundles...
  • Press Cmd+N to create New Bundle
  • Press Cmd+N to create Command
  • Paste the code above to the bundle editor and set
    • Input: Nothing
    • Output: Show in Tool Tip
    • Key Equivalent to something like Cmd+Shift+P
  • Save bundle (Cmd+S)

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