On Jun 1, 8:37 am, Eric Weir <[email protected]> wrote: > I'm a Vim novice, and a writer not a programmer. I've perused the responses > to questions about folding in the Vim FAQ. It's largely Greek to me. I have a > couple questions:
> I understand folds can be indented. How do you mean? You can fold based on existing indent, which will fold all lines having the same indent into a single displayed line, where "line" means a newline-terminated string. Or, if you have a fold, you can use the >> operator to increase the indent of everything inside the fold. Or perhaps you mean something different. > Is it possible to get Vim to wrap words to the indent column? Word wrapping and folding are two completely unrelated topics. Again, what do you mean by wrapping? Usually this means you have a single long line which Vim displays on many lines by "wrapping" the text which goes past the edge of the window. This is accomplished by setting the 'wrap' option and probably 'linebreak' as well so that Vim only wraps at word boundaries. Unfortunately, using this wrap method, there is no way to automatically start the next displayed line at the appropriate indent level unless you modify the Vim executable. Since you say you're not a programmer, this is probably an intimidating task. There are a couple of partial solutions. The first would be to use the 'showbreak' option, which will add text to be displayed at the beginning of each wrapped line. This text can be simply a number of spaces, in effect creating an indent for wrapped lines. However, 'showbreak' affects every line in the same way, regardless of indent. The next option would be to not use this "soft wrap" feature, but instead us a "hard wrap" and insert real line breaks to wrap your text. If you set 'formatoptions' to contain the 't' and 'a' flags, and set 'textwidth' appropriately, Vim will automatically reformat each paragraph as you type it so you don't need to worry about keeping this up-to-date. > Is there a way I can get folds to persist across a save and reload? > I understand the :mkview command will save manual folds, which the :loadview command will restore. There is probably a plugin to do this for you automatically. If you fold using another method (e.g. indent, as mentioned above) then you can either set up a command in your .vimrc to automatically set this fold method for certain file types or file names. For example, autocmd BufRead *.txt set foldmethod=indent Or, you could include a line such as the following at either the top or bottom of every file you wish to do this for: vim: foldmethod=indent This is called a "modeline". By default, Vim scans the first and last few lines in a file for lines in this format, and uses them to set options on a per-file basis, overriding your built-in defaults and .vimrc settings. Many *nix systems disable these globally, but you could re-enable them in your .vimrc if you have this problem. -- 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
