From c0abd37f292514a52b623fdd9452018404a337df Mon Sep 17 00:00:00 2001 From: Vasili Svirydau Date: Tue, 19 Dec 2017 13:42:58 -0800 Subject: [PATCH] vim-vint linting pass --- config/01-plugins.vim | 26 +++++++++++++++----------- config/02-general.vim | 20 +++++++++++--------- config/03-mappings.vim | 2 +- config/04-autocmds.vim | 6 +++--- vimrc | 14 +++++++------- 5 files changed, 37 insertions(+), 31 deletions(-) diff --git a/config/01-plugins.vim b/config/01-plugins.vim index 5e22347..a5bc4b7 100644 --- a/config/01-plugins.vim +++ b/config/01-plugins.vim @@ -1,15 +1,18 @@ -let plug_path=expand(vim_files . '/autoload/plug.vim') -let have_plug=filereadable(plug_path) -if(!have_plug && executable('curl')) - echo "Installing Plug" +set encoding=utf-8 +scriptencoding utf-8 - execute '!curl -fLo "' . plug_path . '" --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' - execute 'source ' . plug_path - let have_plug = 1 +let g:plug_path=expand(g:vim_files . '/autoload/plug.vim') +let g:have_plug=filereadable(g:plug_path) +if(!g:have_plug && executable('curl')) + echo 'Installing Plug' + + execute '!curl -fLo "' . g:plug_path . '" --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' + execute 'source ' . g:plug_path + let g:have_plug = 1 endif -if(have_plug) - call plug#begin(vim_files . '/plugged') +if(g:have_plug) + call plug#begin(g:vim_files . '/plugged') Plug 'tpope/vim-sensible' " Sensible defaults for vim @@ -47,8 +50,9 @@ if(have_plug) " Quality of life Plug 'edkolev/tmuxline.vim' + Plug 'jez/vim-superman' " Man page viewer - if version >= 800 + if v:version >= 800 Plug 'w0rp/ale' " Asynchronous Linting Plug 'sbdchd/neoformat' " Automatic code formatting @@ -64,7 +68,7 @@ if(have_plug) call plug#end() - if empty(glob(vim_files . '/plugged')) + if empty(glob(g:vim_files . '/plugged')) PlugInstall endif endif diff --git a/config/02-general.vim b/config/02-general.vim index 8288bf1..d13b24a 100644 --- a/config/02-general.vim +++ b/config/02-general.vim @@ -1,7 +1,9 @@ +set encoding=utf-8 +scriptencoding utf-8 + set shortmess=I " turn off splash screen set hidden " enable multiple dirty buffers set modelines=0 -set nocompatible set number " show line numbers set visualbell set wildmode=full @@ -78,7 +80,7 @@ call EnsureExists(&directory) let g:ctrlp_user_command = 'ag %s -l --nocolor -f -g ""' let g:ctrlp_use_caching = 0 else - if executable("rg") + if executable('rg') set grepprg=rg\ --color=never let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""' @@ -89,19 +91,19 @@ call EnsureExists(&directory) endif endif - if has("gui_running") - set go-=mTr " disable toolbar, menubar and scrollbar - if has("win32") + if has('gui_running') + set guioptions-=mTr " disable toolbar, menubar and scrollbar + if has('win32') set guifont=Source_Code_Pro:h12:cANSI endif - if has("osx") + if has('osx') set guifont=Source_Code_Pro:h13 endif else - if(has("mouse")) + if(has('mouse')) set mouse=a endif - if $TERM_PROGRAM == 'iTerm.app' + if $TERM_PROGRAM ==? 'iTerm.app' " different cursors for insert vs normal mode if exists('$TMUX') let &t_SI = "\Ptmux;\\]50;CursorShape=1\x7\\\" @@ -113,7 +115,7 @@ call EnsureExists(&directory) endif " Windows-specific setting allowing for 256-colors etc - if($ConEmuANSI == 'ON') + if($ConEmuANSI ==? 'ON') set term=xterm set t_Co=256 let &t_AB='\e[48;5;%dm' " background color diff --git a/config/03-mappings.vim b/config/03-mappings.vim index 01f466b..177a4d8 100644 --- a/config/03-mappings.vim +++ b/config/03-mappings.vim @@ -14,7 +14,7 @@ nnoremap :nohlsearch noremap l :set list! " noremap R :! echo reload \| nc -w 1 localhost 32000 -noremap R :! tmux send-keys -t right "up" C-m +noremap R :! tmux send-keys -t top-right "up" C-m "press space in normal mode to center screen noremap zz diff --git a/config/04-autocmds.vim b/config/04-autocmds.vim index 53194e2..556fb6e 100644 --- a/config/04-autocmds.vim +++ b/config/04-autocmds.vim @@ -1,4 +1,4 @@ - if has("autocmd") + if has('autocmd') filetype plugin indent on augroup InvisibleCharsHighlight @@ -17,9 +17,9 @@ au! autocmd BufWritePre * :call StripTrailingWhitespace() function! StripTrailingWhitespace() - let pos = getpos('.') + let l:pos = getpos('.') %s/\s\+$//e - call setpos('.', pos) + call setpos('.', l:pos) endfun augroup END diff --git a/vimrc b/vimrc index b7c5b2c..c070bc3 100644 --- a/vimrc +++ b/vimrc @@ -1,16 +1,16 @@ -scriptencoding utf-8 set encoding=utf-8 +scriptencoding utf-8 -let g:vim_files=fnamemodify(resolve(expand("$MYVIMRC")), ":p:h") +let g:vim_files=fnamemodify(resolve(expand('$MYVIMRC')), ':p:h') function! SourceConfig(name) " exec "echo 'Loading " . a:name . "'" - exec "source " . expand(g:vim_files . '/config/' . a:name) + exec 'source ' . expand(g:vim_files . '/config/' . a:name) endfunction -call SourceConfig("01-plugins.vim") -call SourceConfig("02-general.vim") -call SourceConfig("03-mappings.vim") -call SourceConfig("04-autocmds.vim") +call SourceConfig('01-plugins.vim') +call SourceConfig('02-general.vim') +call SourceConfig('03-mappings.vim') +call SourceConfig('04-autocmds.vim') unlet g:vim_files