Reputation: 11919
If I open a python file with vim, and set it to have a ruler and auto-line break with this command:
:set textwidth=109 colorcolumn=110
It works like a charm! However ... if I edit ~/.vimrc
and add this line at the bottom
autocmd FileType py set textwidth=109 colorcolumn=110
exit the python file, and open it again, nothing happens. Seems like something is overriding my setting, but can't figure out what is doing that (because I'm fairly new to vim). My basic vimrc file is this: https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim
Can someone point me in the right direction on what am I doing wrong?
Note: the same thing is happening for Javascript files when I try to "replace" Tabs with 2 spaces in indentation:
autocmd FileType js setlocal sw=2 sts=2 et
Upvotes: 3
Views: 889
Reputation: 3836
The issue is that the correct filetypes are python
and javascript
(or similar, like javascript.jsx
if you have additional syntax files), not py
and js
. You can check the filetype used for a file by :set ft?
.
Also, you may prefer setlocal
(to affect only the current buffer) instead of set
.
Upvotes: 7