Skip to content

Commit

Permalink
Fix override on vim startup
Browse files Browse the repository at this point in the history
Relay only on indent_guides_enable_on_vim_startup
  • Loading branch information
rockandska committed Feb 24, 2023
1 parent 8bfe2ad commit 56063b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 3 additions & 3 deletions autoload/indent_guides.vim
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ endfunction
" other buffers and windows.
"
function! indent_guides#process_autocmds() abort
if indent_guides#getvar('indent_guides_autocmds_enabled')
if indent_guides#getvar('indent_guides_enable_on_vim_startup')
call indent_guides#enable()
else
call indent_guides#disable()
Expand All @@ -30,7 +30,7 @@ endfunction
" Enables the indent guides for the current buffer
"
function! indent_guides#enable() abort
let b:indent_guides_autocmds_enabled = 1
let b:indent_guides_enable_on_vim_startup = 1

if &diff || indent_guides#exclude_filetype()
call indent_guides#clear_matches()
Expand Down Expand Up @@ -64,7 +64,7 @@ endfunction
" entering it.
"
function! indent_guides#disable() abort
let b:indent_guides_autocmds_enabled = 0
let b:indent_guides_enable_on_vim_startup = 0
call indent_guides#clear_matches()
endfunction

Expand Down
6 changes: 0 additions & 6 deletions plugin/indent_guides.vim
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ function s:InitVariable(var, value)
endfunction

" Fixed global variables
let g:indent_guides_autocmds_enabled = 0
let g:indent_guides_color_hex_pattern = '#[0-9A-Fa-f]\{6\}'
let g:indent_guides_color_hex_guibg_pattern = 'guibg=\zs' . g:indent_guides_color_hex_pattern . '\ze'
let g:indent_guides_color_name_guibg_pattern = "guibg='\\?\\zs[0-9A-Za-z ]\\+\\ze'\\?"
Expand Down Expand Up @@ -81,11 +80,6 @@ nnoremap <unique><script> <Plug>IndentGuidesDisable :IndentGuidesDisable<CR>
augroup indent_guides
autocmd!

if g:indent_guides_enable_on_vim_startup
let g:indent_guides_autocmds_enabled = 1
autocmd VimEnter * :IndentGuidesEnable
endif

autocmd BufEnter,WinEnter,FileType * call indent_guides#process_autocmds()
if (v:version == 704 && has('patch786')) || (v:version > 704)
autocmd OptionSet tabstop,shiftwidth,expandtab call indent_guides#process_autocmds()
Expand Down

0 comments on commit 56063b1

Please sign in to comment.