Skip to content

Sensible defaults for your command line (shell aliases, git aliases, etc)

Notifications You must be signed in to change notification settings

samorajp/sensible-dotfiles

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Think of this repo as a set of defaults that common cli tools should have had in the first place. Many people have similar aliases and settings - this is an attempt to create a "common ground" that will be useful for everyone.

  • if you haven't done much command line customization before, this will be a good starting point

  • if you are managing a shared Linux server, you can install this rather than confuse other people with your personal dotfiles

I'm going to keep this repository small and focused. Right now it's barely over 200 lines of code, and I never expect it to exceed 500. If you're interested in my personal configuration (forked from this repo), look here.

Installation

Clone the repo and run the installation script. It will make a backup of your existing config files before installing new ones (unless you run it with --overwrite option).

git clone https://github.com/janek-warchol/sensible-dotfiles ~/.dotfiles.git
~/.dotfiles.git/.install-dotfiles.sh

You'll probably want to move some parts of your old configuration into the new files. For convenience, all .sh files from .config/bash/ directory will be automatically sourced by .bashrc.

Note that to manage this repo you have to use dotfiles command instead of git (see Structure).

There are two additional programs worth installing:

  • ranger: a console file manager. Believe me, it's much better than typing cd and ls all the time.
  • trash-cli: command-line interface to system trash. Have you ever rm'ed wrong file and wanted to get it back?

Both are available from apt repositories: sudo apt-get install ranger trash-cli.

Features

  • git-aware bash prompt displaying repository status, like this:
    janek@janek ~/.dotfiles.git (master|REBASE-i 3/5) - very convenient!

  • lots of git aliases and settings, in particular:

    • informative and pretty logs,
    • more information in case of merge conflicts,
    • git diff that displays file renames correctly
  • handy shell aliases - did you know that

    • grep can highlight matches even when piped to less?
    • ls can group directories together, listing them above files?
  • cool bash settings, for example:

    • case-insensitive autocompletion,
    • cd to a directory just by typing its name, autocorrect typos

Structure

Some people keep their dotfiles in a special folder and symlink them to their $HOME. Others turn their whole $HOME directory into a git repository.

I use a hybrid approach that takes the best of both worlds: $HOME is my working directory, but the actual repository data is not kept in $HOME/.git - it can be in any directory you want (by default it's in the directory where the repo was initially cloned).

Git will recognize that $HOME is a repository only if you call it like this:

git --work-tree="$HOME" --git-dir="$HOME/.dotfiles.git"

(that's what the dotfiles command does).

This design has the following advantages:

  • there are no symlinks that could get broken by some other programs,
  • dotfiles' .gitignore doesn't interfere with other repositories,
  • if you accidentally run a git command in a wrong dir you won't mess everything up.

Credit for this idea goes to [Kyle Fuller] (http://kylefuller.co.uk/posts/organising-dotfiles-in-a-git-repository/).

Note that git is configured to ignore everything except hidden files in this repository - see .gitignore for details.

License

I release this work into public domain. Attribution will be very welcome, but it's not strictly required. Enjoy!

About

Sensible defaults for your command line (shell aliases, git aliases, etc)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%