You are not logged in.
Today I noticed that vim is using tabs of width 4 instead of 2 spaces (as they are specified in my /etc/vimrc) when editing python files.
I tried to override this behavior by disabling plugins, adding "filetype off" to my /etc/vimrc, removing /etc/vimrc completely and setting tabstop, shiftwidth and expandtab inside vim while editing a python file but neither of them worked.
I don't have any ~/.vimrc or ~/.vim/vimrc which could have overridden /etc/vimrc.
$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 2 2016 05:21:06)
Included patches: 1-2143
[...]
How can I override this per-file-type indentation, so that the settings in my /etc/vimrc are used regardless of the file type?
Thank you in advance for any hints.
-vdrummer
PS: I'm using the gvim package
Last edited by vdrummer (2016-09-12 09:01:48)
Offline
You can create a file type plugin (ftplugin) in one of the following directories:
~/.vim/ftplugin
/usr/share/vim/vimfiles/ftplugin
For example, my ruby ftplugin.
/usr/share/vim/vimfiles/ftplugin/ruby.vim
" Vim filetype plugin file
" Language: ruby
" Last change: 2014-05-02
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
See :help ftplugins to read how to create these files.
Offline
@AbaddonOrmuz
Thank you, I will keep that in mind for when I want to make some language-specific settings. Actually I like the new behavior, except for the tab size, so I might do just that.
After updating vim today and merging the new
" do not load defaults if ~/.vimrc is missing
let skip_defaults_vim=1
into my /etc/vimrc, I was able to get my old behavior again. So I'll mark this thread as solved.
I'll consider moving my settings to ~/.vimrc though, as it seems to be intended that way.
Offline