.vimrc file not working as expected

Vini.g.fer

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
Kirill Bulygin

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.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Where is my .vimrc file?

分類Dev

What is the <leader> in a .vimrc file?

分類Dev

vimrc settings not working on git bash running in ConsoleZ

分類Dev

Vim change colorscheme and vimrc location file

分類Dev

AJAX call is not working as expected

分類Dev

jQuery .when().then() not working as expected

分類Dev

*ngIf not working as expected with observable

分類Dev

ItemIsAutoTristate flag not working as expected

分類Dev

KeyboardAvoidingView not working as expected on IOS

分類Dev

PowerShell variables not working as expected

分類Dev

XPath logical 'and' not working as expected?

分類Dev

CancellationTokenSource not working as expected on a TaskCompletionSource

分類Dev

string formatting not working as expected

分類Dev

Why is .on() Not working as expected in jquery?

分類Dev

Tuples in Scala not working as expected

分類Dev

strpos() not working as expected

分類Dev

PHP Dateformat not working as expected

分類Dev

Update not working as expected

分類Dev

ifelse not working as expected in R

分類Dev

$("#form").submit(); is not working as expected

分類Dev

Prototype is not working as expected

分類Dev

LIKE and Equals not working as expected

分類Dev

Regex is not working as expected in javascript

分類Dev

angularjs service not working as expected

分類Dev

NSTask not working as expected / hoped for

分類Dev

Routing not working as expected in CodeIgniter

分類Dev

mhddfs not working as expected

分類Dev

Python: If...and... not working as expected

分類Dev

timeout for ngShow not working as expected