4

I'm using macvim with the janus plugin that includes nerdtree with it.

The issue that I am having is that whenever I open a file using 'o' from the nerdtree file browser, for some reason it resets the textwidth to 79 in the new buffer that the file is opened into.

I can override this back to 0 in the new buffer and vim will behave correctly, but whenever I switch files, the textwidth gets set back to 79.

I have textwidth set to 0 in my .vimrc file and this is correctly picked up by other files opened in vim, the file browser tab in nerdtree and even the initial empty buffer that is opened when I do 'mvim dir'. It's just when I use 'o' to open a file that this vim variable gets reset.

Does anyone know how to address this? I'm seeing the same behavior in gvim with the janus plugin as well.

chuck taylor
  • 2,476
  • 5
  • 29
  • 46
  • 4
    Not sure if it comes from NERDTree. Try the following, once the new file is opened (with `tw` set to 79) run `:verb set tw` and post the results. This will help identifying who might be responsible for changing it. – sidyll Sep 14 '11 at 20:05
  • How are you setting the textwidth in .vimrc? Is it only overridden by NERDTree for certain filetypes or all? – sarumont Nov 16 '11 at 05:09
  • 1
    Could it be that you're opening Python files? Janus forces PEP8 on ft=python https://github.com/carlhuda/janus/blob/master/janus/vim/core/before/plugin/filetypes.vim#L38 – Steve McKinney Feb 12 '12 at 16:50
  • @Steve- You're correct that this is what is going on. Adding this line to the .vimrc.after fixed it: autocmd FileType python setlocal expandtab shiftwidth=4 softtabstop=4 textwidth=0 – chuck taylor Feb 14 '12 at 23:35
  • 2
    Steve McKinney, you should put that as an answer so others can see the question got answered. – docwhat Mar 02 '12 at 05:42
  • @SteveMcKinney: Could you please post your comment as an answer, so the question would be answered? – ib. Mar 06 '12 at 03:17

1 Answers1

1

Could it be that you're opening Python files?

Janus forces PEP8 on ft=python https://github.com/carlhuda/janus/blob/f09d7d383282074ea5477ce7f4f4e2141887a4a7/janus/vim/core/before/plugin/filetypes.vim#L38

Janus should be using setlocal instead of set

Steve McKinney
  • 3,183
  • 1
  • 23
  • 26