mirror of
https://github.com/amix/vimrc
synced 2025-06-30 11:54:59 +08:00
Updated plugins
This commit is contained in:
15
sources_non_forked/vim-indent-guides/.github/workflows/vint.yml
vendored
Normal file
15
sources_non_forked/vim-indent-guides/.github/workflows/vint.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
name: Vint
|
||||
on: [push]
|
||||
jobs:
|
||||
vint:
|
||||
name: vint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
- name: Setup dependencies
|
||||
run: pip install vim-vint
|
||||
- name: Lint Vimscript
|
||||
run: vint .
|
@ -1,4 +1,7 @@
|
||||
# Indent Guides (unmaintained)
|
||||
# Indent Guides
|
||||
|
||||
[](https://github.com/preservim/vim-indent-guides/actions?workflow=Vint)
|
||||
|
||||
Indent Guides is a plugin for visually displaying indent levels in Vim.
|
||||
|
||||
<img src="http://i.imgur.com/ONgoj.png" width="448" height="448" alt="" />
|
||||
@ -24,7 +27,7 @@ If you have [Pathogen](http://www.vim.org/scripts/script.php?script_id=2332) ins
|
||||
|
||||
```bash
|
||||
cd ~/.vim/bundle
|
||||
git clone git://github.com/nathanaelkane/vim-indent-guides.git
|
||||
git clone git://github.com/preservim/vim-indent-guides.git
|
||||
```
|
||||
|
||||
### Vundle
|
||||
|
@ -1,5 +1,5 @@
|
||||
" Author: Nate Kane <nathanaelkane AT gmail DOT com>
|
||||
" Homepage: http://github.com/nathanaelkane/vim-indent-guides
|
||||
" Homepage: http://github.com/preservim/vim-indent-guides
|
||||
|
||||
"
|
||||
" Return hex string equivalent to given decimal string or number.
|
||||
@ -10,7 +10,7 @@
|
||||
" Example: color_helper#dec_to_hex(255, 5)
|
||||
" Returns: '000FF'
|
||||
"
|
||||
function! color_helper#dec_to_hex(arg, padding)
|
||||
function! color_helper#dec_to_hex(arg, padding) abort
|
||||
return toupper(printf('%0' . a:padding . 'x', a:arg + 0))
|
||||
endfunction
|
||||
|
||||
@ -26,7 +26,7 @@ endfunction
|
||||
" Example: color_helper#hex_to_dec('00')
|
||||
" Returns: 0
|
||||
"
|
||||
function! color_helper#hex_to_dec(arg)
|
||||
function! color_helper#hex_to_dec(arg) abort
|
||||
return (a:arg =~? '^0x') ? a:arg + 0 : ('0x'.a:arg) + 0
|
||||
endfunction
|
||||
|
||||
@ -36,7 +36,7 @@ endfunction
|
||||
" Example: color_helper#hex_color_to_rgb('#0088FF')
|
||||
" Returns: [0, 136, 255]
|
||||
"
|
||||
function! color_helper#hex_color_to_rgb(hex_color)
|
||||
function! color_helper#hex_color_to_rgb(hex_color) abort
|
||||
let l:rgb = []
|
||||
|
||||
if a:hex_color =~ g:indent_guides_color_hex_pattern
|
||||
@ -55,7 +55,7 @@ endfunction
|
||||
" Example: color_helper#rgb_color_to_hex([0, 136, 255])
|
||||
" Returns: '#0088FF'
|
||||
"
|
||||
function! color_helper#rgb_color_to_hex(rgb_color)
|
||||
function! color_helper#rgb_color_to_hex(rgb_color) abort
|
||||
let l:hex_color = '#'
|
||||
let l:hex_color .= color_helper#dec_to_hex(a:rgb_color[0], 2) " red
|
||||
let l:hex_color .= color_helper#dec_to_hex(a:rgb_color[1], 2) " green
|
||||
@ -71,7 +71,7 @@ endfunction
|
||||
" Example: color_helper#hex_color_lighten('#000000', 0.10)
|
||||
" Returns: '#191919'
|
||||
"
|
||||
function! color_helper#hex_color_lighten(color, percent)
|
||||
function! color_helper#hex_color_lighten(color, percent) abort
|
||||
let l:rgb = color_helper#hex_color_to_rgb(a:color)
|
||||
let l:rgb_lightened = []
|
||||
|
||||
@ -89,7 +89,7 @@ endfunction
|
||||
" Example: color_helper#hex_color_darken('#FFFFFF', 0.10)
|
||||
" Returns: '#E5E5E5'
|
||||
"
|
||||
function! color_helper#hex_color_darken(color, percent)
|
||||
function! color_helper#hex_color_darken(color, percent) abort
|
||||
let l:rgb = color_helper#hex_color_to_rgb(a:color)
|
||||
let l:rgb_darkened = []
|
||||
|
||||
@ -106,7 +106,7 @@ endfunction
|
||||
" Example: color_helper#color_name_to_hex('darkslategray')
|
||||
" Returns: '#2F4F4F'
|
||||
"
|
||||
function! color_helper#color_name_to_hex(color_name)
|
||||
function! color_helper#color_name_to_hex(color_name) abort
|
||||
let l:hex_code = ''
|
||||
let l:color_name = tolower(a:color_name)
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
" Author: Nate Kane <nathanaelkane AT gmail DOT com>
|
||||
" Homepage: http://github.com/nathanaelkane/vim-indent-guides
|
||||
" Homepage: http://github.com/preservim/vim-indent-guides
|
||||
|
||||
"
|
||||
" Toggles the indent guides on and off.
|
||||
"
|
||||
function! indent_guides#toggle()
|
||||
function! indent_guides#toggle() abort
|
||||
call indent_guides#init_matches()
|
||||
|
||||
if empty(w:indent_guides_matches)
|
||||
@ -18,7 +18,7 @@ endfunction
|
||||
" Called from autocmds, keeps indent guides enabled or disabled when entering
|
||||
" other buffers and windows.
|
||||
"
|
||||
function! indent_guides#process_autocmds()
|
||||
function! indent_guides#process_autocmds() abort
|
||||
if g:indent_guides_autocmds_enabled
|
||||
call indent_guides#enable()
|
||||
else
|
||||
@ -30,7 +30,7 @@ endfunction
|
||||
" Enables the indent guides for the current buffer and any other buffer upon
|
||||
" entering it.
|
||||
"
|
||||
function! indent_guides#enable()
|
||||
function! indent_guides#enable() abort
|
||||
let g:indent_guides_autocmds_enabled = 1
|
||||
|
||||
if &diff || indent_guides#exclude_filetype()
|
||||
@ -64,7 +64,7 @@ endfunction
|
||||
" Disables the indent guides for the current buffer and any other buffer upon
|
||||
" entering it.
|
||||
"
|
||||
function! indent_guides#disable()
|
||||
function! indent_guides#disable() abort
|
||||
let g:indent_guides_autocmds_enabled = 0
|
||||
call indent_guides#clear_matches()
|
||||
endfunction
|
||||
@ -72,7 +72,7 @@ endfunction
|
||||
"
|
||||
" Clear all highlight matches for the current window.
|
||||
"
|
||||
function! indent_guides#clear_matches()
|
||||
function! indent_guides#clear_matches() abort
|
||||
call indent_guides#init_matches()
|
||||
if !empty(w:indent_guides_matches)
|
||||
let l:index = 0
|
||||
@ -86,14 +86,21 @@ function! indent_guides#clear_matches()
|
||||
let l:index += l:index
|
||||
endfor
|
||||
endif
|
||||
|
||||
" Make sure to clear indent guide if remembered match id has gone somehow.
|
||||
for l:match in getmatches()
|
||||
if l:match.group =~# '^IndentGuides\v(Even|Odd)$'
|
||||
call matchdelete(l:match.id)
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
"
|
||||
" Automagically calculates and defines the indent highlight colors.
|
||||
"
|
||||
function! indent_guides#highlight_colors()
|
||||
function! indent_guides#highlight_colors() abort
|
||||
if s:auto_colors
|
||||
if has('gui_running') || has('nvim')
|
||||
if has('gui_running') || has('nvim') || (has('termguicolors') && &termguicolors)
|
||||
call indent_guides#gui_highlight_colors()
|
||||
else
|
||||
call indent_guides#basic_highlight_colors()
|
||||
@ -105,9 +112,9 @@ endfunction
|
||||
" Defines some basic indent highlight colors that work for Terminal Vim and
|
||||
" gVim when colors can't be automatically calculated.
|
||||
"
|
||||
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']
|
||||
function! indent_guides#basic_highlight_colors() abort
|
||||
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 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]
|
||||
@ -117,7 +124,7 @@ endfunction
|
||||
" Automagically calculates and defines the indent highlight colors for gui
|
||||
" vim.
|
||||
"
|
||||
function! indent_guides#gui_highlight_colors()
|
||||
function! indent_guides#gui_highlight_colors() abort
|
||||
let l:hi_normal_guibg = ''
|
||||
|
||||
" capture the backgroud color from the normal highlight
|
||||
@ -150,10 +157,10 @@ endfunction
|
||||
" Takes a color and darkens or lightens it depending on whether a dark or light
|
||||
" colorscheme is being used.
|
||||
"
|
||||
function! indent_guides#lighten_or_darken_color(color)
|
||||
function! indent_guides#lighten_or_darken_color(color) abort
|
||||
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)
|
||||
else
|
||||
let l:new_color = color_helper#hex_color_darken (a:color, s:change_percent)
|
||||
@ -165,7 +172,7 @@ endfunction
|
||||
"
|
||||
" Define default highlights.
|
||||
"
|
||||
function! indent_guides#define_default_highlights()
|
||||
function! indent_guides#define_default_highlights() abort
|
||||
hi default clear IndentGuidesOdd
|
||||
hi default clear IndentGuidesEven
|
||||
endfunction
|
||||
@ -173,7 +180,7 @@ endfunction
|
||||
"
|
||||
" Init the w:indent_guides_matches variable.
|
||||
"
|
||||
function! indent_guides#init_matches()
|
||||
function! indent_guides#init_matches() abort
|
||||
let w:indent_guides_matches = exists('w:indent_guides_matches') ? w:indent_guides_matches : []
|
||||
endfunction
|
||||
|
||||
@ -181,7 +188,7 @@ endfunction
|
||||
" We need to initialize these vars every time a buffer is entered while the
|
||||
" plugin is enabled.
|
||||
"
|
||||
function! indent_guides#init_script_vars()
|
||||
function! indent_guides#init_script_vars() abort
|
||||
if &l:shiftwidth > 0 && &l:expandtab
|
||||
let s:indent_size = &l:shiftwidth
|
||||
else
|
||||
@ -191,7 +198,7 @@ function! indent_guides#init_script_vars()
|
||||
let s:hi_normal = indent_guides#capture_highlight('Normal')
|
||||
|
||||
" remove 'font=<value>' from the s:hi_normal string (only seems to happen on Vim startup in Windows)
|
||||
let s:hi_normal = substitute(s:hi_normal, ' font=[A-Za-z0-9:]\+', "", "")
|
||||
let s:hi_normal = substitute(s:hi_normal, ' font=[A-Za-z0-9:]\+', '', '')
|
||||
|
||||
" shortcuts to the global variables - this makes the code easier to read
|
||||
let s:debug = g:indent_guides_debug
|
||||
@ -229,7 +236,7 @@ endfunction
|
||||
"
|
||||
" NOTE: Currently, this only works when soft-tabs are being used.
|
||||
"
|
||||
function! indent_guides#calculate_guide_size()
|
||||
function! indent_guides#calculate_guide_size() abort
|
||||
let l:guide_size = g:indent_guides_guide_size
|
||||
|
||||
if l:guide_size == 0 || l:guide_size > s:indent_size
|
||||
@ -245,12 +252,9 @@ endfunction
|
||||
" Example: indent_guides#capture_highlight('normal')
|
||||
" Returns: 'Normal xxx guifg=#323232 guibg=#ffffff'
|
||||
"
|
||||
function! indent_guides#capture_highlight(group_name)
|
||||
redir => l:output
|
||||
exe "silent hi " . a:group_name
|
||||
redir END
|
||||
|
||||
let l:output = substitute(l:output, "\n", "", "")
|
||||
function! indent_guides#capture_highlight(group_name) abort
|
||||
let l:output = execute('hi ' . a:group_name, 'silent')
|
||||
let l:output = substitute(l:output, '\n', '', '')
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
@ -266,7 +270,7 @@ endfunction
|
||||
" Example: indent_guides#indent_highlight_pattern('\t', 9, 2)
|
||||
" Returns: /^\t*\%9v\zs\t*\%11v\ze/
|
||||
"
|
||||
function! indent_guides#indent_highlight_pattern(indent_pattern, column_start, indent_size)
|
||||
function! indent_guides#indent_highlight_pattern(indent_pattern, column_start, indent_size) abort
|
||||
let l:pattern = '^' . a:indent_pattern . '*\%' . a:column_start . 'v\zs'
|
||||
let l:pattern .= a:indent_pattern . '*\%' . (a:column_start + a:indent_size) . 'v'
|
||||
let l:pattern .= '\ze'
|
||||
@ -276,8 +280,13 @@ endfunction
|
||||
"
|
||||
" Detect if any of the buffer filetypes should be excluded.
|
||||
"
|
||||
function! indent_guides#exclude_filetype()
|
||||
for ft in split(&ft, '\.')
|
||||
function! indent_guides#exclude_filetype() abort
|
||||
if exists('g:indent_guides_exclude_buftype')
|
||||
if g:indent_guides_exclude_buftype && &buftype !=# ''
|
||||
return 1
|
||||
endif
|
||||
endif
|
||||
for ft in split(&ft, '\.', 1)
|
||||
if index(g:indent_guides_exclude_filetypes, ft) > -1
|
||||
return 1
|
||||
end
|
||||
|
@ -170,9 +170,18 @@ Default: 0. Values: 0 or 1.
|
||||
let g:indent_guides_enable_on_vim_startup = 0
|
||||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'indent_guides_exclude_buftype'*
|
||||
Use this option to try and disable the plugin on non-file buffers
|
||||
|
||||
Default: 0. Values: 0 or 1
|
||||
>
|
||||
let g:indent_guides_exclude_buftype = 0
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'indent_guides_exclude_filetypes'*
|
||||
Use this option to specify a list of filetypes to disable the plugin for.
|
||||
Use this option to specify a list of filetypes to disable the plugin for. Use
|
||||
'' for files with no filetypes set.
|
||||
|
||||
Default: ['help']. Values: list of strings.
|
||||
>
|
||||
@ -248,8 +257,8 @@ Why did I build this plugin?~
|
||||
* I wanted to learn me some VimL.
|
||||
|
||||
Links:~
|
||||
* Github: https://github.com/nathanaelkane/vim-indent-guides
|
||||
* Bugs & Issues: https://github.com/nathanaelkane/vim-indent-guides/issues
|
||||
* Github: https://github.com/preservim/vim-indent-guides
|
||||
* Bugs & Issues: https://github.com/preservim/vim-indent-guides/issues
|
||||
|
||||
Credits:~
|
||||
* Matt Wozniski (godlygeek) for letting me use the list of color names and
|
||||
@ -265,8 +274,9 @@ Bug reports, feedback, suggestions etc are welcomed.
|
||||
7. CHANGELOG *indent-guides-changelog*
|
||||
|
||||
1.8 (pending release)~
|
||||
* Allow exclude files with no 'filetype' set (thanks @noscript).
|
||||
* Added option g:|indent_guides_soft_pattern| to control the pattern for
|
||||
soft indentation (thanks @sergey-vlasov).
|
||||
soft indentation (thanks @noscript).
|
||||
* Added option g:|indent_guides_default_mapping| to control whether the
|
||||
default mapping (<Leader>ig) gets set (thanks @suy).
|
||||
* Set size of indent guide to `tabstop` value when `shiftwidth=0` or
|
||||
|
@ -1,5 +1,5 @@
|
||||
" Author: Nate Kane <nathanaelkane AT gmail DOT com>
|
||||
" Homepage: http://github.com/nathanaelkane/vim-indent-guides
|
||||
" Homepage: http://github.com/preservim/vim-indent-guides
|
||||
|
||||
" Do not load if vim is too old
|
||||
if (v:version == 701 && !exists('*matchadd')) || (v:version < 701)
|
||||
@ -35,7 +35,7 @@ command! -bar IndentGuidesDisable call s:IndentGuidesDisable()
|
||||
"
|
||||
function s:InitVariable(var, value)
|
||||
if !exists(a:var)
|
||||
if type(a:value) == type("")
|
||||
if type(a:value) == type('')
|
||||
exec 'let ' . a:var . ' = ' . "'" . a:value . "'"
|
||||
else
|
||||
exec 'let ' . a:var . ' = ' . a:value
|
||||
@ -67,7 +67,7 @@ if !exists('g:indent_guides_exclude_filetypes')
|
||||
endif
|
||||
|
||||
" 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
|
||||
nmap <silent><unique> <Leader>ig <Plug>IndentGuidesToggle
|
||||
endif
|
||||
@ -86,6 +86,9 @@ augroup indent_guides
|
||||
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()
|
||||
endif
|
||||
|
||||
" Trigger BufEnter and process modelines.
|
||||
autocmd ColorScheme * doautocmd indent_guides BufEnter
|
||||
|
Reference in New Issue
Block a user