15,076
edits
No edit summary |
|||
| (4 intermediate revisions by the same user not shown) | |||
| Line 41: | Line 41: | ||
</pre> | </pre> | ||
== How to open files with your favorite editor from the terminal? == | |||
[[Open Files in a GUI Editor from the Terminal]] | |||
== How to open and create non-existent files with Sublime Text from terminal? == | == How to open and create non-existent files with Sublime Text from terminal? == | ||
| Line 68: | Line 73: | ||
} | } | ||
</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: | ||
| Line 88: | Line 101: | ||
[[Category: Text editor]] | [[Category: Text editor]] | ||
[[Category: Revised with LLMs]] | [[Category: Revised with LLMs]] | ||
[[Category: Developer environment]] | |||