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.
This commit is contained in:
parent
8ac75ba56b
commit
7593dafebb
2 changed files with 16 additions and 7 deletions
18
vimrc
18
vimrc
|
@ -12,6 +12,8 @@ set incsearch " do incremental searching
|
|||
set laststatus=2 " Always display the status line
|
||||
set autowrite " Automatically :write before running commands
|
||||
|
||||
let g:has_async = v:version >= 800 || has('nvim')
|
||||
|
||||
" Switch syntax highlighting on, when the terminal has colors
|
||||
" Also switch on highlighting the last used search pattern.
|
||||
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
|
||||
|
@ -46,12 +48,16 @@ augroup vimrcEx
|
|||
autocmd BufRead,BufNewFile .{jscs,jshint,eslint}rc set filetype=json
|
||||
|
||||
" ALE linting events
|
||||
set updatetime=1000
|
||||
let g:ale_lint_on_text_changed = 0
|
||||
autocmd CursorHold * call ale#Lint()
|
||||
autocmd CursorHoldI * call ale#Lint()
|
||||
autocmd InsertEnter * call ale#Lint()
|
||||
autocmd InsertLeave * call ale#Lint()
|
||||
if g:has_async
|
||||
set updatetime=1000
|
||||
let g:ale_lint_on_text_changed = 0
|
||||
autocmd CursorHold * call ale#Lint()
|
||||
autocmd CursorHoldI * call ale#Lint()
|
||||
autocmd InsertEnter * call ale#Lint()
|
||||
autocmd InsertLeave * call ale#Lint()
|
||||
else
|
||||
echoerr "The thoughtbot dotfiles require NeoVim or Vim 8"
|
||||
endif
|
||||
augroup END
|
||||
|
||||
" When the type of shell script is /bin/sh, assume a POSIX-compatible
|
||||
|
|
|
@ -56,7 +56,10 @@ Plug 'tpope/vim-rhubarb'
|
|||
Plug 'tpope/vim-surround'
|
||||
Plug 'vim-ruby/vim-ruby'
|
||||
Plug 'vim-scripts/tComment'
|
||||
Plug 'w0rp/ale'
|
||||
|
||||
if g:has_async
|
||||
Plug 'w0rp/ale'
|
||||
endif
|
||||
|
||||
if filereadable(expand("~/.vimrc.bundles.local"))
|
||||
source ~/.vimrc.bundles.local
|
||||
|
|
Loading…
Add table
Reference in a new issue