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 used[1. eg. groups, constraints, etc.]. 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.

2 replies
  1. Scott
    Scott says:

    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.

    Reply
    • Flip
      Flip says:

      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.

      Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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