| Summary: | vim auto-indenting problem for txt files | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | Robert <robert257> |
| Component: | Current packages | Assignee: | Vim Maintainers <vim> |
| Status: | RESOLVED INVALID | ||
| Severity: | minor | ||
| Priority: | High | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
How does vim tell the difference between paragraphs with a weird first line indent and paragraphs that are wholly indented? The latter are much more common. |
When composing a txt file it is customary to put a tab or other such spacing to indent a paragrah. This causes unexpected behavior (ie a bug) with the default /etc/vim/vimrc file. On a default install, txt files (*.txt) will be auto wrapped at 78 characters. Vim also has auto-indenting turned on by default. When you indent your paragraph and type over 78 characters, vim auto wraps the line, then auto-indents the line with your paragraph instead of leaving the text aligned with the left of the 'page'. This is usually undesired. You end up with something like: Blah blah ..(more blahs to get over 78 chars) blah blah blah.... blah blah blah.... Instead of: Blay blah.... blah blah blah.... blah blah blah.... Reproducible: Always Steps to Reproduce: 1. open a file ending in .txt 2. indent your paragraph 3. write a paragraph over 78 characters long Actual Results: Malformed indention Expected Results: Proper indention To fix, one could disable auto-wrapping for txt files altogether in the default install or unset ai (auto-indent) within the test for *.txt files: " autocmd BufNewFile,BufRead *.txt " \ if &tw == 0 && ! exists("g:leave_my_textwidth_alone") | " \ setlocal textwidth=78 | " \ endif