1
0
mirror of https://github.com/amix/vimrc synced 2025-09-18 10:35:01 +08:00

First commit

This commit is contained in:
Bonta Vlad
2014-09-10 19:00:14 +03:00
parent cdea5a5ee3
commit 187aa46897
195 changed files with 12531 additions and 1 deletions

View File

@ -0,0 +1,169 @@
" Script Name: indentLine.vim
" Version: 1.0.5
" Last Change: April 1, 2013
" Author: Yggdroot <archofortune@gmail.com>
"
" Description: To show the indention levels with thin vertical lines
"{{{1 global variables
if !has("conceal") || exists("g:indentLine_loaded")
finish
endif
let g:indentLine_loaded = 1
" | ¦ ┆ ┊ │
if !exists("g:indentLine_char")
if &encoding ==? "utf-8"
let g:indentLine_char = "¦"
else
let g:indentLine_char = "|"
endif
endif
if !exists("g:indentLine_first_char")
if &encoding ==? "utf-8"
let g:indentLine_first_char = "¦"
else
let g:indentLine_first_char = "|"
endif
endif
if !exists("g:indentLine_indentLevel")
let g:indentLine_indentLevel = 10
endif
if !exists("g:indentLine_enabled")
let g:indentLine_enabled = 1
endif
if !exists("g:indentLine_fileType")
let g:indentLine_fileType = []
endif
if !exists("g:indentLine_fileTypeExclude")
let g:indentLine_fileTypeExclude = []
endif
if !exists("g:indentLine_bufNameExclude")
let g:indentLine_bufNameExclude = []
endif
if !exists("g:indentLine_showFirstIndentLevel")
let g:indentLine_showFirstIndentLevel = 0
endif
if !exists("g:indentLine_maxLines")
let g:indentLine_maxLines = 3000
endif
set conceallevel=1
set concealcursor=inc
"{{{1 function! <SID>InitColor()
function! <SID>InitColor()
if !exists("g:indentLine_color_term")
if &bg ==? "light"
let term_color = 249
else
let term_color = 239
endif
else
let term_color = g:indentLine_color_term
endif
if !exists("g:indentLine_color_gui")
if &bg ==? "light"
let gui_color = "Grey70"
else
let gui_color = "Grey30"
endif
else
let gui_color = g:indentLine_color_gui
endif
exec "hi Conceal ctermfg=" . term_color . " ctermbg=NONE"
exec "hi Conceal guifg=" . gui_color . " guibg=NONE"
endfunction
"{{{1 function! <SID>SetIndentLine()
function! <SID>SetIndentLine()
let b:indentLine_enabled = 1
let space = &l:shiftwidth
if g:indentLine_showFirstIndentLevel
exec 'syn match IndentLine /^ / containedin=ALL conceal cchar=' . g:indentLine_first_char
endif
let pattern = line('$') < g:indentLine_maxLines ? 'v' : 'c'
for i in range(space+1, space * g:indentLine_indentLevel + 1, space)
exec 'syn match IndentLine /\%(^\s\+\)\@<=\%'.i.pattern.' / containedin=ALL conceal cchar=' . g:indentLine_char
endfor
endfunction
"{{{1 function! <SID>ResetWidth(...)
function! <SID>ResetWidth(...)
if a:0 > 0
let &l:shiftwidth = a:1
endif
if exists("b:indentLine_enabled")
syn clear IndentLine
endif
call <SID>SetIndentLine()
endfunction
"{{{1 function! <SID>IndentLinesToggle()
function! <SID>IndentLinesToggle()
if !exists("b:indentLine_enabled")
let b:indentLine_enabled = 0
endif
if b:indentLine_enabled
let b:indentLine_enabled = 0
syn clear IndentLine
else
call <SID>SetIndentLine()
endif
endfunction
"{{{1 function! <SID>Setup()
function! <SID>Setup()
if !getbufvar("%","&hidden") || !exists("b:indentLine_set")
let b:indentLine_set = 1
if &ft == ""
call <SID>InitColor()
endif
if index(g:indentLine_fileTypeExclude, &ft) != -1
return
endif
if len(g:indentLine_fileType) != 0 && index(g:indentLine_fileType, &ft) == -1
return
end
for name in g:indentLine_bufNameExclude
if matchstr(bufname(''), name) == bufname('')
return
endif
endfor
if !exists("b:indentLine_enabled")
let b:indentLine_enabled = g:indentLine_enabled
endif
if b:indentLine_enabled
call <SID>SetIndentLine()
endif
endif
endfunction
"{{{1 commands
autocmd BufWinEnter * call <SID>Setup()
autocmd BufRead,ColorScheme * call <SID>InitColor()
command! -nargs=? IndentLinesReset call <SID>ResetWidth(<f-args>)
command! IndentLinesToggle call <SID>IndentLinesToggle()
" vim:et:ts=4:sw=4:fdm=marker:fmr={{{,}}}

