unixvimcommand-linetext-width

vimrc file won't apply textwidth settings


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


Solution

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