I use Emacs as an editor. Of late whenever I use CUDA files (which usually have extensions .cu
) I have to manually do M-x c++-mode
to turn on syntax highlighting and other yasnippet features.
How do I do I ensure that all .cu
files when started in EMACS automatically borrow all the C++ mode features. In other words .cu
extension becomes an alias for .cpp
extension.
( I know there is a CUDA mode for EMACS, (not inbuilt) but when I installed this mode it does not turn on many of the useful features present in the C++-mode of emacs )
Putting this into your .emacs
should do the trick:
(add-to-list 'auto-mode-alist '("\\.cu\\'" . c++-mode))
Just in case people have missed it; there's a slightly more official cuda-mode
available: http://www.emacswiki.org/emacs/CudaMode
You need to put it somewhere in your load-path
; for example on my Mac, I put the code in $HOME/Library/emacs/cuda-mode.el
and added the following lines to my .emacs
file.
(add-to-list 'load-path "~/Library/emacs")
(autoload 'cuda-mode "cuda-mode.el")
(add-to-list 'auto-mode-alist '("\\.cu\\'" . cuda-mode))
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