mirror of
https://github.com/preservim/vim-indent-guides.git
synced 2025-11-17 14:13:37 -05:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c214805f2 | ||
|
|
2ea3460539 | ||
|
|
bd16c77359 | ||
|
|
349edc9da2 |
@@ -82,22 +82,21 @@ function! indent_guides#highlight_colors()
|
||||
if has('gui_running')
|
||||
call indent_guides#gui_highlight_colors()
|
||||
else
|
||||
call indent_guides#cterm_highlight_colors()
|
||||
call indent_guides#basic_highlight_colors()
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"
|
||||
" Defines the indent highlight colors for terminal vim.
|
||||
" Defines some basic indent highlight colors that work for Terminal Vim and
|
||||
" gVim when colors can't be automatically calculated.
|
||||
"
|
||||
" NOTE: This function contains no magic at the moment, it will simply use some
|
||||
" light or dark preset colors depending on the `set background=` value.
|
||||
"
|
||||
function! indent_guides#cterm_highlight_colors()
|
||||
let l:colors = (&g:background == 'dark') ? ['darkgrey', 'black'] : ['lightgrey', 'white']
|
||||
function! indent_guides#basic_highlight_colors()
|
||||
let l:cterm_colors = (&g:background == 'dark') ? ['darkgrey', 'black'] : ['lightgrey', 'white']
|
||||
let l:gui_colors = (&g:background == 'dark') ? ['grey15', 'grey30'] : ['grey70', 'grey85']
|
||||
|
||||
exe 'hi IndentGuidesEven ctermbg=' . l:colors[0]
|
||||
exe 'hi IndentGuidesOdd ctermbg=' . l:colors[1]
|
||||
exe 'hi IndentGuidesEven guibg=' . l:gui_colors[0] . ' ctermbg=' . l:cterm_colors[0]
|
||||
exe 'hi IndentGuidesOdd guibg=' . l:gui_colors[1] . ' ctermbg=' . l:cterm_colors[1]
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -116,6 +115,10 @@ function! indent_guides#gui_highlight_colors()
|
||||
" color name is being used, eg. 'white'
|
||||
let l:color_name = matchstr(s:hi_normal, s:color_name_bg_pat)
|
||||
let l:hi_normal_guibg = color_helper#color_name_to_hex(l:color_name)
|
||||
|
||||
else
|
||||
" background color could not be detected, default to basic colors
|
||||
call indent_guides#basic_highlight_colors()
|
||||
endif
|
||||
|
||||
if l:hi_normal_guibg =~ s:color_hex_pat
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
|
||||
Author: Nate Kane <nathanaelkane AT gmail DOT com>
|
||||
Version: 1.2
|
||||
Last Change: 10 Jan 2011
|
||||
Version: 1.3
|
||||
Last Change: 17 Jan 2011
|
||||
|
||||
==============================================================================
|
||||
CONTENTS *indent-guides-contents*
|
||||
@@ -95,9 +95,9 @@ in an autocmd.
|
||||
Use this option to control the percent at which the highlight colors will be
|
||||
lightened or darkened.
|
||||
|
||||
Default: 5 (5%). Values: between 0 and 100.
|
||||
Default: 10 (10%). Values: between 0 and 100.
|
||||
>
|
||||
let g:indent_guides_color_change_percent = 5
|
||||
let g:indent_guides_color_change_percent = 10
|
||||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
@@ -203,10 +203,16 @@ Bug reports, feedback, suggestions etc are welcomed.
|
||||
==============================================================================
|
||||
7. CHANGELOG *indent-guides-changelog*
|
||||
|
||||
1.3~
|
||||
* Changed the default value of g:|indent_guides_color_change_percent| to 10.
|
||||
* Added support for gVim themes that don't specify a `hi Normal guibg`
|
||||
color.
|
||||
|
||||
1.2~
|
||||
* Customizable size for indent guides, eg. skinny guides (soft-tabs only).
|
||||
* Customizable start indent level.
|
||||
* Refactored some internal logic.
|
||||
|
||||
1.1~
|
||||
* Added basic support for Terminal Vim. See |indent-guides-terminal-vim| for
|
||||
more information.
|
||||
@@ -223,7 +229,7 @@ Bug reports, feedback, suggestions etc are welcomed.
|
||||
The MIT Licence
|
||||
http://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
Copyright (c) 2010 Nate Kane
|
||||
Copyright (c) 2010-2011 Nate Kane
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -47,7 +47,7 @@ let g:indent_guides_color_name_guibg_pattern = "guibg='\\?\\zs[0-9A-Za-z ]\\+\\z
|
||||
" Configurable global variables
|
||||
call s:InitVariable('g:indent_guides_indent_levels', 30)
|
||||
call s:InitVariable('g:indent_guides_auto_colors', 1 )
|
||||
call s:InitVariable('g:indent_guides_color_change_percent', 5 ) " ie. 5%
|
||||
call s:InitVariable('g:indent_guides_color_change_percent', 10) " ie. 10%
|
||||
call s:InitVariable('g:indent_guides_guide_size', 0 )
|
||||
call s:InitVariable('g:indent_guides_start_level', 1 )
|
||||
call s:InitVariable('g:indent_guides_debug', 0 )
|
||||
|
||||
Reference in New Issue
Block a user