Here are 3 different ways you can do it: :set ft=python. The down side to this approach is that you can't add it to a keyboard shortcut since it will only work with one file type (python in this example) :w+:e The down side with this is that you have to save the file before running the command since it reloads the file. :filetype detect This is longer to type though. You could add the second or third option as a shortcut with map :filetype detect to your .vimrc to enable refreshing the file with ctrl+r Based on @KNejad's suggestion of using :filetype detect, here is a config setting to automatically trigger the detection when a new file with is written: init.vim / .vimrc: au BufWritePost * if &syntax == '' | :filetype detect | endif