Giter Site home page Giter Site logo

bash-sensible's Introduction

Sensible Bash

An attempt at saner Bash defaults. Inspired by Tim Pope's sensible.vim.

The config

Sensible Bash is intended to be a simple starting point for a better Bash experience out of the box. Refer to source for a complete list of all the options. Here's a taste of what's in the configuration:

1. Smarter tab completion

Options to improve on Bash's default tab completion. These settings get Bash to:

  • Perform file completion in a case insensitive fashion;
  • Treat hyphens and underscores as equivalent;
  • Display matches for ambiguous patterns at the first press of the tab key (instead of requiring two tab-presses).

2. Sane history defaults

Some tweakings to the command history, mostly taken from Tom Ryder's article Better Bash History. These options will get Bash to:

  • Append to the history file instead of overwriting it;
  • Save multi-line commands as one command;
  • Record each line as it gets issued;
  • Keep track of a bigger history;
  • Avoid duplicate entries;
  • Avoid recording unneeded commands (exit, ls, bg, fg, and history itself);
  • Make use of a timestamp format that is actually useful.

3. Better directory navigation

Options to make file system navigation blazingly fast:

  • Prepend cd to directory names automatically, so you can cd into directories just by typing their name;
  • Automatically correct spelling errors during tab-completion;
  • Automatically correct spelling errors in arguments supplied to cd;
  • CDPATH defines where cd will look for targets—the default is the current working directory, but you can add directories you want to have fast access to (ex: projects, repos, documents...)
  • cdable_vars allows you to define paths as variables and cd into it from wherever you are in the file system, kind of like a bookmarking system for Bash.

Usage

You can copy sensible.bash in your bashrc, cherry-pick the options you like most, or source the file at the top of your bashrc:

if [ -f ~/bin/sensible.bash ]; then
   source ~/bin/sensible.bash
fi

Note: Make sure you're running at least Bash 4.x or some options may not work. Keep your software up-to-date!

Note for OS X users

If you're using OS X, I recommend to follow Josh Staiger's advice and source bashrc from bash_profile so to keep all your configuration in one place.

Contributing

Consider this as a work in progress where everything is open for discussion. Feel free to open an issue or submit a pull request if you think I've missed something important. Same goes for options you think should be removed.

See also

License

MIT

bash-sensible's People

Contributors

joegrandominico avatar lookfirst avatar mrzool avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.