문제

I have a js file with following content:

function do_this(){
    a = '{1}';
}

function do_that(a){
    b = b + 1;
}

// vim: set fdm=marker fmr={,} :

When it folds it shows following:

function do_this(){
    a = '{1}';
}

function do_that(a){ +-- 3 lines_____________

// vim: set fdm=marker fmr={,} :

I expect both functions to be folded. I guess "a = '{1}';" is getting in the way. Is there a way to fix this using only the custom marker "{,}" within the modeline?

도움이 되었습니까?

해결책

Unfortunately foldmarker does not allow regex matching, as specified by :h fmr. Therefore it will only match a literal string, so there's no way getting around the a = '{1}' in your example. However, it seems like what you really want is

// vim: set fdm=syntax fdls=1 :

with

let javaScript_fold=1

in your ~/.vimrc.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top