Commit graph

85 commits

Author SHA1 Message Date
RJ Dellecese
b7df0406cd Set syntax highlighting for all zsh startup files 2021-07-03 15:20:27 -04:00
Carles Jove i Buxeda
0d9416f19c Set tags for vim-fugitive 2019-10-11 09:38:29 -04:00
Stephanie Viccari
3001fd3d65 Replace CtrlP with FZF
Summary:
Using CtrlP has proven to be slower and has fewer features. We've been
switching over to FZF on a frequent enough basis that it feels
appropriate to make FZF the new default for fuzzy searching.

By swapping out Ctrlp in favor of FZF, this should not break anyone's
fuzzy search but it will replace the tool that executes the search.

Co-authored-by: Chris Toomey <chris@ctoomey.com>
2019-08-21 14:37:31 -04:00
Alan Yee
cdc55ef186 Disable modeline magic
The modelines option has a history of security issues, particularly with
arbitrary code execution. Best to disable modelines explicitly as a
securiy precaution. More details here:
https://security.stackexchange.com/questions/36001/vim-modeline-vulnerabilities
2019-08-20 14:28:05 -04:00
RJ Dellecese
42c8204e6c Allow easy disabling of all ALE configs
Set `updatetime` option and `g:ale_lint_on_text_changed` variable in an Vim startup autocommand so that they won't be set when the user disables the `ale` augroup (with something like `silent! augroup! ale` or `augroup \ autocmd! \ augroup END`) in their local vimrc.

This allows users to use ALE with its default linting settings without needing to manually `unlet` the `updatetime` option and `g:ale_lint_on_text_changed` variable also.
2019-01-21 20:22:25 -05:00
Carles Jove i Buxeda
a4da3e4523 Add UTF-8 encoding
I started getting errors after a recent Vim upgrade because of line:

`set list listchars=tab:»·,trail:·,nbsp:·`

Adding UTF-8 encoding fixes it.

```text
:h encoding

NOTE: For GTK+ 2 or later, it is highly recommended to set 'encoding'
        to "utf-8".  Although care has been taken to allow different values of
        'encoding', "utf-8" is the natural choice for the environment and
        avoids unnecessary conversion overhead.  "utf-8" has not been made
        the default to prevent different behavior of the GUI and terminal
        versions, and to avoid changing the encoding of newly created files
        without your knowledge (in case 'fileencodings' is empty).
```
2019-01-21 20:17:32 -05:00
Jared Smith
80972c9b6e Replace ale#lint with ale#queue - ale#lint no longer supported (#615) 2018-10-31 10:56:28 -04:00
Ashwin Vidiyala
695d92f50e Isolate ALE settings into its own augroup 2018-10-01 21:27:00 -04:00
Stephen Hanson
319f1284f9 Set vim syntax for local dotfiles overrides 2018-10-01 20:17:46 -05:00
Derek Prior
21055dff63
Appraisal file is supported by vim-ruby
See: 04fabcc1d5/ftdetect/ruby_extra.vim (L12)
2018-02-25 21:57:42 -05:00
Geoff Harcourt
a7e107038a vimrc: Use consistent style for key mapping
This change updates portions of our vimrc that used inconsistent
capitalization for commands to have a more consistent style.
2018-01-05 14:09:05 -05:00
Karun Siritheerathamrong
cad8f464e3 Use -g instead of --filename-pattern as Ag argument
This change undoes one of the two changes made in #564 so resolve an
issue for non macOS environments with Ag and ctrlp.
2017-12-18 22:39:38 -05:00
Andy Waite
113ddba054 Use long options for when calling ag for CtrlP plugin 2017-11-05 20:39:53 -05:00
Derek Prior
e0ff6ef15f
Move definition of has_async
We have an rcm `post-up` hook that installs plugins after running
`rcup`. It does this by directly loading the `.vimrc.bundles` file,
which means our regular `.vimrc` file is not sourced. This lead to
`has_async` being undefined.

By moving the definition into the `vimrc.bundles` we ensure it's
available when that `post-up` hook runs. It remains available when
needed in `vimrc` because we use it there *after* sourcing the bundles.
2017-08-10 09:35:50 -04:00
Derek Prior
7593dafebb
Require Vim 8 or NeoVim
Now that we're using `ALE`, we're making use of the async features
available in Vim8 and NeoVim. If you try to use these dotfiles on Vim 7,
you'll get a host of errors from ALE.

This change does two things:

1. It writes an error when starting in an unsupported vim version.
2. It skips loading ALE in those versions.

The thinking behind the second change is to leave vim in a more usable
state with minimal annoyance after the initial error.
2017-08-10 00:27:18 -04:00
Derek Prior
8ac75ba56b
Replace Syntastic with ALE
ALE is an Asynchronous Linting Engine which works with Vim 8 and NeoVim
to lint your code "as you type". It does so without blocking the main
thread by using the asynchronous features of both of those Vim versions.

A number of us in Boston have been using ALE for some time now with
great success. The asynchronous nature means linting does not block
other interactions with Vim and it's been nice to get linting feedback
more often than buffer write.

