Вопрос

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