Live data from Hacker News

Don't waste your time by cd-ing in the terminal

huyng.com

71–80 of 124 posts

Re: Don't waste your time by cd-ing in the terminal

#71
post #34

I like this workflow better: 1. Go to the directory in question 2. Type "save nm" where "nm" is any short name for the directory, like "blog" or "blg" 3. From now on, type "cd nm" whenever you want to go there. No session restart required, even. I copied the code that enables this workflow from http://dotfiles.org/~jacqui/.bashrc (or was it https://gist.github.com/117528 ) The idea is discussed here: http://hints.mac…

Why not just:

    echo "export nm=`pwd`/blog"' >> ~/.profile
    . ~/.profile
    cd $nm
There's no need for magic when you know how to shell.

Re: Don't waste your time by cd-ing in the terminal

#74
post #56

Earlier quoted context omitted.

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…

>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 ju…

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.

Re: Don't waste your time by cd-ing in the terminal

#75

Earlier quoted context omitted.

I would suggest mapping an alias instead of creating a function so that you will still be able to take advantage of parameter completion: > alias to='cd ~/Sites/'

Ah, much nicer. Thankyou. Edit: On testing it doesn't work. 'to sitename' just goes straight to ~/Sites/. I knew there must have been a reason i used a function instead of an alias.

Oh, that's right. 'to sitename' becomes 'cd ~/Sites/ sitename' which is not what you want. My apologies.

Re: Don't waste your time by cd-ing in the terminal

#76
post #34

I like this workflow better: 1. Go to the directory in question 2. Type "save nm" where "nm" is any short name for the directory, like "blog" or "blg" 3. From now on, type "cd nm" whenever you want to go there. No session restart required, even. I copied the code that enables this workflow from http://dotfiles.org/~jacqui/.bashrc (or was it https://gist.github.com/117528 ) The idea is discussed here: http://hints.mac…

Dollars to donuts the author is a Vimmer. I am and the workflow makes complete sense to me :-)

Re: Don't waste your time by cd-ing in the terminal

#78
post #74

Earlier quoted context omitted.

>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 ju…

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 t…

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.

Re: Don't waste your time by cd-ing in the terminal

#79
I have usually a few dirs that i go back and forth frequently when coding, and I simply set them to my env. I add the following line to ~/.bashrc export lib='/path/to/my/lib' And 'cd $lib' will take me there. Very simple, and caters for most of my cd needs. Don't over-complicate things
Post reply on HN