Git Product home page Git Product logo

dotfiles's Introduction

Mathias’s dotfiles

Screenshot of my shell prompt

Installation

Warning: If you want to give these dotfiles a try, you should first fork this repository, review the code, and remove things you don’t want or need. Don’t blindly use my settings unless you know what that entails. Use at your own risk!

Using Git and the bootstrap script

You can clone the repository wherever you want. (I like to keep it in ~/Projects/dotfiles, with ~/dotfiles as a symlink.) The bootstrapper script will pull in the latest version and copy the files to your home folder.

git clone https://github.com/mathiasbynens/dotfiles.git && cd dotfiles && source bootstrap.sh

To update, cd into your local dotfiles repository and then:

source bootstrap.sh

Alternatively, to update while avoiding the confirmation prompt:

set -- -f; source bootstrap.sh

Git-free install

To install these dotfiles without Git:

cd; curl -#L https://github.com/mathiasbynens/dotfiles/tarball/main | tar -xzv --strip-components 1 --exclude={README.md,bootstrap.sh,.osx,LICENSE-MIT.txt}

To update later on, just run that command again.

Specify the $PATH

If ~/.path exists, it will be sourced along with the other files, before any feature testing (such as detecting which version of ls is being used) takes place.

Here’s an example ~/.path file that adds /usr/local/bin to the $PATH:

export PATH="/usr/local/bin:$PATH"

Add custom commands without creating a new fork

If ~/.extra exists, it will be sourced along with the other files. You can use this to add a few custom commands without the need to fork this entire repository, or to add commands you don’t want to commit to a public repository.

My ~/.extra looks something like this:

# Git credentials
# Not in the repository, to prevent people from accidentally committing under my name
GIT_AUTHOR_NAME="Mathias Bynens"
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
git config --global user.name "$GIT_AUTHOR_NAME"
GIT_AUTHOR_EMAIL="[email protected]"
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
git config --global user.email "$GIT_AUTHOR_EMAIL"

You could also use ~/.extra to override settings, functions and aliases from my dotfiles repository. It’s probably better to fork this repository instead, though.

Sensible macOS defaults

When setting up a new Mac, you may want to set some sensible macOS defaults:

./.macos

Install Homebrew formulae

When setting up a new Mac, you may want to install some common Homebrew formulae (after installing Homebrew, of course):

./brew.sh

Some of the functionality of these dotfiles depends on formulae installed by brew.sh. If you don’t plan to run brew.sh, you should look carefully through the script and manually install any particularly important ones. A good example is Bash/Git completion: the dotfiles use a special version from Homebrew.

Feedback

Suggestions/improvements welcome!

Author

twitter/mathias
Mathias Bynens

Thanks to…

dotfiles's People

Contributors

0xcc77 avatar alrra avatar andrewsouthpaw avatar atdt avatar christiangaertner avatar djallits avatar dunn avatar goodtimeaj avatar hkdobrev avatar hongymagic avatar jeffbyrnes avatar jmuth avatar kdeldycke avatar mathiasbynens avatar matijs avatar mischah avatar necolas avatar nizaroni avatar oschrenk avatar paulirish avatar pkruithof avatar porada avatar remitbri avatar richo avatar s10wen avatar sindresorhus avatar sjonnet19 avatar stevemao avatar user996015 avatar wamatt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dotfiles's Issues

Some of the files not working?

I've just installed these dotfiles on a 2009 white macbook rocking OS X Lion.

I'm pretty sure the .brew and .osx files aren't initialising at all using the bootstrap script. Is the .brew file supposed to launch during install?

Allow piping to the `json` function

function json() {
    if [ -p /dev/stdin ]; then
        while read data; do
            python -mjson.tool <<< "$data" | pygmentize -l javascript
        done
    else
        python -mjson.tool <<< "$*" | pygmentize -l javascript
    fi
}

# now these will both work:
json '{"foo":42}'
echo '{"foo":42}' | json

Thanks to @janmoesen for the -p tip.

`gsay` function (use Google’s Translate API to say things)

function gsay { local lang=nl str="$*" tmp="/tmp/gsay.$$.mp3" i=0 line; [ -t 0 ] || str="$(cat)"; fmt -w 100 <<< "$str" | while read -r line; do url="http://translate.google.com/translate_tts?ie=UTF-8&tl=$lang&q=${line//&/%26}"; url="${url// /+}"; curl -sH 'User-Agent: Notabot' "$url" >| "$tmp" && afplay "$tmp"; done; rm -f "$tmp"; }

