Lurker News
OSX Terminal: hold option and click a position in the current line to move your cursor to that position. #yearslost

Comments (395) 107 threads

Earlier comments
emehrkay2 replies#
drag + drop files to terminal to get its location.

I often do "cd " + dragon drop folder to get to that folder in terminal

MaxGabriel2 replies#
There's a free app called Go2Shell that adds a button to finder to open the current directory in Terminal/iTerm. Also works great in conjunction with "open ."
sandipc#
Wow, so simple but so useful. Thanks!
lunixbochs#
You can drag/drop many things onto an application icon in the dock to open them in a new window.

This includes dragging a folder's proxy icon to the terminal app to open the current Finder window in a new terminal.
The proxy icon is the little icon in the top middle of the window, to the left of the name.

kps#
I'm a bit late, but it's useful to know that while dragging, keystrokes are handled normally. Using the parent comment's operation as an example, you can start dragging a folder in the Finder, then Command-Tab to the terminal (or hover over the Dock icon and then hover over the proxy window), Command-` to a particular terminal window, or Command-N to open a new one, and then type "cd " before finally dropping the file. ("cd " is nicely left-handed for those using the right hand for the pointing device.)
javajosh#
Off-topic, but related: does anyone know a way to bind a key, and F-key for example, to a particular application in OSX? The behavior I'm looking for is almost achievable with Spaces - but it's basically when you hit the combo from anywhere, the target application comes to the foreground, or if it's not running, it launches.

Command-Tab is fine and dandy, but I want more stability in my application switching. And if it doesn't exist, I may have to dust off XCode like I've been threatening to do for a while now.

etoulas1 reply#
As it wasn't mentioned yet: pushd / popd

These two commands replace 'cd' and work with a directory stack of different paths.

   $ pushd tmp   # cd to tmp and remember current path /
   /tmp /
   $ pwd
   /tmp
   $ cd /usr   # normal cd to wherever you want...
   $ pwd
   /usr
   $ popd   # pop the stck and get back to the previous path
   /
   $ pwd
   /
Subsequent pushd will stack multiple paths.

It's a built-in of bash and other shells. It works even with Windows' cmd.exe

nightwolf#
You can also use "cd -" to go back to the previous path:

  $ cd /
  $ pwd
  /
  $ cd /tmp
  $ pwd
  /tmp
  $ cd -
  $ pwd
  /
Not the same, of course, but still useful, I think.
mcella#
Great Tip!

Regarding OSX Terminal, I'm an heavy user since Leopard but it's a shame that after upgrading to Mountain Lion (an now Mavericks) I discovered that they broke VIM vertical selection since control-shift does not generate a keycode anymore [1].
Anyone with the same problem? I tried iTerm recently and I don't like it! :-(
[1] https://discussions.apple.com/thread/4694342?start=0&tstart=...

Load more comments