From e1b238d6391ddc457cdcefb191fd92c27479c243 Mon Sep 17 00:00:00 2001 From: Kevin Cotugno Date: Mon, 24 Feb 2020 19:09:16 -0700 Subject: [PATCH] Fix vint issues --- .config/nvim/init.vim | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 6fa3852..a7ac2b0 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -1,6 +1,9 @@ +scriptencoding utf-8 + " vim-plug---START call plug#begin('~/.config/nvim/plugged') + " Plugins Plug 'airblade/vim-gitgutter' Plug 'cespare/vim-toml' @@ -35,7 +38,7 @@ set cursorline set colorcolumn=80,100 function ToggleBackground(current) - if a:current == 'dark' + if a:current ==# 'dark' set background=light hi Whitespace ctermfg=7 guifg=#eee8d5 else @@ -44,7 +47,7 @@ function ToggleBackground(current) end endfunction -call ToggleBackground("light") +call ToggleBackground('light') nmap :call ToggleBackground(&background) set spell @@ -57,8 +60,9 @@ set mouse=a set list set listchars=tab:――,space:·,trail:· -let g:NoClean = ["diff"] +let g:NoClean = ['diff'] +augroup filetypes autocmd BufRead,BufNewFile \ *.cs, \*.java @@ -80,6 +84,10 @@ autocmd BufRead,BufNewFile autocmd FileType crontab set backupcopy=yes +augroup END + +" vint: -ProhibitCommandRelyOnUser -ProhibitCommandWithUnintendedSideEffect + function TrimTrailingInvisibles() let view = winsaveview() %s/\s\+$//e @@ -92,6 +100,8 @@ function TrimTrailingLines() call winrestview(view) endfunction +" vint: +ProhibitCommandRelyOnUser +ProhibitCommandWithUnintendedSideEffect + function OnWrite() if Writeable() call CleanFile() @@ -111,12 +121,12 @@ function CleanFile() endfunction function Writeable() - return &buftype == '' + return empty(&buftype) \ && index(g:NoClean, &filetype) == -1 \ && !&readonly \ && &modifiable \ && &modified - \ && expand("%:t") != "" + \ && !empty(expand('%:t')) endfunction augroup maximus @@ -140,15 +150,15 @@ function ModifiedSym() if &modified return "[\u270f]" else - return "" + return '' end endfunction function AddGitGutterToStatusline() - if &buftype == '' && exists("b:gitgutter_summary") - return join(["[Git:", join(b:gitgutter_summary, ","), "]"], "") + if empty(&buftype) && exists('b:gitgutter_summary') + return join(['[Git:', join(b:gitgutter_summary, ','), ']'], '') else - return "" + return '' endif endfunction @@ -176,7 +186,7 @@ function Fullscreen() for b in win_findbuf(buf) 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 existing_tab = tabwin[0] let existing_win = tabwin[1] @@ -186,10 +196,10 @@ function Fullscreen() if existing_tab == tabpagenr() tabclose else - exec "tabnext".existing_tab + exec 'tabnext'.existing_tab endif else - exec "tabnew +buffer".buf + exec 'tabnew +buffer'.buf let w:fullscreen_buf = buf end @@ -215,7 +225,7 @@ let g:deoplete#enable_at_startup = 1 let g:deoplete#enable_ignore_case = 1 " syntastic -let g:syntastic_vim_checkers = ["vint"] +let g:syntastic_vim_checkers = ['vint'] let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 1 let g:syntastic_check_on_open = 1