Editing the Pacemaker configuration with VIM

For people using the VIM editor I’ve got two small tips when editing Pacemaker configurations:

Use syntax highlight. This helps to see unmatched quote characters easily. Whether it’s too colorful can be discussed, though ;)
A current version can be found here, and the mailing list post is here.

For correlating resource names I recommend the Mark plugin. I’ve put an additional mapping in my ~/.vimrc:

 nnoremap  <F4>   :call mark#MarkCurrentWord()

With this I just put the cursor on a resource name and press F4 – all occurrences of this word are highlighted, so it’s very easy to see where the name is used1. If I mark other words they get different colors, and with F4 the highlightning can be turned off again, too.

I think that for people looking at more-than-minimal Pacemaker configurations this helps to quickly get (and keep!) an overview.

  1. eg. groups, constraints, etc.

2 thoughts on “Editing the Pacemaker configuration with VIM

  1. Wouldn’t * achieve essentially the same result? Place the cursor on a word and type *. Vim will search foreword for the next occurrence of the word. Put set hlsearch in your .vimrc, and Vim will also hilight all occurrences of the term. If you don’t want the cursor to move, you could create a mapping something like:

    nmap * *N

    That will do the search and then return the cursor to the original location where you started the search.

    • Scott, you’re essentially right – “*” and “#” use the same basic VIM feature.

      The nice thing about this plugin is that you can have _multiple_ words highlighted, in different colors – so it’s easy to correlate the resource names in a group with (co- or -location) constraints etc.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

What is 2, multiplied by 8 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)