I got inspired by ini-generic-mode today.

(define-generic-mode inventory-generic-mode
  '(?#)
  nil
  '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face)
    ("^\\([^=\n\r]*\\)=\\([^\n\r]*\\)$"
     (1 font-lock-function-name-face)
     (2 font-lock-variable-name-face)))
  '("inventory")
  (list
   (function
    (lambda ()
      (setq imenu-generic-expression
   '((nil "^\\[\\(.*\\)\\]" 1)
     ("*Variables*" "^\\s-*\\([^=]+\\)\\s-*=" 1))))))
  "Generic mode for Ansible inventory files.")

(add-to-list 'generic-extras-enable-list 'inventory-generic-mode t)

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to