Thursday, April 28, 2011

Re: how to fold across file

On Thu, April 28, 2011 12:24 pm, vicky b wrote:
> What foldmethod are you using?: i am poor in folds

Please trim your quotes and don't top post.

For an introduction about folding, you should read the help, e.g.
:h folding
:h usr_28.txt

Here is an suggestion for how to fold, which should do what you want. I
only rarely do something with java code, so this may or may not provide
what you want:

:setl fdm=expr
:setl
foldexpr=getline(v:lnum)=~'/\\*\\*'?'a1':getline(v:lnum)=~'\\*/'?'s1':'='
:setl foldtext=getline(v:foldstart+1)

(each is a single line, in case the email messes the format up)
Enter those commands in a java file and see if this helps you.

If this suits you, create a file java.vim in ~/.vim/after/ftplugin/
(unix) or $HOME/vimfiles/after/ftplugin (Windows) directory (create
missing directories, if they don't exists yet) and put these statements
there. Be sure to include a

:filetype plugin indent on

statement inside ~/.vimrc file, so the newly created java.vim
file will be read whenever Vim edits a java file.

I am sure, there are better ways, to fold comments like what you want.
But this gives you a starter.

regards,
Christian

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment