this post was submitted on 27 Aug 2023
5 points (77.8% liked)

Apple

4982 readers
1 users here now

Here you can talk about Apple's ecosystem, Apple's OSs (Operating Systems), Apple's apps, Apple's everything!!

founded 4 years ago
MODERATORS
 

After years of using MacOS I somehow only just now became aware you even could copy the filepath at all (outside of dragging in to terminal which is just stupid) so I'm very happy to discover that, but the thing is, for the most part the reason I want to do this is for easy navigation of a file browser by copying paths from one window or tab to another, especially when I have an item selected in an open file browser window and need to specify in a file browser prompt where to save something.

In those instances on Windows for example, I will press the F4 key to select the text field of the address bar in explorer and copy the parent directory path of an item. If I really need it I can get the exact path of the item itself without the mouse too . While I'm super glad I can now approach this usefulness in Finder, the mouse totally interrupts the flow and begins to make the increased efficiency from copying paths only marginally better than just clicking through folder trees since you stop what you're doing and move hands to the mouse already anyway at that point. I'd love to just immediately copy the current path I'm in into a Finder window and use the cmd+shift+G option in another window or prompt to go the same place. The second half of that operation is easy enough, but getting the path on to the clipboard isn't because of needing the mouse.

you are viewing a single comment's thread
view the rest of the comments
[–] RotaryKeyboard@lemmy.ninja 4 points 1 year ago* (last edited 1 year ago)

Okay, I have a lot of recommendations here.

how can I quit textEdit/close a textEdit document and either:

Choose not to save at all or

To my knowledge, this can't be done. Choose a different text editor, such as BBEdit instead. In BBEdit, if I want to choose not to save, I press Command-W to close the window. The "Save changes before closing?" dialog box will accept Command-D as input for the "Don't Save" button. BBEdit also has command line utilities, which I will come back to.

Choose to save somewhere and pick a location and filename to do so WITHOUT touching the mouse?

You have already answered this one. All application Save As dialog boxes accept the command-shift-G (Go to) command. You can then type the path to where you want to save your file and use tab-completion to make it go faster. Saving files in locations that can be accessed with tilde expansion will dramatically speed your workflow.

For example, I often work on little projects that involve editing lots of files. I will choose to put my project directory in my home directory so that I can access it with the following keystrokes:

  1. Command-Shift-S (Save As)
  2. Command-Shift-G (Go to)
  3. ~/Rot(tab)/Proj(tab) (which tab-completes to /Users/RotaryKeyboard/Project1/)
  4. (enter)

But what I keep thinking about while reading your post is how much you should be working with an open terminal window. The zsh commands you can use there will change your life. It requires learning unix, and it requires you changing the way you work a bit, but I can immediately think of approaches that would make it so that you never have to use the Go To command again. Let's walk through that now.

In Linux/Unix, it is not uncommon to create your file in a location before you even edit it. For example, I can do this:

touch ~/Users/RotaryKeyboard/Project1/tutorial.py

This creates an empty file at that location. Now I can open the file, edit it, and save it, and I don't have to specify where. My hands never have to leave the keyboard. But we can do better:

nano ~/Users/RotaryKeyboard/Project1/tutorial.py

Now I've opened the text editor nano. I can write in that file. When I save it, it will be saved at that location. But we can do even better.

Remember how I mentiuoned that BBEdit has command line tools? Once those are installed, we can use bbedit as the text editor instead of nano.

bbedit ~/Users/RotaryKeyboard/Project1/tutorial.py

As you might have guessed, this opens a new BBEdit text window. The BBEdit developers have gone the extra mile, though. That empty BBEdit window will have the name you passed to it in the title bar as well as the path to the file visible in the toolbar even though the file doesn't even exist until you save it.

So far so good, right? Once you start using a terminal window in your workflow, you can begin to take advantage of things like environment variables, symbolic links, and commands like find and grep to rapidly increase your productivity.

Oh, one more thing: if you don't know how to use regular expressions, set aside some time to learn how to use them. Regular Expressions are probably the single most life-changing thing I've ever come across for computers.