sponsor Vim development Vim logo Vim Book Ad

openvpn : OpenVPN configuration syntax highlighter

 script karma  Rating 8/6, Downloaded by 1449  Comments, bugs, improvements  Vim wiki

created by
Eric Haarbauer
script type
This vim syntax script highlights configuration files used with James
Yonan's OpenVPN application (http://openvpn.net).


  * Highlights options, comment lines, and arguments
  * Recognizes quoted strings and escaped characters (e.g. \\, \")
  * Flags arguments given for options that take no arguments
  * Special highlighting for route and server command arguments

Reporting Issues:

  If you discover an OpenVPN file that this script highlights incorrectly,
  please email the author (address at the top of the file) with the
  following information:

    * The release version of this script (see top of the file)
    * If possible, a patch to fix the problem

Design Notes:

  Part of this script is autogenerated from the output of openvpn --help.
  The source code for generating the script is available from the author on
  request (see email address at the top of the script).  The script should
  build from source on most Linux systems with openvpn installed.

  The build system that generates this script strips special CVS tokens
  (like "Id:") so that CVS no longer recognizes them.  This allows users to
  place this script in their own version control system without losing
  information.  The author encourages other vim script developers to adopt a
  similar approach in their own scripts.
install details
  Put this file in your user runtime syntax directory, usually ~/.vim/syntax
  in *NIX or C:\Program Files\vim\vimfiles\syntax in Windows.  (Type "h
  syn-files" from within vim for more information.)

  Setting up automatic filetype definition requires some knowledge about
  your system.  The OpenVPN application itself does not require a naming
  standard for configuration files, although most distribution packages use
  a .conf suffix.  However, the .conf suffix is also used by many other
  applications with different syntaxes, so one cannot determine filetype by
  filename alone.

  One way to overcome this ambiguity is to incorporate the directory name
  into the recognition process.  For example, adding the following lines to
  the filetype.vim file in the user runtime directory should work for many
  *NIX systems:
      au BufNewFile,BufRead *openvpn*/*.conf setfiletype openvpn |
                                          \  set commentstring=#%s

  On the Fedora Core Linux distribution, this technique recognizes
  configuration files in /etc/openvpn and
  /usr/share/doc/openvpn-X.X.X/sample-config-files.  Setting the
  commentstring option in the second line allows Meikel Brandmeyer's
  EnhancedCommentify script (vimscript #23) to work with openvpn files.
  (Advanced users may want to set the commentstring option in an ftplugin
  file or in autocommands defined in .vimrc.)
  If filename- and directory-based recognition is impractical, the easiest
  alternative is to embed the following modeline in your OpenVPN
  configuration files:

      # vim:ft=openvpn:

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
openvpn.tar.bz2 1.11 2014-06-08 7.0 Eric Haarbauer Upgraded to OpenVPN 2.3.2.
openvpn.tar.bz2 1.10 2010-03-27 7.0 Eric Haarbauer Upgraded to openvpn 2.1.1.
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Vim at Github