aboutsummaryrefslogtreecommitdiff
path: root/vim/.vim/autoload/dyamon/guides.vim
blob: f6c158a43a687d89504ba8e9ff86f2211dcbfb61 (plain) (blame)
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
" Autoload functions for `cursorline` and `colorcolumn` (guides)
" Last Changed: 2021-06-02
" Author: Federico Igne <>
" License: This file is placed in the public domain.

function! dyamon#guides#on() abort
    " Guides values
    " 0) No guides
    " 1) Use cursorline
    " 2) [default] Use cursorline and cursorcolumn
    let l:guides = getbufvar("%","guides",2)
    if (l:guides > 0)
        " Always set cursorline (even for exceptions)
        setlocal cursorline
        " Set colorcolumn if not a special window
        if (l:guides > 1 && &textwidth > 1 )
            execute "setlocal colorcolumn=" . (&textwidth+1)
        endif
    endif
endfunction

function! dyamon#guides#off() abort
        " Disable guides
        setlocal nocursorline
        setlocal colorcolumn=0
endfunction