Giter VIP home page Giter VIP logo

dotfiles's Introduction

My Dotfiles

This repository contains my Linux dotfiles.

Installation and usage

Quickstart:

mkdir -p ~/p
cd ~/p
git clone https://github.com/MarkLodato/dotfiles
git clone https://github.com/MarkLodato/git-reparent
git clone https://github.com/MarkLodato/scripts
git clone https://github.com/so-fancy/diff-so-fancy
dotfiles/.setup_dotfiles.sh
vim +PlugInstall +qall
vim '+UnicodeDownload!' +qall
sudo apt install libterm-readkey-perl zsh hub tmux
sudo usermod -s "$(command -v zsh)" "$USER"

From now on, use gd instead of git to manage dotfiles. Examples:

$ gd add -p
$ gd commit

The .gitignore is set up to monitor any new dotfiles but to ignore files not starting with a dot at the top level. That way, git status will indicate any new files that should be added to (or ignored by) the repository.

There are two branches:

  • master, which is checked out at ~/p/dotfiles and is pushed to GitHub
  • home, which is checked out at ~ and is local to the machine

To pull changes from GitHub:

$ cd ~/p/dotfiles
$ git pull --ff-only
$ gd merge --ff-only

To push changes to GitHub:

$ cd ~/p/dotfiles
$ git merge --ff-only home
$ git push

Explanation

It is undesirable to check out the repo directly to ~ because then git would think everything in the home directory is part of this repo. Instead we move the .git directory elsewhere and specify --git-dir=... --work-tree=$HOME via an alias, gd. This way we only manage dotfiles intentionally.

We also maintain two separate worktrees, ~ and ~/p/dotfiles, on branches home and master, respectively. This dual-worktree setup allows us to carefully control what gets pushed to GitHub. It also allows us to avoid messing up our live dotfiles with merge conflicts.

The .setup_dotfiles.sh script creates a dummy alternate worktree at ~/.dotfiles and then checks out the files to $HOME.

Alternate Installation

An alternate, much more widely suggested strategy is to check out the files to a subdirectory and then set up symlinks for each file. While this is easier to understand, it requires much more maintenance and does not automatically detect new files.

Highlights

zsh: calc and pycalc

Use calc to do simple math, which is a convenient wrapper around $(( )).

$ calc 1 + 2
3
$ calc log2(3**5)
7.9248125036057813
$ calc -b 16 0x1000 + 12
0x100C

When that won't do, use pycalc to run the given expression through python. This is significantly slower than calc.

zsh: cycle-quotes

Press ALT-' to cycle the quoting of the current argument between single quoting, double quoting, backslash escaping, and back to the original (if different from one of the others.) For example, by repeatedly pressing ALT-' when the cursor is on the last argument, one cycles through the following:

$ foo bar --flag=one\ 'two $three'
$ foo bar '--flag=one two $three'
$ foo bar "--flag=one two \$three"
$ foo bar --flag=one\ two\ \$three

zsh: increment-number

Press ^X ^A or ^X ^X to increment or decrement the decimal number on, to the right of, or to the left of the cursor, just like in Vim. (Unlike Vim, we increment the number to the left of the cursor if none exist on or to the right.) For example, the following works anywhere on the line because there is only one number (note how leading zeros are preserved):

$ mplayer track01.wav           ->      $ mplayer track02.wav

However, if there were two numbers, position your cursor on or to the left of the number to increment it. In the following examples, ^ indicates cursor position when ^X ^A is pressed.

$ cp foo.001 foo.001 dir        ->      $ cp foo.001 foo.002 dir
                        ^
$ cp foo.001 foo.001 dir        ->      $ cp foo.001 foo.002 dir
              ^
$ cp foo.001 foo.001 dir        ->      $ cp foo.002 foo.001 dir
      ^

dotfiles's People

Contributors

marklodato 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.