1

While in a terminal session I can do

:set textwidth=9999

And I receive what I want (which is lines of text which can go to the end of my computer screen)

I created a file called ~/.vimrc which contains the line

set textwidth=9999

And I get no results from from this

Skippy le Grand Gourou
  • 6,976
  • 4
  • 60
  • 76
Sam
  • 1,765
  • 11
  • 82
  • 176
  • 1
    After launching vim with this in your `.vimrc`, run `:verbose set textwidth`. This should tell you the current setting of `textwidth` as well as where it was set. – Randy Morris Nov 29 '16 at 19:08
  • @RandyMorris Are you saying I type ':verbose set textwidth' in my .vimrc file and this will make it longer? I want my textwidth to be permanently set to '9999' – Sam Nov 29 '16 at 19:11
  • No, I'm saying to run that manually after vim is open. This will tell us whether or not something is overriding your `.vimrc`. This isn't a fix, it's a debugging step. – Randy Morris Nov 29 '16 at 19:12
  • textwidth=78 Last set from /usr/share/vim/vimrc Press ENTER or type command to continue – Sam Nov 29 '16 at 19:15
  • Hmm, it looks like maybe your `.vimrc` isn't being read. Run `:scriptnames` (again, manually) and see if it is showing in the list of files that have been sourced. – Randy Morris Nov 29 '16 at 19:20
  • Do you use `evim` or `vim -y`? – romainl Nov 29 '16 at 19:21
  • @RandyMorris It's tenth on the list and theres about 24 after it under /usr/share/vim whereas mine is only under ~/.vimrc 10: ~/.vimrc 11: /usr/share/vim/vimfiles/plugin/syntastic/autoloclist.vim – Sam Nov 29 '16 at 19:23
  • This Q **may** be more appropriate on the S.E. related sites http://vi.stackexchange.com OR http://superuser.com . Use the `flag` link at the bottom of your Q and ask the moderator to move it. Please don't post the same Q on 2 different sites. Please read http://stackoverflow.com/help/how-to-ask http://stackoverflow.com/help/dont-ask and http://stackoverflow.com/help/mcve before posting more Qs here. Good luck – shellter Nov 29 '16 at 19:33
  • Also, to disable wrapping, use `set textwidth=0` -- https://vimhelp.appspot.com/options.txt.html#%27textwidth%27 – glenn jackman Nov 29 '16 at 20:31

1 Answers1

3

Your ~/.vimrc is loaded as the very first configuration (cp :help initialization); after that, other configuration and plugins are read, and any of those may change the option again. You can check with

:verbose set textwidth?

and get the list of configuration scripts via

:scriptnames

Ideally, you're able to disable the overriding of the option value. As a workaround, you can also re-initialize the option at the end of configuration, by putting the following into your ~/.vimrc:

autocmd VimEnter * set textwidth=9999

The 'textwidth' option is a buffer-local option. Filetype plugins may adapt this setting. There are ways to override filetype-specific settings (:help after-directory), too.

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324