Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim getting the current value of vim foldmarker

Tags:

vim

How do you find the value of vim variables that are set with one word commands

such as :set foldmarker={,}

I'm writing a simple custom function for foldtext() to set a custom one line summary of the folded region

it works great but looks funny when I open a documents with any fold marker other than what I've hard coded into the function

here is the function

set foldtext=GetCustomFoldText()
function GetCustomFoldText()
    let foldClose = '}'
    let foldTtl = v:foldend - v:foldstart
    return getline(v:foldstart) . ' (+) ' . foldTtl .  ' lines... ' . foldClose
endfunction

which makes this:

function myAwsomeFunction()
{
    // awsomeness here
    // awsomeness here
    // awsomeness here
}

folded becomes this:

function myAwsomeFunction()
{ (+) 5 lines... }

Which is great until I edit a document with a different foldmarker

I'm trying to determine foldClose dynamically from the foldmarker

like image 521
Fire Crow Avatar asked Jul 22 '09 01:07

Fire Crow


2 Answers

Use & before the option name:

:let g:foo = &foldmarker
:echo g:foo
like image 130
too much php Avatar answered Nov 15 '22 08:11

too much php


:set all ; will print all vim settings

like image 33
kokosing Avatar answered Nov 15 '22 09:11

kokosing