Hacker News new | past | comments | ask | show | jobs | submit login
A redditor explains how to make readline and bash more user friendly (reddit.com)
99 points by fs111 on Sept 11, 2011 | hide | past | favorite | 29 comments



Do we need to mention that it's a redditor? This is a useful resource, so it should be submitted to HN, but the title needs editing.


Yes, we do need to mention it, since a lot of HN users have deep, deep biases against the idea that anything good happens on reddit :)


It's a funny label to apply. Arguably, all that it really takes to become a redditor is a username, password, and a captcha.


I'm being downvoted. Am I wrong? Please let me know rather than punishing me for reasons unknown.


I think you are missing the point in your shallow analysis


Maybe. Was just pointing that fact out though. I've been on reddit for 4 years now. After the community has grown it just seems a bit naive to refer to it as a little exclusive club of intellectualism, or from an outsider's perspective, a meme graveyard. Just an observation.


I assumed you were being funny, since HN doesn't even have a captcha in their signup form. Have an upvote.


You do not need to tell people that you are upvoting them.


Hmm, it appears as if you have a stick up your ass. Maybe you should work on that.


I didn't want to get further involved, so thanks for that. Have an upvote.


So then if they create good content, then just link to it. We want to think we're a meritocracy, and we will upvote things if they are good. It's not a popularity contest, nor a political game where we need to "prove" that something/someone is good.


Those are great, here are a couple more i find very useful:

  # Search for partial matches in bash history
  # so $ <C-p> goes to the previous command but
  #  $ s<C-p> searches through history entries that start with s
  "\C-p":history-search-backward
  "\C-n":history-search-forward

  # add a trailing '/' when tab completing a symlink
  set mark-symlinked-directories on


Personally I've bound history searches to the up/down arrow to make bash behave more like the C-shell in this regard:

    "\e[A": history-search-backward
    "\e[B": history-search-forward
(This was really the only thing I disliked about bash compared to csh, so imagine my delight when I found out this option existed in readline.)


<C-r> searches through entire history backward, with partial match support


It seems to have an annoying habit of preserving the index of the last partial match, even if you cancel it. So when you realise you were searching for the wrong substring, cancel and start over, it won't find it because you've now gone past it in the history list.

I'm still not sure of a decent solution to it (apart from using C-s to search history forward instead)


It is annoying. Generally happens to me when I "miss" the thing I was searching for and go too far. This is what I do:

    Ctrl + a, Ctrl + k (move to beginning, delete to end), Enter
Going to a new line, resets that index.

I'm sure there is a better way, but its muscle memory for me.


ctrl+c should cancel the search, saving you the line-editing workaround.


I hit the Enter key.


A lot of cross-posts from Reddit lately. Could this mean Reddit is improving?


No, it's just knowing the right subreddits. I found this one via http://redditdirectory.com/856/Programming


Or just use oh-my-zsh with the fish theme and get all of this (and more) straight away.


That might be true, but where ever you go, there is always bash installed. zsh not so much. Knowing the tools, that you will always find, is a pretty useful skill.


That is not true at all... if you install FreeBSD out of the box there is no bash installed. Most of my FreeBSD servers don't have bash installed at all because I don't find it necessary at all, tcsh does everything I want it to do.


If you're going to use a system enough to copy your readline & bash config, it would be just as easy to copy your zsh config and install it in the rare case it's not available.


I don't have root on every box I log in to.


> That might be true, but where ever you go, there is always bash installed. zsh not so much.

Whaddya wanna bet the same argument is being used elsewhere, except with csh/bash or sh/bash as the simple-shell/advanced-shell duo?

(Before anyone gets confused: tcsh is the advanced-shell BSDs come with. csh is the simple one.)


I agree with the oh-my-zsh, but why specifically the fish theme?

From what I can gather it only alters the look (https://github.com/robbyrussell/oh-my-zsh/blob/master/themes...)


Hmm, does it? I installed it right away and it's pretty much exactly like fish (history traversal with arrows, case-insensitive matching, etc). I might be mistaken and it might just be omz.


Wow, I was going to ask for a link to the reddit article before realizing that the subreddit was simply heavily themed. I had no idea these settings were flexible and I'm very thankful. Thanks for the cross post and for introducing me to another nice subreddit.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: