Search code examples
vimcudasyntax-highlightingvim-syntax-highlighting

How to enable syntax highlighting for CUDA .cu and .cuh files in Vim?


I found that my ~/.vimrc file has syntax on but it didn't work for any CUDA file (.cu).

Not sure to how to do it.


Solution

  • Add these two lines to ~/.vimrc:

    au BufNewFile,BufRead *.cu set ft=cuda
    au BufNewFile,BufRead *.cuh set ft=cuda
    

    And put cuda.vim in ~/.vim/syntax/

    Have fun!