-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlong_line.vim
More file actions
31 lines (28 loc) · 871 Bytes
/
long_line.vim
File metadata and controls
31 lines (28 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
" Highlight long lines, highlight part of line exceeding textwidth
"
" Author: Bimba Laszlo <https://github.com/bimlas>
" Source: https://github.com/bimlas/vim-high
" License: MIT license
"
" Inspired by:
" https://github.com/whatyouhide/vim-lengthmatters
function! high#light#long_line#Define()
return {
\ '_length': 0,
\ '_single_column': 0,
\ '__init_function': function('s:Init'),
\ }
endfunction
function! s:Init(options) "{{{
if a:options._length
let a:options.pattern =
\ '\%'.(a:options._length+1).'v.'.(a:options._single_column ? '' : '\+')
else
let a:options.__update_function = function('s:Update')
endif
call high#group#AddMember(a:options)
endfunction "}}}
function! s:Update(options) "{{{
let a:options.pattern =
\ &textwidth > 0 ? '\%'.(&textwidth+1).'v.'.(a:options._single_column ? '' : '\+') : ''
endfunction "}}}