vim-vint linting pass

This commit is contained in:
Vasili Svirydau
2017-12-19 13:42:58 -08:00
parent dd4e4a412c
commit c0abd37f29
5 changed files with 37 additions and 31 deletions

View File

@@ -1,15 +1,18 @@
let plug_path=expand(vim_files . '/autoload/plug.vim') set encoding=utf-8
let have_plug=filereadable(plug_path) scriptencoding utf-8
if(!have_plug && executable('curl'))
echo "Installing Plug"
execute '!curl -fLo "' . plug_path . '" --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' let g:plug_path=expand(g:vim_files . '/autoload/plug.vim')
execute 'source ' . plug_path let g:have_plug=filereadable(g:plug_path)
let have_plug = 1 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 endif
if(have_plug) if(g:have_plug)
call plug#begin(vim_files . '/plugged') call plug#begin(g:vim_files . '/plugged')
Plug 'tpope/vim-sensible' " Sensible defaults for vim Plug 'tpope/vim-sensible' " Sensible defaults for vim
@@ -47,8 +50,9 @@ if(have_plug)
" Quality of life " Quality of life
Plug 'edkolev/tmuxline.vim' Plug 'edkolev/tmuxline.vim'
Plug 'jez/vim-superman' " Man page viewer
if version >= 800 if v:version >= 800
Plug 'w0rp/ale' " Asynchronous Linting Plug 'w0rp/ale' " Asynchronous Linting
Plug 'sbdchd/neoformat' " Automatic code formatting Plug 'sbdchd/neoformat' " Automatic code formatting
@@ -64,7 +68,7 @@ if(have_plug)
call plug#end() call plug#end()
if empty(glob(vim_files . '/plugged')) if empty(glob(g:vim_files . '/plugged'))
PlugInstall PlugInstall
endif endif
endif endif

View File

@@ -1,7 +1,9 @@
set encoding=utf-8
scriptencoding utf-8
set shortmess=I " turn off splash screen set shortmess=I " turn off splash screen
set hidden " enable multiple dirty buffers set hidden " enable multiple dirty buffers
set modelines=0 set modelines=0
set nocompatible
set number " show line numbers set number " show line numbers
set visualbell set visualbell
set wildmode=full set wildmode=full
@@ -78,7 +80,7 @@ call EnsureExists(&directory)
let g:ctrlp_user_command = 'ag %s -l --nocolor -f -g ""' let g:ctrlp_user_command = 'ag %s -l --nocolor -f -g ""'
let g:ctrlp_use_caching = 0 let g:ctrlp_use_caching = 0
else else
if executable("rg") if executable('rg')
set grepprg=rg\ --color=never set grepprg=rg\ --color=never
let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""' let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""'
@@ -89,19 +91,19 @@ call EnsureExists(&directory)
endif endif
endif endif
if has("gui_running") if has('gui_running')
set go-=mTr " disable toolbar, menubar and scrollbar set guioptions-=mTr " disable toolbar, menubar and scrollbar
if has("win32") if has('win32')
set guifont=Source_Code_Pro:h12:cANSI set guifont=Source_Code_Pro:h12:cANSI
endif endif
if has("osx") if has('osx')
set guifont=Source_Code_Pro:h13 set guifont=Source_Code_Pro:h13
endif endif
else else
if(has("mouse")) if(has('mouse'))
set mouse=a set mouse=a
endif endif
if $TERM_PROGRAM == 'iTerm.app' if $TERM_PROGRAM ==? 'iTerm.app'
" different cursors for insert vs normal mode " different cursors for insert vs normal mode
if exists('$TMUX') if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
@@ -113,7 +115,7 @@ call EnsureExists(&directory)
endif endif
" Windows-specific setting allowing for 256-colors etc " Windows-specific setting allowing for 256-colors etc
if($ConEmuANSI == 'ON') if($ConEmuANSI ==? 'ON')
set term=xterm set term=xterm
set t_Co=256 set t_Co=256
let &t_AB='\e[48;5;%dm' " background color let &t_AB='\e[48;5;%dm' " background color

View File

@@ -14,7 +14,7 @@ nnoremap <silent> <Esc><Esc> <Esc>:nohlsearch<CR><Esc>
noremap <leader>l :set list!<cr> noremap <leader>l :set list!<cr>
" noremap <silent> <leader>R :! echo reload \| nc -w 1 localhost 32000<cr><cr> " noremap <silent> <leader>R :! echo reload \| nc -w 1 localhost 32000<cr><cr>
noremap <silent><leader>R :! tmux send-keys -t right "up" C-m<cr><cr> noremap <silent><leader>R :! tmux send-keys -t top-right "up" C-m<cr><cr>
"press space in normal mode to center screen "press space in normal mode to center screen
noremap <space> zz noremap <space> zz

View File

@@ -1,4 +1,4 @@
if has("autocmd") if has('autocmd')
filetype plugin indent on filetype plugin indent on
augroup InvisibleCharsHighlight augroup InvisibleCharsHighlight
@@ -17,9 +17,9 @@
au! au!
autocmd BufWritePre * :call <SID>StripTrailingWhitespace() autocmd BufWritePre * :call <SID>StripTrailingWhitespace()
function! <SID>StripTrailingWhitespace() function! <SID>StripTrailingWhitespace()
let pos = getpos('.') let l:pos = getpos('.')
%s/\s\+$//e %s/\s\+$//e
call setpos('.', pos) call setpos('.', l:pos)
endfun endfun
augroup END augroup END

14
vimrc
View File

@@ -1,16 +1,16 @@
scriptencoding utf-8
set encoding=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) function! SourceConfig(name)
" exec "echo 'Loading " . a: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 endfunction
call SourceConfig("01-plugins.vim") call SourceConfig('01-plugins.vim')
call SourceConfig("02-general.vim") call SourceConfig('02-general.vim')
call SourceConfig("03-mappings.vim") call SourceConfig('03-mappings.vim')
call SourceConfig("04-autocmds.vim") call SourceConfig('04-autocmds.vim')
unlet g:vim_files unlet g:vim_files