bash-sensible icon indicating copy to clipboard operation
bash-sensible copied to clipboard

Split project into "bash-sensible" and "inputrc-sensible"

Open justfortherec opened this issue 7 years ago • 2 comments

I love the idea of this project and appreciate the great defaults it gives me. Thank you.

To make the project even better I propose to split the defaults into "bash-sensible and "inputrc-sensible" for two reasons:

  1. Avoid shadowing preferences set in ~/.inputrc (e.g. I have set show-all-if-ambiguous off in my .inputrc which is overwritten by bash-sensible. Thus, I need to set it a second time in .bashrc after loading bash-sensible.)
  2. Make these great defaults also available to other programs that use readline (python REPL, etc).

justfortherec avatar Mar 01 '17 11:03 justfortherec

I'm a Unix as an IDE kinda guy -- I spend a lot of time manipulating files on the command line. As such, I have a heavily overridden .inputrc

Beyond the normal line-editing keys, I use readline as keyboard shortcuts. These bindings are useful to me and might serve as a springboard for others.

Duplicate common shifted (or distant) characters onto the home keys:

# RSI prevention (Alt lower-case letter):
"\ej" "-"       # <Alt-j> = hyphen
"\ek" "_"       # <Alt-k> = underscore
"\ef" "+"       # <Alt-f> = plus
"\ed" "="       # <Alt-d> = equals
"\eh" "~"       # <Alt-h> = tilda
"\em" "\n"      # <Alt-m> = return
"\es" "*"       # <Alt-s> = star
"\ew" "\\*"     # <Alt-w> = backslash-star

Shortcuts for common Unix filters (Alt upper-case letter): Most of the key letters are memorable.

"\eA" "$(!!) "                  # ALL the previous command
"\eC" "| column -t " 
"\eD" "| uniq -d "              # show Duplicates
"\eE" "| uniq -c "              # Enumerate (count uniq)
"\eG" "| grep -i "
"\eH" "| head "
"\eL" "| nl -nrz -w4 -ba "      # Line numbers
"\eM" "| less\n"
"\eN" "| sort -n "
"\eP" "$(pwd) "
"\eR" "| rev "                  # Reverse lines
"\eS" "| sort -f "
"\eT" "| tac "                  # Reverse file
"\eU" "| uniq "                 # Uniq-ify
"\eV" "| grep -v "
"\eW" "| wc -l\n"
"\eX" "| shuf "                 # miX up
"\eZ" "| cat -s " 
"\e0" "> /dev/null "

Most of them end in (space), so they can be chained together, e.g. program Alt-Shift-SAlt-Shift-EAlt-Shift-NAlt-Shift-TAlt-Shift-HEnter

Take the output of program, then sort the output, count the duplicates, sort by count, reverse the sort, show the top ten.

program | sort -f | uniq -c | sort -n | tac | head

How do you (ab)use readline?

flatcap avatar Jun 03 '17 11:06 flatcap

I second this. It doesn't have to be necessarily a separate project, having all the readline settings in a inputrc.sensible file would be enough.

How do you (ab)use readline?

https://ao2.it/en/blog/2012/11/23/autoexpanding-aliases-readline-story-suod

Ciao, Antonio

ao2 avatar Apr 04 '18 20:04 ao2