/by @janmoesen

.osx: Disable the iTunes arrow links completely

I'm not sure from which version has changed, but in 10.6.3 (latest) is no longer:

defaults write com.apple.iTunes show-store-arrow-links -bool false

now is:

defaults write com.apple.iTunes show-store-link-arrows -bool false

and it's disabled by default

24 hour clock in login/lock screen

This should probably be near the top since it requires the user to change the locale.

sudo defaults write /Library/Preferences/.GlobalPreferences AppleLocale "sv_SE"
sudo defaults write /var/root/Library/Preferences/.GlobalPreferences AppleLocale "sv_SE"

Use git to merge local ~/.* changes with upstream changes.

Instead of blowing changes away with rsync.

It’s annoying when trying out changes to have to edit files in ~/dotfiles, then run bootstrap.sh after each change.

Perhaps there is a way to keep the .git directory in ~/dotfiles but use the files in ~?

Does .osx trackpad right-click actually work?

Today I rebooted my Mac and ended up with the trackpad's bottom-right corner no longer mapped to right-click (for whatever reason). The .osx setting (see below) didn't seem to make any difference and I had to manually change the setting in System Prefs.

# Map bottom right Trackpad corner to right-click
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true

BTW, I'm using Snow Leopard.

Set 3-finger swipe for back/forward

2 finger swipe for back/forward in web browser history is really annoying as it matches the swipe used for scrolling left/right.
I have mine set to 3-finger swipe back/forward by default. Would be great to have this set in dotfiles too.

You have 2 aliases for c

I was confused as to why I wasn't getting pygementized output, then I found this:

# `cat` with beautiful colors. requires Pygments installed.
#                              sudo easy_install Pygments
alias c='pygmentize -O style=monokai -f console256 -g'

# Trim new lines and copy to clipboard
alias c="tr -d '\n' | pbcopy"

Maybe you knew, maybe you didn't.

Battery Time no longer works

This command no longer seems to work with Mountain Lion:

defaults write com.apple.menuextra.battery ShowTime -string "YES"

Any alternatives?
Should there be versions included here to determine which settings no longer function in newer versions of OSX

“Use black and white menu bar icons” setting for Dropbox

As I do this for every new install, I’d like to enable the “Use black and white menu bar icons” Dropbox setting programatically (from within.osx, perhaps).

Sadly, rather than using a .plist file, Dropbox seems to store this setting in ~/.dropbox/config.dbx, which is an encrypted SQLite database.

Filing this issue in case there’s a workaround that’s not too complex.

AppleEnableMenuBarTransparency

# Disable menu bar transparency
defaults write -g AppleEnableMenuBarTransparency -bool false

This has been available as a checkbox in System Preferences for ages.

Add Git-less install to README

For non-dev friends who don’t use Git but still want to have a decent OS X setup. Something like:

cd
for file in aliases bash_profile bash_prompt bashrc exports functions gitattributes gitconfig gitignore inputrc osx vimrc; do
    echo "Downloading .${file}"
    curl -O# "https://raw.github.com/mathiasbynens/dotfiles/master/.${file}"
done
echo "Done"

dotfiles wiped out my .bashrc .bash_profile !!!!

I trusted bootstrap.sh to do some fancy stuff but instead it ended up deleting my carefully crafted bashrc....
Did I miss something ? Please WARN the people if this is going to modify essential files !!!!

.osx: Add Spotlight preferences

$ defaults read com.apple.spotlight orderedItems
(
        {
        enabled = 1;
        name = APPLICATIONS;
    },
        {
        enabled = 1;
        name = "SYSTEM_PREFS";
    },
        {
        enabled = 1;
        name = DIRECTORIES;
    },
        {
        enabled = 1;
        name = PDF;
    },
        {
        enabled = 1;
        name = FONTS;
    },
        {
        enabled = 0;
        name = DOCUMENTS;
    },
        {
        enabled = 0;
        name = MESSAGES;
    },
        {
        enabled = 0;
        name = CONTACT;
    },
        {
        enabled = 0;
        name = "EVENT_TODO";
    },
        {
        enabled = 0;
        name = IMAGES;
    },
        {
        enabled = 0;
        name = BOOKMARKS;
    },
        {
        enabled = 0;
        name = MUSIC;
    },
        {
        enabled = 0;
        name = MOVIES;
    },
        {
        enabled = 0;
        name = PRESENTATIONS;
    },
        {
        enabled = 0;
        name = SPREADSHEETS;
    },
        {
        enabled = 0;
        name = SOURCE;
    }
)

