Tuesday, 15 July 2014

Vim filetype settings not loading when creating a file -



Vim filetype settings not loading when creating a file -

i have defined several .vim files in ftplugin directory of languages work with. when opening files exist, settings in these files load correctly. however, when creating new file (i.e. running vim filename.py) corresponding settings not loaded until after save file (so exists on disk), close vim, , re-open it.

is there way vim load filetype setting ftplugin files vim creating?

a filetype python determined based on file extension (cp. $vimruntime/filetype.vim):

au bufnewfile,bufread *.py,*.pyw setf python

with bufnewfile, filetype applied newly created files, too. doesn't work filetypes detected inspecting buffer contents (e.g. shebang #!/bin/bash in first line), not based on file pattern. these, indeed necessary save (and re-edit) file, or :setf manually.

vim

No comments:

Post a Comment