CMake Editors Support: Difference between revisions
From KitwarePublic
Jump to navigationJump to search
(Add links to Emacs and VIM modes) |
(Add more information about VIM, Emacs, and adding new) |
||
Line 1: | Line 1: | ||
==CMake Editor Modes== | |||
There are [[CMake]] syntax highlighting and indentation supports for several editors: | |||
* VIM [http://www.cmake.org/CMakeDocs/cmake-syntax.vim syntax highlighting] and [http://www.cmake.org/CMakeDocs/cmake-indent.vim indentation mode] | * Emacs [http://www.cmake.org/CMakeDocs/cmake-mode.el combined syntax highlighting and indentation mode]. To enable it, add the following to your ''.emacs'' file: | ||
<pre> | |||
; Add cmake listfile names to the mode list. | |||
(setq auto-mode-alist | |||
(append | |||
'(("CMakeLists\\.txt\\'" . cmake-mode)) | |||
'(("\\.cmake\\'" . cmake-mode)) | |||
auto-mode-alist)) | |||
(autoload 'cmake-mode "~/CMake/Docs/cmake-mode.el" t) | |||
</pre> | |||
* VIM [http://www.cmake.org/CMakeDocs/cmake-syntax.vim syntax highlighting] and [http://www.cmake.org/CMakeDocs/cmake-indent.vim indentation mode]. To enable indentation, copy indentation file to your .vim/indent directory, syntax highlighting file to your .vim/syntax directory and add the following to your .vimrc: | |||
<pre> | |||
:autocmd BufRead,BufNewFile *.cmake,CMakeLists.txt,*.cmake.in runtime! indent/cmake.vim | |||
:autocmd BufRead,BufNewFile *.cmake,CMakeLists.txt,*.cmake.in setf cmake | |||
</pre> | |||
==Creating New Editor Mode== | |||
The best way to start is to check the logic in existing ones. Make sure to enable indentation for files that match the following file names: | |||
* CMakeLists.txt | |||
* *.cmake | |||
* *.cmake.in | |||
* *.ctest | |||
* *.ctest.in |
Revision as of 12:11, 5 October 2004
CMake Editor Modes
There are CMake syntax highlighting and indentation supports for several editors:
- Emacs combined syntax highlighting and indentation mode. To enable it, add the following to your .emacs file:
; Add cmake listfile names to the mode list. (setq auto-mode-alist (append '(("CMakeLists\\.txt\\'" . cmake-mode)) '(("\\.cmake\\'" . cmake-mode)) auto-mode-alist)) (autoload 'cmake-mode "~/CMake/Docs/cmake-mode.el" t)
- VIM syntax highlighting and indentation mode. To enable indentation, copy indentation file to your .vim/indent directory, syntax highlighting file to your .vim/syntax directory and add the following to your .vimrc:
:autocmd BufRead,BufNewFile *.cmake,CMakeLists.txt,*.cmake.in runtime! indent/cmake.vim :autocmd BufRead,BufNewFile *.cmake,CMakeLists.txt,*.cmake.in setf cmake
Creating New Editor Mode
The best way to start is to check the logic in existing ones. Make sure to enable indentation for files that match the following file names:
- CMakeLists.txt
- *.cmake
- *.cmake.in
- *.ctest
- *.ctest.in