…and…

$ plistbuddy -c "Print :orderedItems" ~/Library/Preferences/com.apple.spotlight.plist
Array {
    Dict {
        enabled = 1
        name = APPLICATIONS
    }
    Dict {
        enabled = 1
        name = SYSTEM_PREFS
    }
    Dict {
        enabled = 1
        name = DIRECTORIES
    }
    Dict {
        enabled = 1
        name = PDF
    }
    Dict {
        enabled = 1
        name = FONTS
    }
    Dict {
        enabled = 0
        name = DOCUMENTS
    }
    Dict {
        enabled = 0
        name = MESSAGES
    }
    Dict {
        enabled = 0
        name = CONTACT
    }
    Dict {
        enabled = 0
        name = EVENT_TODO
    }
    Dict {
        enabled = 0
        name = IMAGES
    }
    Dict {
        enabled = 0
        name = BOOKMARKS
    }
    Dict {
        enabled = 0
        name = MUSIC
    }
    Dict {
        enabled = 0
        name = MOVIES
    }
    Dict {
        enabled = 0
        name = PRESENTATIONS
    }
    Dict {
        enabled = 0
        name = SPREADSHEETS
    }
    Dict {
        enabled = 0
        name = SOURCE
    }
}

Based on this output, I’d expect the following to work:

defaults write com.apple.spotlight orderedItems -array "{ enabled = 1; name = APPLICATIONS; }" "{ enabled = 1; name = \"SYSTEM_PREFS\"; }" "{ enabled = 1; name = DIRECTORIES; }" "{ enabled = 1; name = PDF; }" "{ enabled = 1; name = FONTS; }" "{ enabled = 0; name = DOCUMENTS; }" "{ enabled = 0; name = MESSAGES; }" "{ enabled = 0; name = CONTACT; }" "{ enabled = 0; name = \"EVENT_TODO\"; }" "{ enabled = 0; name = IMAGES; }" "{ enabled = 0; name = BOOKMARKS; }" "{ enabled = 0; name = MUSIC; }" "{ enabled = 0; name = MOVIES; }" "{ enabled = 0; name = PRESENTATIONS; }" "{ enabled = 0; name = SPREADSHEETS; }" "{ enabled = 0; name = SOURCE; }"

However:

Ideas on how to get this to work are welcome!

Cursor movement and history search

What about adding these keybindings to .inputrc?

"\e[1~": beginning-of-line       # Home key
"\e[4~": end-of-line             # End key
"\e[5~": history-search-backward # Page Up
"\e[6~": history-search-forward  # Page Down
"\e[3~": delete-char             # Delete key
"\e[5C": forward-word            # Ctrl+right
"\e[5D": backward-word           # Ctrl+left

Showing and Hiding Hidden Files and Desktop Icons in 10.8

The previous method of showing/hiding hidden files in Finder no longer works for me on 10.8

This, however, does work:

# Show hidden files
defaults write com.apple.Finder AppleShowAllFiles YES; killall -HUP Finder
# Hide hidden files
defaults write com.apple.Finder AppleShowAllFiles NO; killall -HUP Finder

(I also use the -HUP flags on killall to request finder relaunch instead of forcing it to. Unrelated to this issue.)

A nifty way of detecting the OS or for this specific capability may be needed, or just run both old and new commands when the user triggers these in .aliases.

UPDATE: This also affects showing and hiding desktop icons. Click here to skip ahead to the (lack of) solution: #102 (comment)

.vimrc: set binary

The set binary option causes problems with tab-to-space conversion.

I also have this:

" Use 4 spaces for indentation and replace tabs in an intelligent way
set sw=4 sts=4 et

When combined with set binary, tabbing twice results in a tab rather than 8 spaces. Removing the set binary fixes the problem.

Pull request... I'm kind of new to github.

I'm not sure how to do this really. I've made a lot of changes to the code I branched from your code base, but their is one particular bit of the code I would like to push your way.

I've altered the ".bash_prompt" file to improve readability (for me) and to add SVN support. I thought you might want a look (https://github.com/manix84/dotfiles/blob/master/.bash_prompt).

I would be very interested to find out what you think of the changes I've made (good or bad).

.osx: Kill affected applications

You are printing a message after kill the Terminal, the message will never show up.

I'm applying this to my .osx

###############################################################################
# Kill affected applications or restart the system                            #
###############################################################################

