Commit graph

385 commits

Author SHA1 Message Date
Riley Dallas
af75a673b1 Capitalize l in leaders 2017-06-19 12:53:17 -05:00
Geoff Harcourt
0078865a67 Revert "Skip compiled wordcode files (ie. zwc extensions)"
This reverts commit 5178a8a1a8.
2017-05-25 13:10:02 -04:00
Geoff Harcourt
88618e5858 Revert "Combine conditional statements"
This reverts commit cae0bd04ea.

This implementation appears to break sourced configurations. Reverting
until we figure out a resolution.
2017-05-25 13:04:30 -04:00
John Eckhart
cae0bd04ea Combine conditional statements 2017-05-23 16:29:16 -04:00
John Eckhart
5178a8a1a8 Skip compiled wordcode files (ie. zwc extensions) 2017-05-22 02:19:20 -04:00
Geoff Harcourt
592249def2 Merge pull request #523 from thoughtbot/replace-coffee-with-java
Add JavaScript syntax highlighting
2017-05-08 16:06:55 -04:00
Geoff Harcourt
06197218c7 Don't rely on Bash in post-up hook
In 16219a31db we implemented a post-up
hook that checked for a problematic `/etc/zshenv` file. OSX/macOS has
changed the file responsible for executing `path_helper` and loading the
system paths multiple times, and this script change issued a warning to
users if `path_helper` might be called in such a way that their paths
could be unexpectedly reordered.

The script used colored output to highlight this problem for the user,
and relied on Bash's script path introspection (through `$BASH_SOURCE`)
to print the location of the `post-up` hook to assist the user in
troubleshooting and understanding where our warning came from.

This change removes the hook's reliance on GNU Bash in favor of `sh`. It
uses the POSIX-compliant `$0` to determine the hook location (this
method is less robust than Bash's `$BASH_SOURCE`, but is available in
all POSIX shells) and removes colored output in the warning to be
compatible with shells that don't support colored output.

Fix #517.
2017-05-08 16:06:01 -04:00
Dan Croak
bab2ddc9f0 Add JavaScript syntax highlighting
It seems like JavaScript/ES6 is becoming more common for us to run into
in the wild compared to CoffeeScript
with the advent of Babel / transpiling.

Eventually, we'll probably want to remove kchmck/vim-coffee-script.
Users working on CoffeeScript applications would need to move that
plugin into their personal dotfiles.
2017-05-08 10:36:07 -07:00
Geoff Harcourt
336a282602 Run reset in post-up hook to fix terminal issue
Some tmux users have reported that when running `rcup` that during the
post-up hook Vim would issue errors about input not coming from a
terminal and then the terminal would look and behave unexpectedly.

Running `reset` after the Vim plugin install step in `post-up` appears
to resolve the issue.

Fix #516.
2017-04-28 16:31:25 -04:00
Geoff Harcourt
3bbab420bc Allow user to ignore some default vim plugins
The `UnPlug` command allows a user to remove a plugin from vim-plug's
list of plugins to install/activate. This command can be used to
selectively ignore shared plugins from `vimrc.bundles` without needing
to overwrite the entire file with a personal replacement.

This change is dependent on vim-plug continuing to use the `g:plugs`
global variable.
2017-04-28 14:54:44 -04:00
Matthew Sumner
b9b9e7db8c Unbind the shortcut for suspend-client
Why:

I occasionally will try to zoom in on a pane with the key combination of
C-s then z. However, instead of having the agility to remove my finger
from the ctrl key, I clumsily continue to have it depressed while
applying pressure to the z key. This results in the `suspend-client`
command being executed by tmux. I am then left not knowing what to do
and I can't reattach to the session the that terminal window. It's very
disconcerting and I wish it hadn't happened.

This PR:

Removes the binding for `suspend-client`.
2017-04-28 14:41:57 -04:00
Dan Croak
be8e5e58aa Remove gvimrc
This originally came from jferris/dotfiles,
the parent of thoughtbot/dotifles.

