wander95
wander95

Reputation: 1366

How can I set colorcolumn=6 only for fortran files in vim?

Background:

In the old Fortran style, the 6th column is for continuation and 72 is for the last column. I currently have set colorcolumn=6 in my vimrc file. But it also makes other files such as python or text files with the 6th column highlighted.

How can I:

 if filetype = 'fortran'
     set colorcolumn =6, 72

ie highlight both the 6th and 72nd columns if the filetype is fortran

Upvotes: 4

Views: 1278

Answers (1)

Explosion Pills
Explosion Pills

Reputation: 191789

autocmd FileType fortran set colorcolumn=6,72

autocmd FileType <file type> will run the given commands when the file type is set / you open a file of the given type.

Upvotes: 3

Related Questions