You are not logged in.

#1 2013-12-11 00:36:27

cookyt
Member
Registered: 2013-12-11
Posts: 1

Vim global python indentation settings overriding local

The latest vim-runtime package updates the file /usr/share/vim/vim74/ftplugin/python.vim to provide PEP8-style indentation for Python files, but it overrides my local settings in ~/.vimrc. It's rather annoying as most of the code I work with uses a shiftwidth of 2, and I have to manually set the shiftwidth every time I open a python file. Few questions:

  1. Where can I override this setting locally? Running :scriptnames shows that .vimrc gets loaded long before the aforementioned file is loaded, so what I do?

  2. Is my load order messed up somehow? It doesn't make sense to me that my local configs should be loaded before the system-wide scripts.

  3. Keeping a seperate config file just to properly set the shiftwidth for python files seems like overkill when I should just be able to set it in my vimrc. Should I file a bug report with the maintainer of the file? I'm sorry if it's stupid of me to ask this, but I don't usually complain about this sort of thing.

Output of :scriptnames (EDIT: initially posted the command run on a non-python file)

  1: /etc/vimrc
  2: /usr/share/vim/vimfiles/archlinux.vim
  3: ~/.vimrc
  4: /usr/share/vim/vim74/ftoff.vim
  5: ~/.vim/bundle/vundle/autoload/vundle.vim
  6: ~/.vim/bundle/vundle/autoload/vundle/config.vim
  7: /usr/share/vim/vim74/filetype.vim
  8: /usr/share/vim/vimfiles/ftdetect/conkyrc.vim
  9: /usr/share/vim/vim74/ftplugin.vim
 10: /usr/share/vim/vim74/indent.vim
 11: ~/.vim/colors/nocturne.vim
 12: /usr/share/vim/vim74/syntax/syntax.vim
 13: /usr/share/vim/vim74/syntax/synload.vim
 14: /usr/share/vim/vim74/syntax/syncolor.vim
 15: ~/.vim/bundle/CSApprox/plugin/CSApprox.vim
 16: ~/.vim/plugin/TagHighlight.vim
 17: ~/.vim/autoload/TagHighlight/LoadDataFile.vim
 18: ~/.vim/plugin/conque_term.vim
 19: ~/.vim/plugin/matchit.vim
 20: ~/.vim/plugin/supertab.vim
 21: ~/.vim/plugin/taglist.vim
 22: ~/.vim/plugin/tcomment.vim
 23: /usr/share/vim/vim74/plugin/getscriptPlugin.vim
 24: /usr/share/vim/vim74/plugin/gzip.vim
 25: /usr/share/vim/vim74/plugin/matchparen.vim
 26: /usr/share/vim/vim74/plugin/netrwPlugin.vim
 27: /usr/share/vim/vim74/plugin/rrhelper.vim
 28: /usr/share/vim/vim74/plugin/spellfile.vim
 29: /usr/share/vim/vim74/plugin/tarPlugin.vim
 30: /usr/share/vim/vim74/plugin/tohtml.vim
 31: /usr/share/vim/vim74/plugin/vimballPlugin.vim
 32: /usr/share/vim/vim74/plugin/zipPlugin.vim
 33: ~/.vim/bundle/CSApprox/after/plugin/CSApprox.vim
 34: ~/.vim/bundle/CSApprox/autoload/csapprox/per_component.vim
 35: ~/.vim/bundle/CSApprox/autoload/csapprox/common.vim
 36: ~/.vim/ftplugin/python.vim
 37: /usr/share/vim/vim74/ftplugin/python.vim  **** This file overrides python indentation settings
 38: /usr/share/vim/vim74/indent/python.vim
 39: /usr/share/vim/vim74/syntax/python.vim
 40: ~/.vim/autoload/TagHighlight/ReadTypes.vim
 41: ~/.vim/autoload/TagHighlight/Option.vim
 42: ~/.vim/autoload/TagHighlight/Debug.vim
 43: ~/.vim/autoload/TagHighlight/Find.vim
 44: ~/.vim/autoload/TagHighlight/Libraries.vim
 45: /usr/share/vim/vim74/ftplugin/vim.vim
 46: /usr/share/vim/vim74/indent/vim.vim
 47: /usr/share/vim/vim74/syntax/vim.vim
 48: /usr/share/vim/vim74/syntax/perl.vim
 49: /usr/share/vim/vim74/syntax/pod.vim

vim-runtime version info

Name           : vim-runtime
Version        : 7.4.86-1
Description    : Runtime for vim and gvim
Architecture   : x86_64
URL            : http://www.vim.org
Licenses       : custom:vim
Groups         : None
Provides       : None
Depends On     : perl  gawk
Optional Deps  : None
Required By    : vim
Optional For   : None
Conflicts With : None
Replaces       : None
Installed Size : 25077.00 KiB
Packager       : Thomas Dziedzic <gostrc@gmail.com>
Build Date     : Sun 10 Nov 2013 11:26:25 PM EST
Install Date   : Tue 10 Dec 2013 05:53:03 PM EST
Install Reason : Installed as a dependency for another package
Install Script : No
Validated By   : SHA256 Sum

Last edited by cookyt (2013-12-11 00:50:17)

Offline

#2 2013-12-11 10:48:26

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,302

Re: Vim global python indentation settings overriding local

You have a way to prevent the use of the python.vim plugin :
http://vimdoc.sourceforge.net/htmldoc/usr_41.html#41.12
See the DISABLING part.

Offline

#3 2014-08-03 15:47:11

wryfi
Member
Registered: 2014-08-03
Posts: 9

Re: Vim global python indentation settings overriding local

I have the same problem as cookyt, and disabling python.vim altogether doesn't seem like the right solution, as that file does provide other useful functionality.

I personally don't appreciate package maintainers forcing their tabstop settings down my throat.

Offline

#4 2014-08-03 15:51:32

wryfi
Member
Registered: 2014-08-03
Posts: 9

Re: Vim global python indentation settings overriding local

Ah, reading a little further into the link provided by berbae, it is possible to override the global ftplugin tabstop:

If you do want to use the default plugin, but overrule one of the settings,
you can write the different setting in a script:

	setlocal textwidth=70

Now write this in the "after" directory, so that it gets sourced after the
distributed "vim.vim" ftplugin |after-directory|.  For Unix this would be
"~/.vim/after/ftplugin/vim.vim".  Note that the default plugin will have set
"b:did_ftplugin", but it is ignored here.

Offline

#5 2014-08-03 15:53:19

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Vim global python indentation settings overriding local

cookyt wrote:

[*]Where can I override this setting locally? Running :scriptnames shows that .vimrc gets loaded long before the aforementioned file is loaded, so what I do?[/*]

~/.vim/after/ftplugin/python.vim

EDIT: I see you just got to the same result above.

Last edited by Trilby (2014-08-03 15:53:56)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB