Friday, October 25, 2013

Re: Disabling text wrap on GVim 7.4

On Thu, Oct 24, 2013 at 10:57:44PM -0700, Gary Johnson wrote:
> On 2013-10-24, Aaron Pieper wrote:
> > By default, GVim 7.4 word wraps text files to 78 characters. I
> > thought I could disable this by appending "set tw=0" to my
> > %HOME%\_vimrc, but this doesn't work. This doesn't work because
> > the text wrap is buried in "C:\Program Files
> > (x86)\Vim\vim74\vimrc_example.vim" in an autocommand.
> >
> > What's the best way to disable text wrap without editing the
> > global vimrc_example.vim?

This is one example of confusion created by vimrc_example. I think it's
cute and all, but believe it should never be loaded in its entirety and
most especially never recommended as Best Use to newbies.

> The easiest way I can think of is to put a similar autocommand in
> your _vimrc file _after_ the line that sources vimrc_example.vim.

> augroup vimrcEx
> autocmd FileType text setlocal textwidth=0
> augroup END

> The autocommand in vimrc_example.vim will still be executed, but
> yours will be executed shortly thereafter.

an ugly hack -- why do it in the first place only to undo it micro
seconds later?

> Another way would be to delete the autocommands in the vimrcEx
> group,

> augroup vimrcEx
> au!
> augroup END

another ugly hack

> That will also delete the autocommand that jumps to the last known
> cursor position when opening a file. If you want to keep that one,
> you can copy its definition to within the vimrcEx group in your
> _vimrc:

> augroup vimrcEx
> au!
> autocmd BufReadPost *
> \ if line("'\"") > 1 && line("'\"") <= line("$") |
> \ exe "normal! g`\"" |
> \ endif
> augroup END

YES! My belief is that vimrc_example was not created to be fully
implemented, but examined as an example (hence the name) of some of the
things that are possible in vim. Once a person understands what the
code does, and decides he likes it, then he can incorporate that part
(and only that part) in his own .vimrc.

My belief is we court disaster when we tell newbies to load all of
vimrc_example -- I've seen many times when newbies are confused by
inexplicable behavior of vim only to learn they were loading
vimrc_example because they were told it is recommended practice when
they first started. We should stop this, since it breaks so much of
officially documented vim behavior.

What we should be saying is "look at vimrc_example and copy the parts of
it you like [and understand] to your own .vimrc".

Admittedly this is my personal opinion, one I've never heard voiced on
this list before now, but I believe an opinion whose time has come.

--
_|_ _ __|_|_ ._ o|
|_(_)(_)|_| ||_)||<
|

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: