Fix vint issues

This commit is contained in:
Kevin Cotugno 2020-02-24 19:09:16 -07:00
parent e3b2da9bc2
commit e1b238d639

View File

@ -1,6 +1,9 @@
scriptencoding utf-8
" vim-plug---START " vim-plug---START
call plug#begin('~/.config/nvim/plugged') call plug#begin('~/.config/nvim/plugged')
" Plugins " Plugins
Plug 'airblade/vim-gitgutter' Plug 'airblade/vim-gitgutter'
Plug 'cespare/vim-toml' Plug 'cespare/vim-toml'
@ -35,7 +38,7 @@ set cursorline
set colorcolumn=80,100 set colorcolumn=80,100
function ToggleBackground(current) function ToggleBackground(current)
if a:current == 'dark' if a:current ==# 'dark'
set background=light set background=light
hi Whitespace ctermfg=7 guifg=#eee8d5 hi Whitespace ctermfg=7 guifg=#eee8d5
else else
@ -44,7 +47,7 @@ function ToggleBackground(current)
end end
endfunction endfunction
call ToggleBackground("light") call ToggleBackground('light')
nmap <F5> :call ToggleBackground(&background)<CR> nmap <F5> :call ToggleBackground(&background)<CR>
set spell set spell
@ -57,8 +60,9 @@ set mouse=a
set list set list
set listchars=tab:――,space,trail set listchars=tab:――,space,trail
let g:NoClean = ["diff"] let g:NoClean = ['diff']
augroup filetypes
autocmd BufRead,BufNewFile autocmd BufRead,BufNewFile
\ *.cs, \ *.cs,
\*.java \*.java
@ -80,6 +84,10 @@ autocmd BufRead,BufNewFile
autocmd FileType crontab set backupcopy=yes autocmd FileType crontab set backupcopy=yes
augroup END
" vint: -ProhibitCommandRelyOnUser -ProhibitCommandWithUnintendedSideEffect
function TrimTrailingInvisibles() function TrimTrailingInvisibles()
let view = winsaveview() let view = winsaveview()
%s/\s\+$//e %s/\s\+$//e
@ -92,6 +100,8 @@ function TrimTrailingLines()
call winrestview(view) call winrestview(view)
endfunction endfunction
" vint: +ProhibitCommandRelyOnUser +ProhibitCommandWithUnintendedSideEffect
function OnWrite() function OnWrite()
if Writeable() if Writeable()
call CleanFile() call CleanFile()
@ -111,12 +121,12 @@ function CleanFile()
endfunction endfunction
function Writeable() function Writeable()
return &buftype == '' return empty(&buftype)
\ && index(g:NoClean, &filetype) == -1 \ && index(g:NoClean, &filetype) == -1
\ && !&readonly \ && !&readonly
\ && &modifiable \ && &modifiable
\ && &modified \ && &modified
\ && expand("%:t") != "" \ && !empty(expand('%:t'))
endfunction endfunction
augroup maximus augroup maximus
@ -140,15 +150,15 @@ function ModifiedSym()
if &modified if &modified
return "[\u270f]" return "[\u270f]"
else else
return "" return ''
end end
endfunction endfunction
function AddGitGutterToStatusline() function AddGitGutterToStatusline()
if &buftype == '' && exists("b:gitgutter_summary") if empty(&buftype) && exists('b:gitgutter_summary')
return join(["[Git:", join(b:gitgutter_summary, ","), "]"], "") return join(['[Git:', join(b:gitgutter_summary, ','), ']'], '')
else else
return "" return ''
endif endif
endfunction endfunction
@ -176,7 +186,7 @@ function Fullscreen()
for b in win_findbuf(buf) for b in win_findbuf(buf)
let tabwin = win_id2tabwin(b) let tabwin = win_id2tabwin(b)
if gettabwinvar(tabwin[0], tabwin[1], "fullscreen_buf") == buf if gettabwinvar(tabwin[0], tabwin[1], 'fullscreen_buf') == buf
let found = 1 let found = 1
let existing_tab = tabwin[0] let existing_tab = tabwin[0]
let existing_win = tabwin[1] let existing_win = tabwin[1]
@ -186,10 +196,10 @@ function Fullscreen()
if existing_tab == tabpagenr() if existing_tab == tabpagenr()
tabclose tabclose
else else
exec "tabnext".existing_tab exec 'tabnext'.existing_tab
endif endif
else else
exec "tabnew +buffer".buf exec 'tabnew +buffer'.buf
let w:fullscreen_buf = buf let w:fullscreen_buf = buf
end end
@ -215,7 +225,7 @@ let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_ignore_case = 1 let g:deoplete#enable_ignore_case = 1
" syntastic " syntastic
let g:syntastic_vim_checkers = ["vint"] let g:syntastic_vim_checkers = ['vint']
let g:syntastic_always_populate_loc_list = 1 let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1 let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1 let g:syntastic_check_on_open = 1