vim에서 set foldmethod=marker를 설정했을 때 무슨 마크를 폴딩

vudghkzm의 이미지

vim 에서 set foldmethod=marker 로 설정해놓으면 사용자가 마크 해 놓은 것으로 둘러쌓인 블럭을 폴딩할 수 있다고 들었는데요.

어떤 마크를 폴딩 마크로 사용해야 하나요?

서지훈의 이미지

$ vim
:help fold

Quote:
The markers can be set with the 'foldmarker' option. It is recommended to
keep this at the default value of "{{{,}}}", so that files can be exchanged
between Vim users. Only change it when it is required for the file (e.g., it
contains markers from another folding editor, or the default markers cause
trouble for the language of the file).

실제로 사용하실 때는 /* {{{ */ 이런 식으로 써 주셔야 합니다. 그런후 폴딩 옵션(zc등) 이 실행됩니다.

<어떠한 역경에도 굴하지 않는 '하양 지훈'>

#include <com.h> <C2H5OH.h> <woman.h>
do { if (com) hacking(); if (money) drinking(); if (women) loving(); } while (1);

vudghkzm의 이미지

.vimrc 에는 set foldmethod=marker 항목을 추가하고

/* {{{ */
...
/* }}} */

와 같이 해놓은 다음

/* {{{ */ 부분에 커서를 갖다대고 zc 를 하니까 No fold found 라고 메세지가 뜨네요. 왜 이렇게 되는것인지 궁금합니다.

서지훈의 이미지

vim에서 set 명령어로 foldmethod가 제대로 설정이 되었는지 확인 해보세요.

<어떠한 역경에도 굴하지 않는 '하양 지훈'>

#include <com.h> <C2H5OH.h> <woman.h>
do { if (com) hacking(); if (money) drinking(); if (women) loving(); } while (1);

ggtt7의 이미지

vi 프로그렘을 다시 실행하면 되더군요

수고하세요~~