aboutsummaryrefslogtreecommitdiff
path: root/vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-10-30 18:36:18 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-10-30 18:36:18 +1300
commit1eef391006a3c70b7361b6480c8922d1a29c7a7d (patch)
tree37fd358093c2656b3af7f076c16723ed3c618c1a /vim
parentMove non-indent HTML Vim config indent->ftplugin (diff)
parentAdd a `lint-vim` target for linting Vim config (diff)
downloaddotfiles-1eef391006a3c70b7361b6480c8922d1a29c7a7d.tar.gz
dotfiles-1eef391006a3c70b7361b6480c8922d1a29c7a7d.zip
Merge branch 'vim/vint'
The Vim configuration, excluding the submodule plugin bundles, now passes a strict run of the vim-vint tool. There's also now a `lint-vim` target in the Makefile.
Diffstat (limited to 'vim')
-rw-r--r--vim/config/format.vim2
-rw-r--r--vim/config/linebreak.vim6
-rw-r--r--vim/config/syntax.vim2
-rw-r--r--vim/config/whitespace.vim9
-rw-r--r--vim/ftplugin/html.vim8
-rw-r--r--vim/gvimrc2
-rw-r--r--vim/vimrc9
7 files changed, 17 insertions, 21 deletions
diff --git a/vim/config/format.vim b/vim/config/format.vim
index cbc995af..fadbd8f7 100644
--- a/vim/config/format.vim
+++ b/vim/config/format.vim
@@ -1,6 +1,6 @@
" If we can, add j to the format options to get rid of comment leaders when
" joining lines
-if v:version > 703 || v:version == 703 && has('patch541')
+if v:version > 703 || v:version ==# 703 && has('patch541')
set formatoptions+=j
endif
diff --git a/vim/config/linebreak.vim b/vim/config/linebreak.vim
index 887d5f39..5abdabd1 100644
--- a/vim/config/linebreak.vim
+++ b/vim/config/linebreak.vim
@@ -4,7 +4,7 @@
if has('linebreak')
set linebreak
set showbreak=...
- if v:version > 704 || v:version == 704 && has('patch338')
+ if v:version > 704 || v:version ==# 704 && has('patch338')
set breakindent
endif
@@ -15,13 +15,13 @@ if has('linebreak')
if &linebreak
set nolinebreak
set showbreak=
- if v:version > 704 || v:version == 704 && has('patch338')
+ if v:version > 704 || v:version ==# 704 && has('patch338')
set nobreakindent
endif
else
set linebreak
set showbreak=...
- if v:version > 704 || v:version == 704 && has('patch338')
+ if v:version > 704 || v:version ==# 704 && has('patch338')
set breakindent
endif
endif
diff --git a/vim/config/syntax.vim b/vim/config/syntax.vim
index df75b3f0..08b908c8 100644
--- a/vim/config/syntax.vim
+++ b/vim/config/syntax.vim
@@ -19,7 +19,7 @@ if has('syntax')
let l:bg = len(l:colorfgbg) ? l:colorfgbg[-1] : ''
" Choose the background setting based on this value
- if l:bg == 'default' || l:bg == '7' || l:bg == '15'
+ if l:bg ==# 'default' || l:bg ==# '7' || l:bg ==# '15'
set background=light
else
set background=dark
diff --git a/vim/config/whitespace.vim b/vim/config/whitespace.vim
index 2202f47b..119d2c48 100644
--- a/vim/config/whitespace.vim
+++ b/vim/config/whitespace.vim
@@ -5,10 +5,11 @@ set nojoinspaces
" Strip trailing whitespace with \x
if has('eval')
function! StripTrailingWhitespace()
- let l:search = @/
- %substitute/\s\+$//e
- let @/ = l:search
- nohlsearch
+ let l:li = 1
+ for l:line in getline(1,'$')
+ call setline(l:li, substitute(l:line, '\m\C\s\+$', '', 'g'))
+ let l:li = l:li + 1
+ endfor
endfunction
nnoremap <silent> <leader>x :<C-U>call StripTrailingWhitespace()<CR>
endif
diff --git a/vim/ftplugin/html.vim b/vim/ftplugin/html.vim
index 38b71656..ca762422 100644
--- a/vim/ftplugin/html.vim
+++ b/vim/ftplugin/html.vim
@@ -3,9 +3,9 @@ nnoremap <leader>v :exe "!tidy -eq -utf8 " . shellescape(expand("%"))<CR>
" Make a bare URL into a link to itself
function! UrlLink()
- normal yiW
- execute "normal i<a href=\"\<C-R>0\">\<Esc>"
- normal E
- execute "normal a</a>\<Esc>"
+ normal! yiW
+ execute "normal! i<a href=\"\<C-R>0\">\<Esc>"
+ normal! E
+ execute "normal! a</a>\<Esc>"
endfunction
nnoremap <silent> <leader>r :<C-U>call UrlLink()<CR>
diff --git a/vim/gvimrc b/vim/gvimrc
index 2db471da..286b84ba 100644
--- a/vim/gvimrc
+++ b/vim/gvimrc
@@ -1,7 +1,7 @@
" My choice of font changes depending on which operating system I'm using;
" these are both workable monospace fonts, but Ubuntu Mono doesn't render very
" nicely on Windows a lot of the time
-if has("unix")
+if has('unix')
silent! set guifont=Ubuntu\ Mono\ 12
else
silent! set guifont=Consolas:h11
diff --git a/vim/vimrc b/vim/vimrc
index 043dea8b..e0020b5e 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -1,8 +1,3 @@
-" Don't make any effort to be compatible with vi, use more sensible settings.
-" This is only here in case this file gets loaded explicitly with -u; the mere
-" existence of a ~/.vimrc file already turns this off.
-set nocompatible
-
" Use UTF-8 by default wherever possible, including in this file
if has('multi_byte')
set encoding=utf-8
@@ -26,8 +21,8 @@ if v:version >= 701
" The 'sahara' colorscheme only works for dark backgrounds with 256 colors
if has('syntax')
- \ && &background == 'dark'
- \ && (has('gui_running') || &t_Co == 256)
+ \ && &background ==# 'dark'
+ \ && (has('gui_running') || &t_Co ==# 256)
silent! colorscheme sahara
endif
endif