echo "Done. Note that some of these changes require a logout/restart to take effect."
echo "To restart the system press [r] or to kill affected apps press [k]"

read option

if [ $option == "r" ]; then
    sudo shutdown -r now
elif [ $option == "k" ]; then
    for app in "Address Book" "Contacts" "iCal" "Calendar" "Dock" "Finder" "Mail" \
        "Safari" "iTunes" "SystemUIServer" "Terminal" "Twitter"; do
        killall "$app" > /dev/null 2>&1
    done
fi

what do you think about this?

Default app to open all files of particular file type

I've been looking for ways to control which app is the default to open certain file types. This way, when I install my dotfiles on another machine I don't have to use Finder to change the default app used to open .html, .css, etc., files when opened from Finder...that would be a real PITA.

Here are a couple of promising links:

http://superuser.com/questions/20822/where-does-mac-os-x-store-file-association-information
http://superuser.com/questions/273756/how-to-change-default-app-for-all-files-of-particular-file-type-through-terminal

With your superior defaults write-fu, you might find the solution (or lack of) sooner than me.

Uninstall script?

Is there a script to uninstall/revert back to defaults? If not, this would probably be a quick improvement.

Change Safari 6 default fonts

Via MacWorld:

# Change Safari 6 default fonts
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2StandardFontFamily 'Lucida Grande'
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DefaultFontSize 14
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2FixedFontFamily Consolas
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DefaultFixedFontSize 11

ProxiesInBookmarksBar

# Remove useless icons from Safari’s bookmarks bar
defaults write com.apple.Safari ProxiesInBookmarksBar "()"

This is available in Safari’s Preferences: “Bookmarks” tab → first two checkboxes.

Colored Autocomplete

Any chance we could get awesome colored autocomplete like this?
http://i.imgur.com/tN6w3.png

Some work for zsh has been done here
http://www.reddit.com/r/zsh/comments/msps0/color_partial_tab_completions_in_zsh/c367xqo

Yes, you can do it with things like that:
zstyle -e ':completion::default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)(?)==02=01}:${(s.:.)LS_COLORS}")'
Just change the 01 and 02 colors so it matches your taste, for example to match your screenshot:
zstyle -e ':completion::default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)(?)==34=34}:${(s.:.)LS_COLORS}")';

.osx: Remove delay when dragging icons from the Dock to remove them

As you all know, Dock icons can be removed by simply clicking them and dragging them out of the Dock. As soon as the “poof” animation appears, you can release the mouse button to remove the icon.

It seems like in Mountain Lion there is a bit of a delay plus a minimum distance required between when you start dragging and when the “poof” animation appears, i.e. when you can release the mouse button to remove the icon. If you release the mouse button before the “poof” animation appears, the icon won’t be deleted from the Dock. If you don’t drag the icon far enough away from the Dock, the “poof” animation won’t appear at all, and again the icon won’t be deleted from the Dock when you release the mouse button.

Is there a hidden setting (defaults write-style) or some other way to disable this delay and/or minimum distance setting?

Note: I’ve cross-posted this on http://apple.stackexchange.com/q/57617/4408.

Add an .editorconfig

Maybe an .editorconfig file would be a good addition?

From: http://editorconfig.org/

EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs.
The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins
that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readibly and
they work nicely with version control systems.

.osx: Enable the debug menu in iCal

defaults write com.apple.iCal IncludeDebugMenu -bool true

Apparently no longer exists this option in mountain lion!

I've tried also:

defaults write com.apple.Calendar IncludeDebugMenu -bool true

but isn't works. =/

iTerm settings

I’m considering adding a copy of ~/Library/Preferences/com.googlecode.iterm2.plist to the init folder, and a script or a check in .osx to move it to the correct location if iTerm is available.

The problem is this cannot be done from within iTerm itself, else the imported settings would get overwritten upon exit.

Make `server` serve everything as UTF-8

By iterating over th SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map dict, appending ";charset=UTF-8" to each item. Something like:

import SimpleHTTPServer; m = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map; m[''] = 'text/plain'; for k, v in m.items():
    m[k] = v + ';charset=UTF-8';
SimpleHTTPServer.test();

(untested)

Fun fact:

If you’re actually writing Python 3, then you would use { k: v+";charset=UTF-8" for k, v in d.items() } instead.

Note: Serving binary files as UTF-8 is not done, but it doesn’t actually break anything. Since server is only used for quick localhost tests, I don’t think anyone will mind.

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.