Thursday, October 24, 2013

Re: Disabling text wrap on GVim 7.4

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?

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.

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

augroup vimrcEx
au!
augroup END

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

HTH,
Gary

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