Plugin for the GNU EMACS editor

emacs screen shot for cp2k input

cp2k-mode.el provides a major mode in emacs for editing CP2K input files. It has been tested on emacs 21, 23 and 24.

Functionalities

Recognises and font-locks

Indents lines according to the CP2K input syntax using <tab> key

Input sections can be folded or unfolded, using emacs ''outline-minor-mode''

New interactive functions

Key Bindings

How to Obtain

You can download cp2k-mode.el from the CP2K Repository.

If you already have the code checked out locally, you can find it in:

cp2k/tools/input_editing/emacs/

Installation

You need to put cp2k-mode.el in one of your local emacs lisp directories, which is in the search path of your emacs installation.

Adding to emacs's search path

If you have never installed any packages manually before, and do not know the search path of your emacs installation, then in your home directory create directory:

~/.emacs.d/lisp/

This is the usual place where the local/user defined emacs lisp files are installed. Move cp2k-mode.el to ~/.emacs.d/lisp/

Then, add the following to your .emacs file (which should be in your home directory, and if it does not exist, create one):

(add-to-list 'load-path "~/.emacs.d/lisp/")

This tells emacs to add ~/.emacs.d/lisp/ to its search path for *.el files.

Tell emacs to load cp2k-mode.el at startup

Once cp2k-mode.el is in the search path, we need to tell emacs to load it at start up, this is done by adding

(require 'cp2k-mode nil 'noerror)

to your .emacs file.

Tell emacs to recognise *.inp automatically as a cp2k input file

Add

(add-to-list 'auto-mode-alist '("\\.inp\\'" . cp2k-mode))

to your .emacs file.