On 10 Apr, Gary Johnson wrote: > On 2011-04-10, Tomasz Moskal wrote: >> Hey,
>> I seems to have a small issue with text width when filetype plugin is >> loaded. Let me explain: >> I'm reading now 'Zsh Guide' and use vim for taking notes and everything >> is working as it should when I stick to notes in plain English. As soon >> as I include any example of code vim is loading zsh/sh plugins. I would >> not mind this if it wouldn't be for text width; I got 'set textwidth=78' >> in vimrc but as soon as those plugins are loaded this value is not >> respected any more. I would like to keep filetype plugins in my vimrc as >> indentation/syntax features they provide are more than useful but how to >> force them to obey 'set textwidth'? >> I'm using vim 7.3 and my (unimpressive) vimrc look like so: >> set nocompatible >> set nomodeline >> set textwidth=78 >> set autoindent >> set tabstop=8 >> set shiftwidth=8 >> set ruler >> autocmd BufRead /usr/home/moloch/.mutt/temp/mutt* :source >> ~/.vim/mail.vim >> map <F9> :w!<CR>:!aspell --lang=en_GB -c --dont-backup %<CR>:e! %<CR> >> filetype on >> filetype plugin on >> filetype indent on >> colo desert >> syntax on >> set ofu=syntaxcomplete#Complete >> I'm still very much reading through 'Vim Manual' so any help on above >> matter is appreciated. > The solution will depend on how and where 'textwidth' is being set. > I don't see where 'tw' or 'textwidth' is being set in either the > sh.vim or zsh.vim ftplugins. It's also odd that you say that > 'textwidth' is changed "as soon as I include any example of code." > Vim normally triggers filetype detection when files are read into a > new buffer, not when they are read or copied into an existing > buffer. > You can find out where 'textwidth' is being set by executing > :verbose set tw? > Let us know the answer and we can proceed from there. > Regards, > Gary Solved! Well sort of... Thanks for the tip with ':verbose set tw' - now I know what is happening. Culprit wasn't neither 'sh' nor 'zsh' plugin but 'acp'. And I wasn't exactly correct with assumption that it's happening "as soon as I include any example of code." Here is what was happening: The file I was putting my notes in was called 'zsh_guide' and by including word 'zsh' I triggered acp plugin. Text width was taken from the acp the whole time - I simply didn't notice it till later in the text as after first few lines I used manual break. I wouldn't figure it out without ':verbose set tw' which gave me 'Last set from ~/.vim/autoload/acp.vim'. Solution for me will be to modify acp code to desired width but that, at least for the time being, is beyond me. So I will stick to not including 'zsh' in the the file name. Thanks! -- Tomasz Moskal -- 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