How to activate VIM tokens?

I inherited some C ++ code using vim-based flash markers:

// CONSTRUCTORS/DESTRUCTORS /*{{{*/
Foo::Foo()
{
}
Foo::~Foo()
{
}
/*}}}*/

What do I need to add to my .vimrc to enable folding switches like zm and space-bar?

With my current settings, when I press the spacebar inside or zm, vim does nothing.

+4
source share
3 answers

The default keys for folding are zaeither or zm(although zmI think it only closes the folds, and zatoggles them), so you should add the following lines to .vimrc:

set foldmethod=markerto enable collapse using markers ( {{{things in your code)

nnoremap <space> za, space, .

! , , autocmd s, :

autocmd FileType vim,c++,txt setlocal foldmethod=marker, , vim, ++ .

, , vim guru Steve Losh . , . .

+6

, , , , :

set foldmethod=marker                                                                 |~
nnoremap <space> za
0

, modeline. , z-shell script, , , . - :

# vim:ts=4:sw=4:ai:foldmethod=marker:foldlevel=0:

Modify the comment to match the type of your code, and make sure vimthere is a space before the word . As always a good place to start: :help modelineand :help folding. You may need to add set modelineto your .vimrc file if modelineit was not installed during build.

0
source

All Articles