Wednesday, December 4, 2019

The end of 2019!

Wow, I felt like this year went bye so quickly. Life has a way of throwing everything at you that can't be compared to anything else I know. Still, I'm excited to see what 2020 has in store for us all!

With that, I wanted to share one trick I came up with real quick for the I'm often navigating my files through the and need a quick way to open up larger files to edit. My choice of plain text editor is and my typical workflow was to "open ." to have the finder show the current folder and then drag the file to TextMate or double click it. Sometimes, depending on the file type association, I could type "open filename" and it would get me to, sometimes not. I started using "open -a filename", but it was repetitive. I could make an alias for "open -a" that would save me some time, but what if I wanted to make a new file and edit it?

The simple function below allows me to type "e filename" and open either a new or existing file. I've added this to my ~/.zprofile so it loads every time I open a shell window:
function e() { # edit existing or new document in textmate
if [[ ! -e "$filename" ]]; then
	touch "$filename"
open -a "$filename"

Hope it helps inspire or at least open documents quicker! If you have another app you prefer to use for text editing, you can change the "" to your preferred editor! Happy 2019 everyone, see you next year! 

No comments: