Commit graph

445 commits

Author SHA1 Message Date
George Brocklehurst
ed6f00931a
Enable Git's autosquash feature by default.
Autosquash makes it quicker and easier to squash or fixup commits during an
interactive rebase. It can be enabled for each rebase using `git rebase -i
--autosquash`, but it's easier to turn it on by default.

Say I have this history:

    $ git log --oneline
    aaa1111 A first commit
    bbb2222 A second commit
    ccc3333 A third commit

I make another change that I already know should be squashed into "A
second commit". I can do this:

    $ git add .
    $ git commit --squash bbb2222
    [my-branch ddd4444] squash! A second commit

Then when I rebase:

    $ git rebase -i origin/my-branch

The interactive rebase list will be set up ready to squash:

    pick aaa1111 A first commit
    pick bbb2222 A second commit
    squash ddd4444 squash! A second commit
    pick ccc3333 A third commit

Since it's unlikely that anyone will be writing a commit message that begins
`squash!` or `fixup!` when they don't want this behaviour, and the user
still has a chance to review what's going to happen with the rebase, it's
safe to have it always turned on.
2015-05-02 22:37:41 -04:00
Geoff Harcourt
5724d124a5 Use vim-plug over vundle
[vim-plug](https://github.com/junegunn/vim-plug) has a number of
advantages over Vundle:

* Installs and updates plugins very quickly in parallel
* Can lock plugins at versions/tags
* Can rollbacks updates (useful if a plugin breaks) and take/reload
  snapshots of current state
* Optionally lazily-load plugins when their relevant command is invoked
* Execute post-update hooks for plugins with compiled extensions, etc.

vim-plug uses a DSL very close to Vundle (simplest form is `Plug` vs.
`Plugin`), and here it is set to continue to use the same plugin
location that Vundle was using before.

After updating, users will need to
1. Rename `Plugin` lines in `.vimrc.bundles.local` to use `Plug`
2. Run `:PlugInstall` (the post-up hook does this)
2015-04-27 19:14:22 -04:00
Dan Croak
24b34d1bec Move Git aliases to subcommand scripts
Any executable script on you PATH
that is named `git-some-name`
will be available as a git subcommand,
which means you could do `git some-name` to run the script.

Git adds them to `git help -a` under the title
"git commands available from elsewhere on your $PATH",
which will then power the auto completion,
so that will also work for any command you add.

http://blog.zamith.pt/blog/2014/11/05/supercharging-your-git/

Examples of other projects that structure their dotfiles like this:

https://github.com/robbyrussell/oh-my-zsh
https://github.com/tj/git-extras
https://github.com/holman/dotfiles
2015-04-27 13:47:52 -07:00
Greg Lazarev
266984354b Ignore vendor/ during ag searches 2015-04-09 14:46:10 -07:00
Andy Waite
fc4f011862 Enable autocomplete with dictionary words
Enable autocomplete with dictionary words when
spell check is on.
2015-04-09 10:30:07 -07:00
Jessie A. Young
b3cb23830d Remove GitHub colorscheme
* Every time I pull updates from this repo into my own dotfiles, I have to
  reconfigure my preferred theme (solarized)
* Seems like there is not a majority or plurality of thoughbotters using a
  single colorscheme
* Easiest to just not specify a colorscheme
* See https://forum.upcase.com/t/why-is-the-default-vim-theme-on-dotfiles-is-github/4232
2015-03-18 10:16:39 -07:00
Derek Prior
cf624303b5
Let ctrl-p find files with a leading dot
I am constantly forgetting that I can't use `ctrl-p` to open
`.travis.yml` or any other file with a leading `.`. This change comes
about after some discussion in general on how to handle this. Passing
`--hidden` to the `ag` command allows it to find files with a leading
`.`.

Unfortunately, this also includes the content of your `.git`
directory. To overcome this, we add `/.git/` to `agignore`.
2015-03-13 14:17:51 -04:00
Joe Ferris
2eb9145f6b Update credits
* Break up credits section into thanks/about
* Use new "About thoughtbot" section
2015-03-09 13:48:23 -04:00
Josh Hartigan
e088612438 remove set nocompatible
It is not needed - see http://vimdoc.sourceforge.net/htmldoc/options.html#'nocompatible'
(or see :help 'cp')
2015-02-24 11:31:44 -08:00
Zachary Jones
44f678312d set --nocolor flag to make piping xargs safe 2015-02-23 14:39:06 -08:00
Blaine Schmeisser
55fca47954 Add the -v flag to commit --amend.
This allows us to always see things we are going to commit, even if we
are amending.
2015-02-23 14:52:02 -06:00
Ian Zabel
bca5bdfd9e Add git branches command
* Lists all remote branches
* Sorts by last commit date, descending
* Shows how long the branch has been around
* Shows last commit author

```
$ git branches
6 days ago  Dan Croak  origin/HEAD
6 days ago  Dan Croak  origin/master
5 months ago  Dan Croak  origin/dc-rbenv-zsh
6 months ago  Sean Doyle  origin/sd-nvm-path
6 months ago  Tute Costa  origin/vim-multiple-cursors
7 months ago  Sean Doyle  origin/sd-vundle
8 months ago  Sean Griffin  origin/sg-disable-spring
9 months ago  Mike Burns  origin/mb-experimental-tag
```
2015-02-20 16:40:12 -05:00
Dan Croak
326fae7de7 Switch from gh to hub
* `hub` is the official GitHub client.
* Like `gh`, `hub` 2.2.0 now powered by the Go programming language.
  https://github.com/github/hub/releases/tag/v2.2.0
* It has been bottled in Homebrew.
  Homebrew/homebrew@1ad37e4
* We are using it in the Laptop script.
  9fe038cd81
2015-02-18 09:59:14 -08:00
lunohodov
38d11d3afb Prevent unreadable prompt within Git repository
When within a git repository, doing a tab-autocomplete on a command results with the command becoming unreadable. The command still works but this is pretty annoying visually.

Basically I

1. Navigate to a directory with a git repository in it. The prompt indicates the current branch properly
2. Next, type `git -` and hit tab

The prompt now shows only part of branch's name with the first suggestion appended.

After googling a bit I stumbled upon several pages describing a similar problem (most useful to me was http://stackoverflow.com/questions/23740862/issues-with-zsh-prompt).

The culprit seems to be the git_prompt_info function escaping the `$current_branch` variable as if it is a color. As a result zsh is confused where the cursor is. After "unescaping" the variable everything seems to work fine.

Using zsh 5.0.7 (x86_64-apple-darwin13.4.0).
2015-02-12 15:20:25 +01:00
Daniel Nolan
18a4c817bb Stop ag from excluding directories with ds_store
* Silver searcher or ag was filtering out any directory that had a
  .DS_STORE file. Any directory that has a .DS_STORE file in it is being
  ignored by ag and therefor does not show up in the ctrlp fuzzy finder
  either.
* Removing the * from before .DS_STORE in the gitignore
  file still prevents .DS_STORE files from being checked into source
  control and stops ag from filtering out the directory. I am not sure
  if this is a bug with silver_searcher or what
2015-02-09 10:01:00 -08:00
Robert Eshleman
192729a5d6 Don't interpolate environment variables in aliases
A few aliases contain references to environment variables, but were
defined using double quotes. This caused zsh to interpolate the value of
those variables when the alias was defined instead of when it was
executed. In particular, any change to `PATH` (or `EDITOR` or `VISUAL`)
in `.zshrc.local`, which is sourced after `.aliases`, would not be
reflected in these aliases.

This commit defines these aliases using single quotes so that the
environment variables are evaluated when the alias is executed.
2015-02-02 20:07:38 -05:00
Dan Croak
b0fe7c01ff Add git rename-branch alias
* Extract `git current-branch` alias.
* Re-use `git current-branch` in two places.
2015-01-25 16:48:36 -08:00
Geoff Harcourt
d874ae2cbc Remove outdated references to Rnavcommand
`Rnavcommand` has been removed from rails.vim. These commands don't work
if you are using a recent version of the plugin. Users who want to
regain this functionality can do it through projections.
2015-01-13 13:53:39 -05:00
Derek Prior
bbf920942f
Add alias for pretty-printing $PATH
I've had a number of issues with $PATH of late and I kept using this to
make it readable (and comparable).
2014-12-19 10:51:02 -05:00
Daniel Nolan
c0ca64b48a Replace kien/ctrlp.vim with ctrlpvim/ctrlp.vim
* kien has not commited to ctrlp.vim in over a year.
* Switch to ctrlpvim/ctrlp.vim since it is actively maintained.
2014-12-12 10:16:13 -05:00
Chris Toomey
fa18537afd Update tat script to also work from within tmux
The existing script would fail if run from within tmux as the default
behavior would cause a nested tmux session which is bad. This update
detects if the current context is within tmux and properly handles this
by creating a detached session and switching to it as needed.

The idea with this is for tat to behave correctly regardless of context,
which I believe this update achieves. Existing users and workflows all
work identically, but now this adds support for a workflow that remains
within tmux at all times.

I prefer to remain within tmux all the time, rather than falling back to
the shell, navigating to another directory, and then creating the
session from there. With this update, I split a pane in the current tmux
window, navigate to the directory for the new session, and use `tat` to
open (or attach) to the new-session without ever leaving tmux.

I actually [have a binding that I use for this][], `C-b` (I am
"breaking" out a new session), that is mapped to `bind C-b send-keys
'tat && exit' 'C-m'`, which also cleans up the pane.

The reason for wanting this workflow is I am pretty strict about keeping
a tmux session focused to a single project (~ maps to a git repo). I
regularly want to reference another app and will use this workflow to
quickly open that project in a new session.

A "detached" session is one which has no clients attached. [From the man
page entry][] for `new-session`: `The new session is attached to the
current terminal unless -d is given.` This essentially creates it in the
background, preventing nesting. Then the script can attach the current
client using the `switch-client` command.

[have a binding that I use for this]: 01cc928672/tmux/tmux.conf (L89)
[From the man page entry]: http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man1/tmux.1?query=tmux&sec=1
2014-12-09 13:06:49 -05:00
Brandon Cordell
cfcb8497bf Fix pre-commit, prepare-commit-msg hooks
For users who had not overridden the `pre-commit` or
`prepare-commit-msg` Git hooks,
they would see `git commit` hang,
with nothing happening.

The command would exit without going to their editor.

The bug was introduced in d7f194f94e
and the fix is to return a 0 exit code when the override is not present.
2014-12-05 11:35:15 -08:00
Dan Croak
d7f194f94e Add more Git hooks, delegate to .local convention
The `pre-commit` and `prepare-commit-msg` git hooks can be used
for some interesting things such as linting files.

For example, I need to format, vet, and lint Go files:

https://github.com/croaky/dotfiles/blob/master/git_template.local/hooks/pre-commit
https://github.com/croaky/dotfiles/blob/master/git_template.local/hooks/prepare-commit-msg

We've rejected Go-related pull requests to thoughtbot/dotfiles
due to not doing enough "official" Go work at the company.
This change helps me start with `.local` for now,
and then promote to "upstream" (thoughtbot/dotfiles) at some point
in the future if we do more "official" Go work.

I'm a believer in having linting done at VCS "commit time", either
locally in a pre-commit so I have a chance to fix things and not both my
teammates with linting issues, or at post-commit time via Hound comments
(also automated, but opportunity to ignore).

I've tried adding linting libraries to my editor, and found them too
slow, at least for Ruby. I've limited "editor-time" checking to just
syntax checking via Syntastic.

The downsides I see to adding linting to the test suite are:

* Style violations are not functional failures and logically shouldn't
  fail a build.
* Adding code coverage, linting, etc. to a test suite slows down the
  build.
* I only need to lint my diff (the commit), not the whole codebase, when I
  make changes.
* Style violations should not prevent a user-facing, production deploy.
* Adding linting to the test suite can slow that process down
  unnecessarily, particularly in continuous integration setups.

I see the appeal of linting in the test suite, particularly for
greenfield apps where we have total control, but I don't think it's a
practice that we can universally apply to our client projects who have
different deploy setups and existing codebases. So, I prefer the git
hooks + Hound approach as a pragmatic middle ground.
2014-12-02 21:49:53 -08:00
Dan Croak
782bcf7ddb Remove mention of Brewfile
It is no longer in our dotfiles.
2014-12-02 21:01:54 -08:00
Greg Lazarev
fe180f78d5 Fix typo in zshenv path 2014-11-14 13:08:16 -08:00
Daniel Nolan
be8e18a880 Revert adding /usr/local/bin to path in zshenv
* Adding /usr/local/bin to path in `~/.zshenv` causes it to be in my path twice one right after the other. /usr/local/bin is already added to the path in the correct order on OSX Yosemite by the /etc/paths file. 

* Remove /usr/local/bin from path export in zshenv
2014-11-14 11:16:46 -08:00
Chris Toomey
6fc3482610 Use POSIX compliant test command in git hooks
Ubuntu systems will error out on `[[` in shell scripts with `#!/bin/sh`
as the shebang.
2014-11-03 20:26:48 -05:00
Derek Prior
1eff8c03ec
Spell check git commits 2014-11-03 15:45:55 -05:00
Ian Zabel
f587e307e8 Revert "include, filter, user"
This reverts commit 383612ac4c.
2014-11-02 11:35:59 -05:00
Ian Zabel
383612ac4c include, filter, user 2014-11-02 11:33:26 -05:00
Derek Prior
de8543e54f
Add /usr/local/sbin to PATH
Some homebrew formulae, (e.g. [RabbitMQ][1]) link binaries here.

[1]: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/rabbitmq.rb
2014-10-28 22:25:22 -04:00
Robert Eshleman
a65b56ddcb Wrap at 72 characters for git commit messages
The body of a git commit message is conventionally ([1], [2]) wrapped at
72 characters. This commit adjusts .vimrc to automatically wrap the body
of git commit messages at 72 characters.

[1]: http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message
[2]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
2014-10-27 12:19:03 -05:00
Eric Collins
a99fbb0f57 Ignore tags file, but not directories named tags 2014-10-24 15:38:05 -04:00
Mike Coutermarsh
cf10a8358f Updating readme to use thoughtbot/formulae
Brew bundle is deprecated. fixes #309
Removes Brewfile, no longer needed
2014-10-22 08:54:13 -07:00
Albert Arvidsson
2e3e64e9b9 Prevent evil nbsp from being invisible
Not seeing these can be problematic, since you won't know what broke your code on the day that one of them sneaks in.

Here's a few other common characters people use for this: https://github.com/search?utf8=%E2%9C%93&q=nbsp%3A+extension%3A.vimrc&type=Code&ref=searchresults
2014-10-22 08:51:47 -07:00
jake romer
635992e1e9 Include local gitconfig at the end of .gitconfig
Allows for customizing git's commit message template and overriding fetch.prune.
2014-10-18 21:43:16 -07:00
Mike Burns
c51b1e8c17
Fix the zsh config glob
The glob used a modifier, but it was modifying a directory instead of a
glob that matched all the files in the directory. Add the missing `*` to
fix this.
2014-10-03 10:28:08 -07:00
Derek Prior
b4b9168b19
Remove unused plugins after rcup
Running `rcup` should remove any plugins that are no longer in use. For
instance, we recently replaced `rename.vim` with `eunuch`. `rcup`
installs the new plugin but does not clean up `rename` from the plugins
directory. The addition of `PluginClean!` does this (without
confirmation).
2014-10-01 09:37:30 -04:00
Dan Croak
03dc6172f7 Use gh, not hub
[gh] is a [hub] reimplementation that's much faster and is now the official
Github CLI. It appears that "hub" is [deprecated].

[gh]: https://github.com/jingweno/gh
[hub]: https://github.com/github/hub
[deprecated]: github/hub#475

Matches thoughtbot/laptop:

d9a9dfe09b
2014-09-30 15:43:41 -07:00
Dan Croak
90f3b577e8 Document vim-mkdir in README 2014-09-30 09:31:48 -07:00
Greg Lazarev
85e9f22e48 Remove old doc directory
Resolves #276
2014-09-12 11:49:58 -07:00
Robert Speicher
6a1bd18a1f Add zshenv file
From the [Zsh manual](http://zsh.sourceforge.net/Intro/intro_3.html):

> '.zshenv' is sourced on all invocations of the shell, unless the -f option is
> set. It should contain commands to set the command search path, plus other
> important environment variables. `.zshenv' should not contain commands that
> produce output or assume the shell is attached to a tty.

Why is this important? [Alfred](http://www.alfredapp.com/) workflows run in
non-interactive shells. When the `$PATH` is set, or `rbenv` is initialized, in
`zshrc` instead of `zshenv`, those workflows will not use the correct Ruby
version and might not have access to certain bin files, such as those from
`$HOME/.bin/` or Homebrew.
2014-09-12 11:45:03 -07:00
Derek Prior
975cf7bc72
Force vertical diffs
Fugitive was updated to switch to horizontal diffs on narrow screens.
Everyone I've seen experience this behavior finds it disorienting. This
setting forces a vertical diff without users having to use different
shortcuts to enter diff mode.
2014-09-12 11:15:47 -04:00
Robert Speicher
c55d4ddff9 Change rename.vim to Tim Pope's vim-eunuch
Does what rename.vim does (`:Move` or `:Rename`) **plus**:

* Adds `:Unlink` or `:Remove` to delete the current buffer + file
* Adds `:Mkdir` (with no argument, create the current file's containing
  directory)
* Adds `:SudoWrite` if you forget to edit a file as root
* Automatically chmods a file to `+x` if it starts with `#!`
* Tim Pope! ❤️
2014-09-11 09:11:13 -04:00
Derek Prior
eb5fe555ae
Add vim-repeat plugin
Repeat.vim remaps `.` in a way that plugins can tap into it. With this
plugin you can, for instance, repeat commands from surround.vim.
2014-08-28 08:50:00 -04:00
Sean Doyle
cbdcbce01d Introduces git_template for init templating
Inspired by http://tbaggery.com/2011/08/08/effortless-ctags-with-git.html

* Make `ctags` executable configurable
* Adds `git ctags`
* Runs `ctag` on `commit` / `branch` / `checkout`
* Extensible via `~/.git_template.local/hooks/{pre,post}-*`
* explain `git_template` under `git` section
2014-08-27 16:43:38 -04:00
Mike Burns
73497a7c54
Introduce ~/.zsh/configs
Just before loading `~/.zshrc.local`, load:

1. `~/.zsh/configs/pre/**/*`
2. `~/.zsh/configs/**/*` # excluding pre and post
3. `~/.zsh/configs/post/**/*`

About the zsh glob:

- `.`: only produce normal files.
- `-`: follow symlinks to their final file; skip any broken links.
- `N`: do not complain about zero matches.

Big ups to Pat Brisbin for finding `N`.
2014-08-27 17:47:26 +02:00
Eric Eslinger
a416222eb4 \unset QUIET is case sensitive 2014-08-14 15:33:59 -07:00
Tute Costa
876f375ce7 Revert "Add vim-multiple-cursors plugin for Vim"
This reverts commit 422a6f6d33.

Want to go through a PR cycle.
2014-08-12 13:55:48 -04:00
Tute Costa
422a6f6d33 Add vim-multiple-cursors plugin for Vim 2014-08-12 13:53:01 -04:00