Hi,

On Tue, Nov 15, 2011 at 11:47 AM, Raoul Bhatia [IPAX] <r.bha...@ipax.at> wrote:
> hi!
>
> On 2011-08-19 16:28, Dan Frincu wrote:
>>
>> Hi,
>>
>> On Thu, Aug 18, 2011 at 5:53 PM, Digimer<li...@alteeve.com>  wrote:
>>>
>>> On 08/18/2011 10:39 AM, Trevor Hemsley wrote:
>>>>
>>>> Hi all
>>>>
>>>> I have attached a first stab at a vim syntax highlighting file for 'crm
>>>> configure edit'
>>>>
>>>> To activate this, I have added 'filetype plugin on' to my /root/.vimrc
>>>> then created /root/.vim/{ftdetect,ftplugin}/pcmk.vim
>>>>
>>>> In /root/.vim/ftdetect/pcmk.vim I have the following content
>>>>
>>>> au BufNewFile,BufRead /tmp/tmp* set filetype=pcmk
>>>>
>>>> but there may be a better way to make this happen. /root/.vim/pcmk.vim
>>>> is the attached file.
>>>>
>>>> Comments (not too nasty please!) welcome.
>>
>> I've added a couple of extra keywords to the file, to cover a couple
>> more use cases. Other than that, great job.
>
> will this addition make it into some package(s)?
> would it be right to ship this vim syntax file with crm?

In the hope it will be a part of crm, I've written a patch for this.
Applying the patch over cibconfig.py and utils.py on Pacemaker 1.1.5
and adding the pcmk.vim file to the vim syntax folder (for Debian
Squeeze it's /usr/share/vim/vim72/syntax) gives access to syntax
highlighting in crm configure edit, if using vi/vim as editor.

Original work on pcmk.vim by Trevor Hemsley <thems...@voiceflex.com>,
a couple of additions by me.

Please review it and and add a Signed-Off line if it's ok.

Regards,
Dan

p.s.: many thanks to everyone for the input received on IRC.

>
> thanks,
> raoul
> --
> ____________________________________________________________________
> DI (FH) Raoul Bhatia M.Sc.          email.          r.bha...@ipax.at
> Technischer Leiter
>
> IPAX - Aloy Bhatia Hava OG          web.          http://www.ipax.at
> Barawitzkagasse 10/2/2/11           email.            off...@ipax.at
> 1190 Wien                           tel.               +43 1 3670030
> FN 277995t HG Wien                  fax.            +43 1 3670030 15
> ____________________________________________________________________
>



-- 
Dan Frincu
CCNA, RHCE
From d3ab2ab159137b271382db8d0edeef6d69325894 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Fr=C3=AEncu?= <df.clus...@gmail.com>
Date: Tue, 22 Nov 2011 18:50:10 +0200
Subject: [PATCH][BUILD] Low: extra: Add syntax highlighting for crm configure edit
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit


Signed-off-by: Dan Frîncu <df.clus...@gmail.com>
---
 shell/modules/cibconfig.py |    1 +
 shell/modules/utils.py     |    7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/shell/modules/cibconfig.py b/shell/modules/cibconfig.py
index 9cc9751..49b4b51 100644
--- a/shell/modules/cibconfig.py
+++ b/shell/modules/cibconfig.py
@@ -128,6 +128,7 @@ class CibObjectSet(object):
             except IOError, msg:
                 common_err(msg)
                 break
+            s += "\n# vim: set filetype=.pcmk :\n"
             s = ''.join(f)
             f.close()
             if hash(s) == filehash: # file unchanged
diff --git a/shell/modules/utils.py b/shell/modules/utils.py
index b57aa54..00013c6 100644
--- a/shell/modules/utils.py
+++ b/shell/modules/utils.py
@@ -158,7 +158,7 @@ def str2tmp(s):
     Write the given string to a temporary file. Return the name
     of the file.
     '''
-    fd,tmp = mkstemp()
+    fd,tmp = mkstemp(suffix=".pcmk")
     try: f = os.fdopen(fd,"w")
     except IOError, msg:
         common_err(msg)
@@ -317,7 +317,10 @@ def edit_file(fname):
         return
     if not user_prefs.editor:
         return
-    return ext_cmd("%s %s" % (user_prefs.editor,fname))
+    if user_prefs.editor == "vim" or user_prefs.editor == "vi":
+        return ext_cmd("%s %s -u /usr/share/vim/vim72/syntax/pcmk.vim" % (user_prefs.editor,fname))
+    else:
+        return ext_cmd("%s %s" % (user_prefs.editor,fname))
 
 def page_string(s):
     'Write string through a pager.'
-- 
1.7.0.4

Attachment: pcmk.vim
Description: Binary data

_______________________________________________
Pacemaker mailing list: Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org

Reply via email to