I'm not a Vim GUI user.
Are others at thoughtbot also shell Vim users?
2017-04-26 20:53:26 -07:00
Dan Croak
8fbef47fda Remove git churn command
I added this four years ago but haven't been using it.
Not common enough to be included in company-wide dotfiles?
Can move to personal dotfiles if desired.
2017-04-25 22:19:45 -07:00
Rootul Patel
09d54d448c README: Make customizations in ~/dotfiles-local 2017-03-24 13:46:32 -04:00
Tyson Gach
9ea82e8f58 Update thoughtbot logo 2017-03-10 09:39:51 -05:00
Stephanie Viccari
5ed9e4aa73 Add support for Elixir and EEx syntax highlighting 2017-02-21 10:31:52 -05:00
Geoff Harcourt
2fa36ccf9d Revert "Explicitly specify no input from terminal in post-up hook"
This reverts commit 99a18f6dbe.

Users reported problems after this change, so I'm pulling it.
2017-01-24 10:39:58 -05:00
Geoff Harcourt
99a18f6dbe Explicitly specify no input from terminal in post-up hook
This change prevents the `post-up` hook from breaking the terminal for
the rest of the session when running `rcup`. Since the session is
completely automated, we don't need input from the terminal once Vim
launches.
2017-01-19 18:04:14 -05:00
David Thompson
5eff1d7afb Move aliases below local config
Enables overriding of aliases that environment variables
2017-01-19 18:03:30 -05:00
Brad Urani
cfd26ef6aa Add pre-push git hook 2017-01-19 17:59:49 -05:00
Geoff Harcourt
e51d8b73f0 Add ag mappings in vim
https://robots.thoughtbot.com/faster-grepping-in-vim

