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>
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.
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).
```
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
* 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
* 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
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`.
`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.
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.
Running `zg` adds words to the `spellfile`:
4f5a2edc33http://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.
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.
With `shiftround` enabled, using `>>` will indent the line to the next
multiple of `shiftwidth`. This is useful when you are indenting
improperly indented code.
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.
* Automatically :write before commands such as `:next` or `:!`
* Saves keystrokes by eliminating writes before running tests, etc
* See `:help 'autowrite'` for more information
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.
Newer versions of vim (such as 7.3.923) syntax highlight Rackup and JSON
files correctly. In the interest of keeping the dotfiles slim and our
machines up-to-date, I think the solution is to remove these from
dotfiles and install a newer version of vim in thoughtbot/laptop:
https://github.com/thoughtbot/laptop/pull/118