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.
After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.
Syntax highlighting is nothing but a feature of vi/vim text editors that displays text, especially source code, in different colors and fonts according to the category of terms. The following instructions show you how to enable or disable syntax colors for VI/VIM text editor running on a Linux or Unix-like system.
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!
Sounds like you might be missing the syntax highlighting file for vim. You should check your /usr/share/vim/vim70/syntax
directory for cuda.vim
. That directory will vary depending on your system and version of vim.
If your version of vim does not come with cuda.vim
, you can download this cuda.vim file and place it in ~/.vim/syntax/.
Update: add the following lines in your ~/.vimrc
as @BenjiWiebe recommended:
au BufNewFile,BufRead *.cu set filetype=cuda
au BufNewFile,BufRead *.cuh set filetype=cuda
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With