- Create an `:Ag` command if none is defined.
- map `\` in normal mode to set up the command for an argument
2016-07-22 13:17:32 -04:00
Robert Speicher
c0717e7bd7 Use "absolute" paths for agignore
This seems to resolve an issue where CtrlP would randomly return "NO
ENTRIES".

See https://forum.upcase.com/t/ctrlp-sometimes-displays-no-entries/5658

This also sorts the paths alphabetically, because OCD. 🎉
2016-07-22 09:46:24 -04:00
Geoff Harcourt
85b11b6583 Update install documentation
In #488 there was some confusion over where to clone the dotfiles
repository before running `rcm`. While the repository can be placed
anywhere, by default users should be placing it in `~/dotfiles` if they
are using the default installation instructions and an unmodified
`.rcrc`.

Close #488.
2016-06-28 12:10:01 -04:00
Mike Burns
a1a9f6d694
Add a zsh binding for push-line-or-edit: ^Q
The use case for push-line-or-edit:

1. You are in the middle of typing a long command, perhaps something
involving `tar`.
2. You realize that you must first run another command, such as `man
tar`.
3. You invoke `push-line-or-edit`, which gives you a fresh prompt. You
type `man tar` and read as needed.
4. When the command (`man tar`) finishes, the long command you
half-typed is back, exactly as you left off.

Other use cases are realizing that you're in the wrong directory before
you press enter, changing your Ruby version before you press enter on
that `bundle` command, or in general being partway through something and
realizing that you're not quite ready to run it yet.

While here, turn off start/stop output control, which gives us back the
^Q keybinding.
2016-06-10 14:56:43 +02:00
Ian Zabel
40ccf0f3f8 Configure basic ctags for javascript projects
There are, apparently, more things we need to configure. @BlakeWilliams shared
http://dance.computer.dance/posts/2015/04/using-ctags-on-modern-javascript.html
which outlines a bunch more things that don't work out of the box. For
example, ES2015 classes and their methods are not properly found, even
with this PR. There's more work to do here.
2016-06-08 09:53:22 -04:00
Tute Costa
9793e833cf Git ignore .byebug_history
After using byebug on any Ruby file, the sessions history is written to
this file. It shouldn't be part of our repositories, so we ignore it.

See also: https://github.com/thoughtbot/suspenders/pull/710
2016-04-15 12:51:12 -04:00
Blaine Schmeisser
1dc550d985 Overwrite internal field separator when replacing.
Problem:
Currently the `for` in bash will break up lists by whitespace, so if a
filename has a space in it the `for` will break it up incorrectly.

AG will separate the files with a newline character, so this temporarily
overwrites the `IFS` to be used correctly for this use case.

[Docs](https://bash.cyberciti.biz/guide/$IFS)
2016-04-15 10:36:33 -04:00
Greg Lazarev
f25b410bba Avoid expanding tabs to spaces for Golang files
* `noexpandtab` will ensure tabs are used instead of staces when tabbing
or auto-indenting.
* `softtabstop=2` isn't needed because we are already setting
`tabstop=2` in our `.vimrc`.
2016-04-08 13:33:31 -04:00
Geoff Harcourt
3d867615a1 Add rhubarb.vim for fugitive Github support
We do most of our client work on Github,
and a large portion of our personal projects
are hosted there.

fugitive.vim currently supports
opening the current file in the current branch
in a browser at Github through the `Gbrowse` command.
That command is [slated to be removed to make fugitive
agnostic about coding sites](fugitive-docs).

The capability to quickly generate or view a Github URL
specific to the current branch
can be useful in PR reviews
or other discussions about code.

This change adds rhubarb.vim,
a plugin that implements the slated-to-be-removed
functionality of fugitive that works with Github.
It also provides the user with omni-completion (`<C-x><C-o>`)
to autocomplete Github issues, issue URLs, and collaborators.

[fugitive-docs]: 18d6d1ab82/doc/fugitive.txt
2016-04-08 11:06:55 -04:00
Brian Takashi Hooper
248fb06332 Update vimrc.bundles
Fixed typo
2016-03-24 22:56:40 +09:00
Derek Prior
8c8409e394 Use vim-test instead of vim-rspec
vim-rspec is an excellent Vim plugin for running RSpec tests but there
are many of us who run different kinds of tests on any given day.
vim-test is built to support a wide array of test frameworks and
strategies for executing those tests.

vim-test ships with support for several languages and frameworks in use
on thoughtbot projects today:

* Ruby (both RSpec and Minitest)
* Elixir (ExUnit and espec)
* Go (gotest)
* Python (nose, pytest, djangotest, djangonose)
* JavaScript (jasmine, mocha)

It also supports several execution strategies I have seen people use at
thoughtbot:

* Dispatch
* vim-tmux-runner
* Tslime
* Terminal.app/iTerm.app tabs
* neovim's native terminal
* `:!`

vim-test is extensible, both for additional languages/frameworks and for
execution contexts. See: https://github.com/janko-m/vim-test
2016-03-11 10:47:50 -05:00
Geoff Harcourt
a8bc74d10c Update copyright dates
It's 2016.
2016-02-22 14:31:30 -05:00
Adam Sharp
ee0278c0b0 Set the default shell type to POSIX in vim
If it can't be determined that a shell script is either `bash` or `ksh`, use `posix` as the default instead of plain `sh`. It seems unlikely that `/bin/sh` wouldn't be a POSIX-compliant shell on modern systems.

See [`:help ft-sh-syntax`](http://vimdoc.sourceforge.net/htmldoc/syntax.html#ft-sh-syntax) and [this thread on /r/vim](https://www.reddit.com/r/vim/comments/25g1sp/why_doesnt_vim_syntax_like_my_shell_files/chlc4ep) for more info.

This fixes the issue where `$(...)` syntax in shell scripts is highlighted as an error in vim.
2016-02-15 08:54:08 +11:00
Derek Prior
62d4ab1bdf
Add support for ctags in Elixir
Exuberant ctags has no native support for Elixir at this point. This
configuration is sourced from https://github.com/mmorearty/elixir-ctags.
2016-01-30 20:08:32 -05:00
George Brocklehurst
2ebe894793
Globally ignore compiled Python files.
The first time a `.py` file is run, or any time it's been modified, Python
creates a `.pyc` file containing a bytecode representation.

These bytecode files should always be ignored by Git, since keeping them
updated in a repo would be time consuming and would serve no purpose.
2016-01-11 08:09:48 -05:00
Caleb Thompson
fe31b3943b
Add golang configuration samples
Add suggested Go configuration for Vim into the `ftplugin` folder and
the vim-go plugin. We may use this as a template for adding further
language-specific settings in the future for languages that aren't
universally used by the team.

* `fatih/vim-go`: The de-facto Golang Vim plugin.
* `softtabstop=2`: As a side effect of setting how "large" a tab is in
  insert mode, Vim is able to delete tabs with the backspace key in
  Insert mode.
* `compiler go`: Necessary for plugins using the `make` command, such as
  vim-dispatch.
* `listchars=tab:\ \ `: Don't highlight tabs as "»·" as if they were
  problem characters in go files. Also recommended for *sh files and any
  others which which should also be using tabs.
* `go_fmt_command = "goimports"`: Tell vim-go to use the `goimports`
  command rather than `gofmt`, which attempts to find dependencies and
  adds them to your import statement.
2016-01-08 11:22:01 -06:00
Sean Griffin
aca2d1fb29 Better match the default behavior of ctrl-P when using ag
When using ctrl-p without ag, the pattern given is not treated as a regular expression. Additionally, the value passed when first opening ctrl-p is not actually a valid PCRE regex, and produces an error when used on Windows. This modifies the options to treat the pattern as a string literal, not a regular expression, resolving the Windows problem, and better matching the behavior of ctrl-p without Ag.
2015-12-19 11:13:24 -07:00
Geoff Harcourt
f02eab0354 Extract filetype-specific setups to ftplugin
Vim's documentation advises that buffer-specific configuration based on
a filetype should be performed via a file in `$HOME/.vim/ftplugin`:
http://vimdoc.sourceforge.net/htmldoc/usr_41.html#41.12

This change moves CSS/Sass-, Git commit message-, and Markdown-related
editor settings into `ftplugin/gitcommit.vim` and
`ftplugin/markdown.vim`, and rewrites those settings to avoid using
`autocmd`, letting Vim execute `setlocal` when a file of the filetype is
determined or set.
2015-12-18 16:18:32 -05:00
pedro-nonfree
2d9e8bf0e8 Update bin/replace script for better portability
The existing implementation of the `replace` script does not work on
GNU/Linux due to differences in the implementation of `sed`. This change
reworks the process of the replacement to create temporary files,
apply the changes to the files, and then move them into place. It will
improve the script's portability for more OSes.
2015-12-11 11:01:32 -05:00
Bernerd Schaefer
68b6446b9a Use one space, not two, after punctuation.
When using a join command (`gq`, `J`), vim defaults to adding two spaces
after '.', '?', and '!'.

Setting `nojoinspaces` causes vim to only insert a single space.
2015-12-08 15:01:28 -08:00
Geoff Harcourt
76aa931b77 Set <leader>ct shortcut to use Git ctags hook
In cbdcbce01d we introduced a Tim
Pope-inspired Git template scheme that automatically ran `ctags`
asynchronously through a hook after certain source control operations.
This hook is bypassed if a user uses `<leader>ct` to reindex their tags
from within Vim.

This change binds `<leader>ct` to use a Vimscript function that will
identify if the `ctags` hook exists in the local repository and executes
it. The function falls back to existing functionality if the hook does
not exist. We are moving the function out of `vimrc` as a first step
toward breaking our Vim configuration up by topic area.
2015-11-29 08:45:46 -05:00
Geoff Harcourt
8597a61f61 Run db:test:prepare task on migrate alias
We removed `db:test:prepare` from the `migrate` alias in #260 because
Rails 4.1 discouraged users from running the deprecated (at the time)
Rake task. Rails brought back `db:test:load` in rails/rails#17739 due to
user complaints about being unable to force a test database
synchronization.

Without dropping and recreating the test database from scratch, the
current migration strategy of solely using `db:migrate` and
`db:rollback` will never bring changes into test from a migration that
was run, rolled back, modified, and then re-run.

Running `db:test:load` or `db:test:prepare` on each migrate operation
has a small performance penalty, but the task is only being run when you
have a reason to want to check or force a synchronization of the
database. Knowing for sure that your test and development databases are
at the same point in their evolution is worthwhile.

Running `db:test:prepare` or `db:test:load` after running our existing
migrate alias added just under 1.0 seconds on average to the migrate
operation on an application with a reasonably sized DB schema.

diff --git a/aliases b/aliases index 6a0f602..102caca 100644 ---
a/aliases +++ b/aliases @@ -9,7 +9,7 @@ alias v="$VISUAL" alias
b="bundle"

 # Rails
-alias migrate="rake db:migrate db:rollback && rake db:migrate"
+alias migrate="rake db:migrate db:rollback && rake db:migrate db:test:prepare"
 alias s="rspec"

 # Pretty print the path
2015-11-29 08:38:30 -05:00
Robert Eshleman
bd3c5daf7f Remove Unused move_to_front_of_path Function
In #440, a `move_to_front_of_path` function was introduced, but
was [ultimately not used][1] when these changes were merged as f7c73f7.
The function itself was not removed, however.

This commit removes the unused function.

[1]: https://github.com/thoughtbot/dotfiles/pull/440#issuecomment-156549420
2015-11-16 15:26:41 -05:00
Geoff Harcourt
6cc0cb9302 Add tab-completion with local branches for git delete-branch
This solution was heavily influenced by @keith's original contribution
in #356, which I think may have worked on some but not all setups due to
personal configuration differences.

The solution in #356 added the `_git_delete_branch` function in the
`zsh/completions` folder, which resulted in the tab-completion working
against `git`, but not against our `g` function. With our new loading
order where functions are loaded first and completions are loaded last,
we can load the `_git_delete_branch` function before any completions are
defined on `git`, `g`, or `hub`, allowing the `_git_delete_branch` shim
to be used by all three of those git-invoking commands/functions.

Close #355.
2015-11-14 10:15:24 -05:00
Geoff Harcourt
b3a3c2e67d Don't export $PS1
The `$PS1` variable does not need to be exported in order for `zsh` to
use its contents to set prompt options. `export`ing it has the negative
side-effect of polluting prompts in shells launched from `zsh`. The
`export`ing of `$PS1` is the cause of #270, where using `sudo su` to
become another user (launching a non-`zsh` shell) resulted in a
corrupted prompt.

Removing the `export` will allow `sh`/`bash`/`dash` and other shells to
be launched from `zsh` without inheriting its prompt settings.

Fix #270.
2015-11-13 18:23:47 -05:00
Geoff Harcourt
f074afeae3 Use export -U to deduplicate $PATH
In f7c73f7c1b we started to deduplicate
`$PATH` using `typeset -U`, but that did not prevent duplicate `$PATH`
entries when processes were launched that inherited the environment from
an existing shell.

Using `export -U` keeps the `$PATH` deduplicated even when tmux launches
a new shell.

Fix #443.
2015-11-13 18:21:20 -05:00
David Alexander
f7c73f7c1b Deduplicate PATH before exporting
Why:

* Remove dupes from PATH

How:

$PATH is a scalar composed of contents of $path, so it uses typeset -U
("U" as in Unique) to ensure there are no dupes. It preserves the first
occurrence in the array, since it would be searched first before others
when matching a command in the directories in the PATH anyway.
2015-11-13 15:25:55 -05:00
Teo Ljungberg
d98d06a905 Add ctags support for attr_ definitions
This change adds `ctags` support for `attr_{reader,writer,accessor)` in
Ruby files.
2015-11-06 15:31:34 -05:00
Mike Burns
31b6ad4f3f Split zsh configuration into smaller files
This allows people to incorporate the thoughtbot dotfiles into their own
dotfiles in a more fine-grained manner.

I left some things in zshrc that we should eventually handle more
precisely:

- Load `.zsh/functions/*`. This could instead be replaced with: `mv
  .zsh/functions/* .zsh/configs`.
- Load `.aliases`. This could instead be replaced with: `mv .aliases
  .zsh/configs/aliases.zsh`.
- Load `.zshrc.local`. This file can realistically go away entirely,
  with people adding their own files to `.zsh/configs`.

A further refactoring, which I have done locally, is to introduce a
`~/.sh/configs` directory, in which people can put POSIX-specific
configuration that can be shared between GNU Bash, zsh, ksh, etc:
aliases, functions, paths, prompts, and so on. But one step at a time.

Other changes:
* Move aliases setup to occur after loading other config, as some of our
  aliases depend on environment variables having been set, so alias
  loading must come last after we've sourced `zsh/configs`.

* Move autocompletion for `g` function from the function definition to
  to `zsh/completions/_g`

* Move `PATH` setup to `zsh/configs/post` to ensure it happens after
  other configuration that might alter the `PATH`
2015-11-06 15:03:05 -05:00
Sean Doyle
4c68f6c819 Recognize JS Linter configuration files as JSON
Unfortunately, the convention for most JavaScript linters is to name
their configuration `.${TOOL}rc`.

In spite of this name, the configuration files are `JSON`. Forcing vim
to recognize them as JSON would enable syntax highlighting and linting
plugins (like syntastic) to recognize invalidly structured JSON.
2015-11-04 07:55:46 -05:00