View File

@ -0,0 +1,118 @@
*indentLine.txt* Show vertical lines for indent with conceal feature
CONTENTS *indentLine-contents*
Introduction |indentLine-introduction|
Config |indentLine-config|
Variables |indentLine-variables|
Commands |indentLine-commands|
FAQ |indentLine-faq|
Changelog |indentLine-changelog|
Credits |indentLine-credits|
==============================================================================
INTRODUCTION *indentLine-introduction*
This plugin is used for displaying thin vertical lines at each indentation
level for code indented with spaces. For code indented with tabs, I think
there is no need to support it, using :set list lcs=tab:\|\ (here is a space)
can achieve it.
==============================================================================
CONFIG *indentLine-config*
==============================================================================
VARIABLES *indentLine-variables*
g:indentLine_loaded *g:loaded_indentLine*
Whether load indentLine plugin.
Default value is 0.
g:indentLine_char *g:indentLine_char*
Specify a character to be used as indent line.
You also can use other characters:
| ¦ ┆ │
Default value is "|".
g:indentLine_first_char *g:indentLine_first_char*
Specify a character to be used as indent line
on the first level.
You also can use other characters:
| ¦ ┆ │
Default value is "|".
g:indentLine_color_term *g:indentLine_color_term*
Specify terminal vim indent line color.
e.g. let g:indentLine_color_term = 239
g:indentLine_color_gui *g:indentLine_color_gui*
Specify GUI vim indent line color.
e.g. let g:indentLine_color_gui = '#A4E57E'
g:indentLine_indentLevel *g:indentLine_indentLevel*
Specify how much indent level do you want to use for
indentLine. Most program will not has bigger indent level than
10.
Default value is 10.
g:indentLine_showFirstIndentLevel *g:indentLine_showFirstIndentLevel*
Specify whether the first indent level should be shown.
This is useful if you use indentLine in comination with
|listchars| in order to show tabs.
Default value is 0.
g:indentLine_enabled *g:indentLine_enabled*
Specify whether to enable indentLine plugin by default.
If value is not 0, the plugin is on by default, otherwise off.
Default value is 1.
g:indentLine_fileType *g:indentLine_fileType*
This variable specify a list of file types.
When opening these types of files, the plugin is enabled by
default.
e.g. let g:indentLine_fileType = ['c', 'cpp']
Default value is [] which means all file types is supported.
g:indentLine_fileTypeExclude *g:indentLine_fileTypeExclude*
This variable specify a list of file types.
When opening these types of files, the plugin is disabled by
default.
e.g. let g:indentLine_fileType = ['text', 'sh']
Default value is [] which means no file types is excluded.
g:indentLine_bufNameExclude *g:indentLine_bufNameExclude*
This variable specify a list of buffer names, which can be
regular expression. If the buffer's name fall into this list,
the indentLine won't display.
e.g. let g:indentLine_bufNameExclude = ['_.*', 'NERD_tree.*']
Default value is [].
g:indentLine_maxLines *g:indentLine_maxLines*
This variable specify a number, when the number of buffer's
lines exceed it, the plugin try to use another pattern to make
the performance better.
Default value is 3000.
==============================================================================
COMMANDS *indentLine-commands*
IndentLinesReset [number]
if 'shiftwidth' changes, using this command can redraw the
indentLines. number is optional, it means the width between
two indent level, if ommited, value of 'shiftwidth' is used.
IndentLinesToggle
toggle the indent lines of the current buffer.
==============================================================================
FAQ *indentLine-faq*
==============================================================================
CHANGELOG *indentLine-changelog*
==============================================================================
CREDITS *indentLine-credits*
Thanks to the following people for suggestions and patches:
NagatoPain
Salman Halim
Christophe
==============================================================================
vim:tw=78:ts=8:ft=help:norl