Use robust operators ==# or ==? instead of ==

This commit is contained in:
Caleb Maclennan
2023-02-21 16:13:57 +03:00
parent 8e6d5f7afd
commit 63554a38bb
2 changed files with 4 additions and 4 deletions

View File

@@ -106,8 +106,8 @@ endfunction
" gVim when colors can't be automatically calculated. " gVim when colors can't be automatically calculated.
" "
function! indent_guides#basic_highlight_colors() abort function! indent_guides#basic_highlight_colors() abort
let l:cterm_colors = (&g:background == 'dark') ? ['darkgrey', 'black'] : ['lightgrey', 'white'] let l:cterm_colors = (&g:background ==# 'dark') ? ['darkgrey', 'black'] : ['lightgrey', 'white']
let l:gui_colors = (&g:background == 'dark') ? ['grey15', 'grey30'] : ['grey70', 'grey85'] let l:gui_colors = (&g:background ==# 'dark') ? ['grey15', 'grey30'] : ['grey70', 'grey85']
exe 'hi IndentGuidesEven guibg=' . l:gui_colors[0] . ' guifg=' . l:gui_colors[1] . ' ctermbg=' . l:cterm_colors[0] . ' ctermfg=' . l:cterm_colors[1] exe 'hi IndentGuidesEven guibg=' . l:gui_colors[0] . ' guifg=' . l:gui_colors[1] . ' ctermbg=' . l:cterm_colors[0] . ' ctermfg=' . l:cterm_colors[1]
exe 'hi IndentGuidesOdd guibg=' . l:gui_colors[1] . ' guifg=' . l:gui_colors[0] . ' ctermbg=' . l:cterm_colors[1] . ' ctermfg=' . l:cterm_colors[0] exe 'hi IndentGuidesOdd guibg=' . l:gui_colors[1] . ' guifg=' . l:gui_colors[0] . ' ctermbg=' . l:cterm_colors[1] . ' ctermfg=' . l:cterm_colors[0]
@@ -153,7 +153,7 @@ endfunction
function! indent_guides#lighten_or_darken_color(color) abort function! indent_guides#lighten_or_darken_color(color) abort
let l:new_color = '' let l:new_color = ''
if (&g:background == 'dark') if (&g:background ==# 'dark')
let l:new_color = color_helper#hex_color_lighten(a:color, s:change_percent) let l:new_color = color_helper#hex_color_lighten(a:color, s:change_percent)
else else
let l:new_color = color_helper#hex_color_darken (a:color, s:change_percent) let l:new_color = color_helper#hex_color_darken (a:color, s:change_percent)

View File

@@ -67,7 +67,7 @@ if !exists('g:indent_guides_exclude_filetypes')
endif endif
" Default mapping " Default mapping
if !hasmapto('<Plug>IndentGuidesToggle', 'n') && maparg('<Leader>ig', 'n') == '' if !hasmapto('<Plug>IndentGuidesToggle', 'n') && maparg('<Leader>ig', 'n') ==# ''
\ && g:indent_guides_default_mapping != 0 \ && g:indent_guides_default_mapping != 0
nmap <silent><unique> <Leader>ig <Plug>IndentGuidesToggle nmap <silent><unique> <Leader>ig <Plug>IndentGuidesToggle
endif endif