From 783f59758e7c7648de8d42134088f1ead76cfdf0 Mon Sep 17 00:00:00 2001 From: Brian Hicks Date: Tue, 17 Feb 2015 14:11:06 -0600 Subject: [PATCH] contrib(ansible): add layer --- contrib/ansible/README.md | 35 ++++++++++++++++++++++++++++ contrib/ansible/config.el | 16 +++++++++++++ contrib/ansible/funcs.el | 24 +++++++++++++++++++ contrib/ansible/img/ansible.png | Bin 0 -> 1530 bytes contrib/ansible/packages.el | 40 ++++++++++++++++++++++++++++++++ 5 files changed, 115 insertions(+) create mode 100644 contrib/ansible/README.md create mode 100644 contrib/ansible/config.el create mode 100644 contrib/ansible/funcs.el create mode 100644 contrib/ansible/img/ansible.png create mode 100644 contrib/ansible/packages.el diff --git a/contrib/ansible/README.md b/contrib/ansible/README.md new file mode 100644 index 000000000000..06b3f9e25556 --- /dev/null +++ b/contrib/ansible/README.md @@ -0,0 +1,35 @@ +# Ansible contribution layer for Spacemacs + +![ansible](img/ansible.png) + + +**Table of Contents** + +- [Ansible contribution layer for Spacemacs](#ansible-contribution-layer-for-spacemacs) + - [Description](#description) + - [Install](#install) + - [Key bindings](#key-bindings) + + + +## Description + +This layer add support for Ansible-flavored YAML buffers. + +## Install + +To use this contribution add it to your `~/.spacemacs` + +```elisp +(setq-default dotspacemacs-configuration-layers '(ansible) +"List of contribution to load." +) +``` + +## Key bindings + +Key Binding | Description +--------------|------------------------------------------------------------ +` m a ?` | looks up documentation using [`ansible-doc`][ansible-doc] + +[ansible-doc]: https://github.com/lunaryorn/ansible-doc.el diff --git a/contrib/ansible/config.el b/contrib/ansible/config.el new file mode 100644 index 000000000000..c703ae425f44 --- /dev/null +++ b/contrib/ansible/config.el @@ -0,0 +1,16 @@ +;;; funcs.el --- Ansible Layer extensions File for Spacemacs +;; +;; Copyright (c) 2012-2014 Sylvain Benner +;; Copyright (c) 2015 Brian Hicks & Contributors +;; +;; Author: Brian Hicks +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +;; detect filenames compatible with Ansible's recommended layout. +;; http://docs.ansible.com/playbooks_best_practices.html#directory-layout +(setq ansible/ansible-filename-re + "\\(site\.yml\\|roles/.+\.yml\\|group_vars/.+\\|host_vars/.+\\)") diff --git a/contrib/ansible/funcs.el b/contrib/ansible/funcs.el new file mode 100644 index 000000000000..5d88f89c8057 --- /dev/null +++ b/contrib/ansible/funcs.el @@ -0,0 +1,24 @@ +;;; funcs.el --- Ansible Layer extensions File for Spacemacs +;; +;; Copyright (c) 2012-2014 Sylvain Benner +;; Copyright (c) 2015 Brian Hicks & Contributors +;; +;; Author: Brian Hicks +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 +(defun ansible/ansible-should-enable? () + (and (stringp buffer-file-name) + (string-match ansible/ansible-filename-re buffer-file-name))) + +(defun ansible/ansible-maybe-enable () + (when (ansible/ansible-should-enable?) + (ansible 1))) + +(defun ansible/ansible-doc-maybe-enable () + (when (ansible/ansible-should-enable?) + (ansible-doc-mode 1) + (evil-leader/set-key-for-mode 'yaml-mode + "ma?" 'ansible-doc))) diff --git a/contrib/ansible/img/ansible.png b/contrib/ansible/img/ansible.png new file mode 100644 index 0000000000000000000000000000000000000000..3d12c5f2d7bf0ebf06e4ca3500ab2444e97a5f49 GIT binary patch literal 1530 zcmVgwt(DJuQ_{Z>;{K|Vh?G&S+@@ij3r{{H^_`~3Fy z_A4hSOGijUKtN1LNl;BqSXEYMHQxz5ea zhJ=OI*4BJ^dPqe^QcqC){QUU%_-ABgmz9;r#>QY>US(rrU0PfB_xG!*sl2+o=jP|# z-QDu?@}{Mwi;0Q#^!2T*tg*1Lv$C?cwYK8n;r8|Qa&K^)nwpc5k~}y$Mngo6i;P=X zS%rgyaBXh5x3^A9On!TOJ~}%^K|*+Sc7uU|-rnAchlgTcV3(GbetdnElar{Xr^3O( zKRi9$+uPvZ;OXe-k&lnHv$WLH)4jXAdU$x&)z!4Kv(nMhnU|PHL`AHttE8f$)zsAQ z@9(3bp-)Ur@bK{DWf5gMY(9h3lW@o>?zMq|)?Ck7!baj!BkaBQvp`W03b99f5 zjf{$mKRZ0g$H&0GzdAQK4UIS6000CvNkl?7(ij4*AQkbGcz+YE;BRp zUZ%f(XSdt5v14_Wp3m|`&sbJu8&c}`wZo)Tu716HQBHT?G|jYlN{ux{Vm8=`{Lt3u zqp-MYG0i{4-NmcsaSc}nQc@w)G+Ra4t(v|r#{xUnb@}Rxk0-3JHhl156(Bnzr)mY_ z;%;G|vSOa;L0;Tt%dfdo0S4R^MK6n#wR^(q2l{+i`+#{SYZO<7pJL&vds3G*W>a2M zi51=ltZ{!9*Uwj=qj54FZ*IG{x}EF%Syof)Q7ymOz_uo!9y@gE_#yE}ATv+yrpe z^WSR3>0)MNEDaJuDV)(QYa@uMGZ@@GlC1=$f5OC&s>1z>ah zr&*nke$+PA4P?_=tZ5+Ax%0C2d*jI;tZ)<#fLxtO8`wdAmec^InkAAPD*z-qs@UL@ z?ZC7SYr=wPvv()F0o)E`AaqY85334RvJbfKW_e+cW5C*yK1-4XaC$UY8^9y+vie|H z z=$R}D+HhD6D*&`W1j@mj@HUrFiYX?;T)R_ocrzaA^(b zGQ6zf-P6V0w~K85KyBQJ2kUN3Z4GZ39j;rL-UbLLSu$3E)o9@=-&ox#BR{Sl;(qp$ z8@MVMoyQwSsizjaRu gg3!%~Su>FSA2C+4gN$a76#xJL07*qoM6N<$f+bJ|E&u=k literal 0 HcmV?d00001 diff --git a/contrib/ansible/packages.el b/contrib/ansible/packages.el new file mode 100644 index 000000000000..c791ce0f10f8 --- /dev/null +++ b/contrib/ansible/packages.el @@ -0,0 +1,40 @@ +;;; extensions.el --- Ansible Layer extensions File for Spacemacs +;; +;; Copyright (c) 2012-2014 Sylvain Benner +;; Copyright (c) 2015 Brian Hicks & Contributors +;; +;; Author: Brian Hicks +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 +(defvar ansible-packages '(yaml-mode + ansible + ansible-doc)) + +(defun ansible/init-yaml-mode () + (use-package yaml-mode + :defer t)) + +(defun ansible/init-ansible () + (use-package ansible + :defer t + :init (progn + (eval-after-load 'yaml-mode + '(add-hook 'yaml-mode-hook 'ansible/ansible-maybe-enable)) + + ;; ansible-mode requires ac-user-dictionary-files. If the + ;; config is using company-mode this variable will not be + ;; set, so we set it to a dummy value. + ;; + ;; Tracking here: + ;; https://github.com/k1LoW/emacs-ansible/issues/2 + (when (member 'company-mode dotspacemacs-configuration-layers) + (setq ac-user-dictionary-files '()))))) + +(defun ansible/init-ansible-doc () + (use-package ansible-doc + :defer t + :init (eval-after-load 'yaml-mode + '(add-hook 'yaml-mode-hook 'ansible/ansible-doc-maybe-enable))))