From c16f793fb85ea003ace1223e40057afe9930cda6 Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Thu, 24 Oct 2019 13:58:45 -0700 Subject: [PATCH] Pass lint --- vim/init.vim | 14 ++++++-------- vim/rc/plugins/goyo-limelight.rc.vim | 12 +++++++++--- vim/rc/plugins/omnicompletion.rc.vim | 14 ++++++++------ vim/rc/ui.rc.vim | 17 ++++++++++------- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/vim/init.vim b/vim/init.vim index 3a63f74..ad03b73 100644 --- a/vim/init.vim +++ b/vim/init.vim @@ -8,10 +8,6 @@ if &shell =~# 'fish$' set shell=bash endif -if &compatible - set nocompatible -endif - function! s:smart_source_rc(name) call s:source_rc(a:name . '.rc.vim') call s:source_rc(a:name . '.local.rc.vim') @@ -46,9 +42,9 @@ endfunction " IsGuiApp determines if (n)vim is running in a GUI function! IsGuiApp() - return has("gui_running") || exists("neovim_dot_app") - \ || has("gui_win32") || has("gui_macvim") - \ || has("gui_vimr") || exists('g:gui_oni') + return has('gui_running') || exists('neovim_dot_app') + \ || has('gui_win32') || has('gui_macvim') + \ || has('gui_vimr') || exists('g:gui_oni') endfunction " Some GUI applications provide built in support for certain features @@ -62,7 +58,9 @@ let g:gui.has_ctags_features = exists('g:gui_oni') if empty(glob('~/.vim/autoload/plug.vim')) silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - autocmd VimEnter * PlugInstall + augroup pluginstall + autocmd VimEnter * PlugInstall + augroup end endif call s:smart_source_rc('init') diff --git a/vim/rc/plugins/goyo-limelight.rc.vim b/vim/rc/plugins/goyo-limelight.rc.vim index 72fbfc7..c861d8d 100644 --- a/vim/rc/plugins/goyo-limelight.rc.vim +++ b/vim/rc/plugins/goyo-limelight.rc.vim @@ -1,13 +1,19 @@ " Both these plugins work well together for distraction free editing -command Zen :Goyo Plug 'junegunn/goyo.vim', { 'on': 'Goyo' } Plug 'junegunn/limelight.vim', { 'on': 'Limelight' } let g:goyo_width = 120 + +command Zen :Goyo + function! s:goyo_enter() Limelight endfunction + function! s:goyo_leave() Limelight! endfunction -autocmd! User GoyoEnter nested call goyo_enter() -autocmd! User GoyoLeave nested call goyo_leave() + +augroup zenevents + autocmd! User GoyoEnter nested call goyo_enter() + autocmd! User GoyoLeave nested call goyo_leave() +augroup end diff --git a/vim/rc/plugins/omnicompletion.rc.vim b/vim/rc/plugins/omnicompletion.rc.vim index 37772d3..3642d81 100644 --- a/vim/rc/plugins/omnicompletion.rc.vim +++ b/vim/rc/plugins/omnicompletion.rc.vim @@ -1,6 +1,8 @@ -autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS -autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags -autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS -autocmd FileType python setlocal omnifunc=jedi#completions -autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete -autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags +augroup ftomni + autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS + autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags + autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS + autocmd FileType python setlocal omnifunc=jedi#completions + autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete + autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags +augroup end diff --git a/vim/rc/ui.rc.vim b/vim/rc/ui.rc.vim index 5d7d8bd..83ef1a2 100644 --- a/vim/rc/ui.rc.vim +++ b/vim/rc/ui.rc.vim @@ -1,7 +1,10 @@ +" Add encoding for multibyte chars +scriptencoding utf-8 + " Display filename at bottom of window -set ls=2 +set laststatus=2 "enable line numbers -set nu +set number " Highlights the line the cursor is on set cursorline @@ -11,7 +14,7 @@ set cursorline syntax on " Enable search highlighting -set hls +set hlsearch " Color Schemes {{ " Set theme based on $VIM_COLOR variable @@ -41,7 +44,7 @@ function! UpdateColors() let dark_color = $VIM_COLOR_DARK endif " Detect using an env variable - let cmd = "echo $IS_DARKMODE" + let cmd = 'echo $IS_DARKMODE' " On macOS we can do something a bit more fancy if IsMac() let cmd = "osascript @@ -53,7 +56,7 @@ function! UpdateColors() endif let dark_mode = substitute(system(cmd), '\n', '', 'g') " Set colorscheme and background based on mode - if dark_mode == 'true' + if dark_mode ==# 'true' execute 'colorscheme ' . dark_color set background=dark else @@ -83,10 +86,10 @@ endif " Set xterm and screen/tmux's title {{ set titlestring=vim\ %{expand(\"%t\")} -if &term =~ "^screen" +if &term =~# '^screen' " pretend this is xterm. it probably is anyway, but if term is left as " `screen`, vim doesn't understand ctrl-arrow. - if &term == "screen-256color" + if &term ==# 'screen-256color' set term=xterm-256color else set term=xterm