Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Virgo/Committers/Bash"

(New page: Contextual Bash History simply means that instead of having to type the up key a million times to find what you want or using the ! syntax for the last command starting with a string, you ...)
 
 
Line 38: Line 38:
 
$include /etc/inputrc
 
$include /etc/inputrc
 
</pre>
 
</pre>
# Run {{source ~/.bash_profile}}.
+
# Run ''source ~/.bash_profile''.
 
# You're off! For a quick example, type ''ant'' and use up and down. You should see all of your old ant commands role by.
 
# You're off! For a quick example, type ''ant'' and use up and down. You should see all of your old ant commands role by.

Latest revision as of 10:25, 13 June 2011

Contextual Bash History simply means that instead of having to type the up key a million times to find what you want or using the ! syntax for the last command starting with a string, you can get the best of both worlds. You can type a short string and then use up and down keys to search through anything in your history that meets that requirement.

To enable this

  1. Add the following lines to your ~/.bash_profile file. This will optimize your history for this kind of behavior.
export HISTCONTROL=erasedups
export HISTSIZE=10000
shopt -s histappend
  1. Put the following into a file called ~/.inputrc.
# do not make noise
set bell-style none

# By default up/down are bound to previous-history
# and next-history respectively. The following does the
# same but gives the extra functionality where if you
# type any text (or more accurately, if there is any text
# between the start of the line and the cursor),
# the subset of the history starting with that text
# is searched (like 4dos for e.g.).
# Note to get rid of a line just Ctrl-C
"\e[B": history-search-forward
"\e[A": history-search-backward

$if Bash
  # F10 toggles mc on and off
  # Note Ctrl-o toggles panes on and off in mc
  "\e[21~": "mc\C-M"

  #do history expansion when space entered
  Space: magic-space
$endif

# Include system wide settings which are ignored
# by default if one has their own .inputrc
$include /etc/inputrc
  1. Run source ~/.bash_profile.
  2. You're off! For a quick example, type ant and use up and down. You should see all of your old ant commands role by.

Copyright © Eclipse Foundation, Inc. All Rights Reserved.