Many of us find the "as-you-type" linting to be performant enough to
actually be a distraction, so this PR tones that down some. With this
configuration, ALE will lint on cursor hold durations of 1 second and
when leaving insert mode in addition to buffer write, buffer read, and
file type change.
2017-08-06 10:33:48 -04:00
Riley Dallas
af75a673b1 Capitalize l in leaders 2017-06-19 12:53:17 -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
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
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
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
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
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
Derek Prior
6a034a7d65
Ignore "useless use of variable in void context"
The following ERB generates a "Possibly useless use of variable in void
context" warning from Syntastic:

```erb
<%= comment %>
```

The warning can be eliminated by making it:

```erb
<%= comment.to_s %>
```

However, this behavior is the default and is redundant. There are other
cases where this warning pops up and in each case I've found it to be of
no use.
2015-06-15 10:43:10 -04:00
Daniel Nolan
b0ab8136b6 Source matchit.vim from vim/macros directory
* After removing the matchit.vim plugin from the vimrc.bundles file in
  this pull request https://github.com/thoughtbot/dotfiles/pull/379. It
  was brought to my attention that plugins in the macros directory are
  not automatically loaded due to backwards compatibility issues.
* Add entry to vimrc to source the matchit.vim plugin from the macros
  directory, if the user does not have it installed already. This is how
  Tim Pope adds the matchit.vim plugin to vimrc in his vim-sensible plugin.
  https://github.com/tpope/vim-sensible/blob/master/plugin/sensible.vim#L88
2015-05-22 11:21:22 -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
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
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
1eff8c03ec
Spell check git commits 2014-11-03 15:45:55 -05: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
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
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
Dan Croak
8a5ba82f4e Set Vim's spellfile to $HOME
Running `zg` adds words to the `spellfile`:

4f5a2edc33
http://robots.thoughtbot.com/vim-spell-checking

Setting the spellfile keeps it out of its default location, `vim/spell`, which
would otherwise be inside thoughtbot/dotfiles. We don't necessarily want to
share the `spellfile` across the team.
2014-07-24 07:48:27 -07:00
Robert Speicher
8aecd1f2ef Allow stylesheets to autocomplete hyphenated words 2014-07-20 19:43:25 -04:00
Joe Ferris
d8003e654e Set Vim's colorcolumn to 80 characters
* We have an 80 character formatting limit
* This makes it obvious where that limit is
2014-06-20 16:55:28 -07:00
Greg Lazarev
49efda0d37 Add Shift+Tab map for tab complete in insert mode
Feature parity with `<c-p>` `<c-n>` tab completion duo.
2014-06-20 10:38:18 -07:00
Derek Prior
d8465b8c79 Have Syntastic ignore angular attribute warnings
The Syntastic HTML linter will warn on propriety attributes. The
likelihood that you *accidentally* typed "ng-repeat" is low. Let's just
assume you know what you're doing and ignore warnings about "ng-*"
attributes.
2014-05-15 11:40:18 -04:00
Dan Croak
5f02a1d93d Run commands interactively from vim
This allows us to do things like:

    <Leader>r migrate
2014-04-25 14:49:37 -07:00
Derek Prior
0d749cad83 Enable shiftround
With `shiftround` enabled, using `>>` will indent the line to the next
multiple of `shiftwidth`. This is useful when you are indenting
improperly indented code.
2014-04-25 14:45:54 -07:00
Joe Ferris
c0284de226 Use default 'complete' Vim setting
Default setting is `.,w,b,u,t,i`:

* `.`: scan the current buffer ('wrapscan' is ignored)
* `w`: scan buffers from other windows
* `b`: scan other loaded buffers that are in the buffer list
* `u`: scan the unloaded buffers that are in the buffer list
* `t`: tag completion
* `i`: scan current and included files

The default setting is more likely to find a useful match, and modern
machines can search many open and unloaded buffers without pausing.
2014-04-03 11:52:04 -04:00
Greg Lazarev
69b0edc174 Remove leftover snippets variable 2014-03-28 07:27:40 -07:00
Joe Ferris
fefd1d4509 Only set nocompatible once as early as possible
* Setting nocompatible has side effects
* Setting it again (even if set) repeats side effects
* Settings like ruler will be reset if set again
2014-03-19 15:05:30 -04:00
Dan Croak
4f5a2edc33 Spell-check Markdown by type, not file extension
Previously, only `*.md` files would get spell-checking. This change adds
`*.markdown` and decouples Markdown spell-checking by file extension.

http://robots.thoughtbot.com/vim-spell-checking/
2013-11-22 16:01:48 -08:00
Joe Ferris
81a33f78d8 Set 'autowrite'
* Automatically :write before commands such as `:next` or `:!`
* Saves keystrokes by eliminating writes before running tests, etc
* See `:help 'autowrite'` for more information
2013-09-12 15:56:12 -04:00
Dan Croak
338cc0fb92 Allow backspacing over everything in insert mode
The previous setting frequently slowed my ability to edit.
2013-09-11 14:09:52 -07:00
Joël Quenneville
a4dff5ea80 Don't cache CtrlP results when using ag
It gets very annoying to manually force CtrlP to re-index every time I
add a new file. Since ag is so fast, we can turn off caching when it
powers CtrlP without any noticeable impact on search speed.
2013-08-23 17:28:03 -04:00