15,028
edits
No edit summary |
|||
| Line 68: | Line 68: | ||
} | } | ||
</pre> | </pre> | ||
This function creates a command <code>subl</code> that opens files in Sublime Text while automatically creating any non-existent files: | |||
# <code>for f in "$@"</code> - Loops through each filename you provide | |||
# <code>[ -f "$f" ] || touch "$f"</code> - Checks if each file exists, creates it if not | |||
# <code>open -a "Sublime Text" "$@"</code> - Opens all files in Sublime Text | |||
Simply put: It ensures all files exist before opening them in Sublime Text, preventing "file not found" errors. | |||
4. Save the file, then reload the configuration: | 4. Save the file, then reload the configuration: | ||