Hacker News new | ask | show | jobs
by philikon 5597 days ago
I first was excited by title "Don't waste your time by cd-ing in the terminal", but then it just turned out to be a blog post about making cd'ing quicker. If you want to boost your productivity, my advice is to stop cd'ing altogether.

I see a lot of people -- particularly vi users -- cd'ing back and forth through a large directory tree. I usually tell them to get a terminal emulator that lets you easily manage many terminals open. Open one per directory you want to operate in, for instance. Learn how to switch back and forth between the different shells.

But most importantly, don't quit the program to switch back and forth between directories and files. Learn to use your editor of choice properly: how to view directory listings, how to switch back and forth, etc. Vim can do this just fine btw. The choice of tool here doesn't matter so much. Just pick one and learn it. This applies to your choice of terminal emulator, shell, editor, etc.

4 comments

Open one per directory you want to operate in, for instance.

This is a common source of headache when using the terminal as an IDE. Not only is it easy to get lost in a sea of terminal-tabs, but it's also quite cumbersome to restore the state of 5+ tabs after a shutdown or disconnect. Even more so when GNU screen enters the mix.

What I'd really like to have is a terminal that can attach to a remote GNU screen and display the screen-windows as local tabs.

So browsing graphical tabs is quicker for you then using "Ctrl+RightArrow" or "Ctrl+n" or some variation of one of those? Traversing my screen or tmux sessions is usually much faster than using a mouse.
Traversing is not the issue here, it's more about having an ad-hoc way to watch things side-by-side by dragging a tab to a window and vice versa, and about having a proper scrollback.

Yes, screen, tmux and vim have split window modes, but those are cumbersome to operate (and I'm saying that as a year-long ion3 user) and the scrollback issue has not been addressed by either up to this day.

Or, to put it more generally: Terminals are sadly stuck firmly in the 1970s. There has been near zero innovation beyond emulating them in tabbed windows and setting xterm titles. Heck, we're moving backwards. OSX ships with a terminal that doesn't even support 256 colors. ZModem is unheard of except in fairly exotic/old emulators such as Zoc. Support for "advanced" terminal features (double-size fonts, graphics mode) is rare.

I spend >8hrs/day inside a terminal. I would happily pay a 3 digit license fee for a modern terminal emulator that adds the features I mentioned and innovates beyond. There's infinite room for innovation by leveraging special ESC-sequences (server tells terminal what to do), drag & drop, integrating with tools like screen, ssh or even building new CLI tools that interface with the terminal in a smart way...

I want vim to tell my terminal to display NerdTree in a native side-car widget like TextMate. I want an "open" CLI-command that downloads the target-file from the remote server and displays it locally without me having to futz with scp. I want to drag & drop files onto the server that I'm currently ssh'd into. I want the term to maintain my entire session (including all tabs and remote connections) across reboots. And, yes, I'd like to have my remote screen windows line up neatly as native tabs.

>I want an "open" CLI-command that downloads the target-file from the remote server and displays it locally without me having to futz with scp. I want to drag & drop files onto the server that I'm currently ssh'd into.

You can get this by editing files over sshfs.

In general though, I find that sort of persistence to be somewhat unstable. I'd rather know that everything I have done is documented and backed up than just sitting in some sort of dump of memory.

You can get this by editing files over sshfs.

Been there, it's a kludge and tends to not cope well with network disconnects. Also when sshfs flakes out then it has a habit of leaving you with 0-byte files.

Also note this doesn't fully address the problem. I literally want to drag/drop into the current directory of whatever server I'm ssh'd into (possibly with multiple ssh-hops in between).

This has been possible in the 80's, it's called ZModem. The server-side part is still in your favorite linux distribution (lrzsz). Sadly the client-side support has disappeared from almost all terminal emulators (Afaik only Zoc still supports it).

With Zoc you can just drop a file and it will send the ZModem init-string, which conveniently launches the 'rz' binary on the server. Likewise you can say 'sz file', Zoc will detect the init-string and open a download-dialog.

Forgotten technologies... not all of them were bad.

I've also been frustrated by these issues. I want to be able to edit a file with local typing speed (i.e., gvim on Windows), but then be able to hit a key and be in a terminal window on that server in that folder to perhaps do a manual grep or rebuild an index or whatever. I feel like we were closer in the 90s with innovative products like Slirp and Term and, yes, Zmodem (and Kermit).

I started trying to build out something like this based on vim's netrw stuff but it never really worked out. I'm not even sure if what I want is part of vim or if it's some nebulous other tool.

Also, pushd and popd. And "cd -". And ctrl-Z and fg to jump out of your editor for a moment. And dragging dirs from the Finder (or whatever) to the terminal.
And use tools that are aware of directories: tar -C, NERDtree for Vim, zsh globbing.
a terminal emulator which has a session sasving feature built in to restore terminal tabs with their working directories is: termit find it on github. lua scripting api included :)