Expand Ansible functionality
Doing a lot of Ansible for my day job lately, so now we can hook up the documentation directly, and use a poly-ansible to switch between Jinja and YAML syntax.
This commit is contained in:
parent
2b1bdb32a1
commit
5af60f7cf9
2 changed files with 28 additions and 4 deletions
|
@ -415,7 +415,6 @@ Here is a sequence diagram example to show how is looks/works:
|
||||||
#+begin_src plantuml :file ha-org-plantuml-example.png :exports file :results file
|
#+begin_src plantuml :file ha-org-plantuml-example.png :exports file :results file
|
||||||
@startuml
|
@startuml
|
||||||
!include https://raw.githubusercontent.com/ptrkcsk/one-dark-plantuml-theme/v1.0.0/theme.puml
|
!include https://raw.githubusercontent.com/ptrkcsk/one-dark-plantuml-theme/v1.0.0/theme.puml
|
||||||
' See details at https://plantuml.com/
|
|
||||||
' See details at https://plantuml.com/sequence-diagram
|
' See details at https://plantuml.com/sequence-diagram
|
||||||
Alice -> Bob: Authentication Request
|
Alice -> Bob: Authentication Request
|
||||||
Bob --> Alice: Authentication Response
|
Bob --> Alice: Authentication Response
|
||||||
|
|
|
@ -329,17 +329,42 @@ Using the [[https://github.com/seagle0128/doom-modeline][Doom Modeline]] to add
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* Languages
|
* Languages
|
||||||
Simple to configure languages go here. More advanced stuff will go in their own files… eventually.
|
Simple to configure languages go here. More advanced stuff will go in their own files… eventually.
|
||||||
** YAML and Jinja
|
** Ansible
|
||||||
Doing a lot of [[https://github.com/yoshiki/yaml-mode][YAML work]], but this project needs a new maintainer.
|
Doing a lot of [[https://github.com/yoshiki/yaml-mode][YAML work]], but this project needs a new maintainer.
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package yaml-mode
|
(use-package yaml-mode
|
||||||
:mode "\\.ya?ml\\'")
|
:mode (rx ".y" (optional "a") "ml" string-end))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
Ansible uses Jinja, so we install the [[https://github.com/paradoxxxzero/jinja2-mode][jinja2-mode]]:
|
Ansible uses Jinja, so we install the [[https://github.com/paradoxxxzero/jinja2-mode][jinja2-mode]]:
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package jinja2-mode
|
(use-package jinja2-mode
|
||||||
:mode (rx ".j2" eol))
|
:mode (rx ".j2" string-end))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
Do I consider all YAML files an Ansible file needing [[https://github.com/k1LoW/emacs-ansible][ansible-mode]]?
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package ansible
|
||||||
|
;; :hook (yaml-mode . ansible-mode)
|
||||||
|
:config
|
||||||
|
(ha-leader "t y" 'ansible))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
However, let’s have all YAML able to access Ansible’s documentation using the [[https://github.com/emacsorphanage/ansible-doc][ansible-doc]] project:
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package ansible-doc
|
||||||
|
:hook (yaml-mode . ansible-doc-mode)
|
||||||
|
:config
|
||||||
|
(ha-local-leader :keymaps 'yaml-mode-map
|
||||||
|
"d" '(:ignore t :which-key "docs")
|
||||||
|
"d d" 'ansible-doc))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
The [[https://github.com/emacsmirror/poly-ansible][poly-ansible]] project uses [[https://polymode.github.io/][polymode]], gluing [[https://github.com/paradoxxxzero/jinja2-mode][jinja2-mode]] into [[https://github.com/yoshiki/yaml-mode][yaml-mode]].
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package poly-ansible
|
||||||
|
:straight (:host github :repo "emacsmirror/poly-ansible")
|
||||||
|
:hook (yaml-mode . poly-ansible-mode))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Emacs Lisp
|
** Emacs Lisp
|
||||||
|
|
Loading…
Reference in a new issue