Last active
September 27, 2019 22:04
-
-
Save ClashTheBunny/cd79a700f75e43e95157f51691959cf3 to your computer and use it in GitHub Desktop.
Revisions
-
ClashTheBunny revised this gist
Sep 27, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ augroup YAML au! au BufReadPost *.yaml %!yaml2edn au BufReadPost *.yaml set ft=clojure au BufWritePre *.yaml %!edn2yaml au BufWritePost *.yaml %!yaml2edn au BufWritePost *.yaml set nomod augroup END -
ClashTheBunny revised this gist
Sep 27, 2019 . 1 changed file with 7 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,19 @@ # So you want to edit yaml in a structured way? * First, install lumo and js-yaml globally and set your NODE_PATH: ``` yarn global add lumo-cljs js-yaml export NODE_PATH=~/.config/yarn/global/node_modules ``` * Put `yaml2edn` and `edn2yaml` in your path. ``` chmod a+x edn2yaml yaml2edn sudo cp yaml2edn edn2yaml /usr/local/bin/ ``` * Append `.vimrc_local` to your `.vimrc_local` if you have one, or copy it to your homedir: ``` [[ -f ~/.vimrc_local ]] && cat .vimrc_local >> ~/.vimrc_local || cp .vimrc_local ~/ ``` `vim bla.yaml` and experience editing data in a structural way. No t-square required. -
ClashTheBunny revised this gist
Sep 27, 2019 . 1 changed file with 9 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,15 @@ # So you want to edit yaml in a structured way? * First, install lumo and js-yaml globally and set your NODE_PATH: ```yarn global add lumo-cljs js-yaml``` ```export NODE_PATH=~/.config/yarn/global/node_modules``` * Put `yaml2edn` and `edn2yaml` in your path. ``` chmod a+x edn2yaml yaml2edn sudo cp yaml2edn edn2yaml /usr/local/bin/ ``` * Append `.vimrc_local` to your `.vimrc_local` if you have one, or copy it to your homedir: ```[[ -f ~/.vimrc_local ]] && cat .vimrc_local >> ~/.vimrc_local || cp .vimrc_local ~/``` `vim bla.yaml` and experience editing data in a structural way. No t-square required. -
ClashTheBunny created this gist
Sep 27, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ augroup YAML au! au BufReadPost *.yaml %!yaml2edn au BufReadPost *.yaml set ft=edn au BufWritePre *.yaml %!edn2yaml au BufWritePost *.yaml %!yaml2edn au BufWritePost *.yaml set nomod augroup END This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ MIT License Copyright (c) 2019 Randall Mason Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ # So you want to edit yaml in a structured way? * First, install lumo and js-yaml globally and set your NODE_PATH: `yarn global add lumo-cljs js-yaml` `export NODE_PATH=~/.config/yarn/global/node_modules` * Put `yaml2edn` and `edn2yaml` in your path. ``` sudo cp yaml2edn edn2yaml /usr/local/bin/ ``` * Append `.vimrc_local` to your `.vimrc_local` if you have one, or move it to your homedir: `[[ -f ~/.vimrc_local ]] && cat .vimrc_local >> ~/.vimrc_local || cp .vimrc_local ~/` `vim bla.yaml` and experience editing data in a structural way. No t-square required. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ #!/usr/bin/env lumo (ns edn2yaml.core (:require [cljs.pprint :refer [pprint]] [cljs.reader :refer [read-string]])) (def yaml (js/require "js-yaml")) (js/require "process") (.setEncoding js/process.stdin "utf8") (.on js/process.stdin "data" (fn [data] (println (.safeDump yaml (clj->js (read-string data)))))) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ #!/usr/bin/env lumo (ns yaml2edn.core (:require [cljs.pprint :refer [pprint]])) (def yaml (js/require "js-yaml")) (js/require "process") (.setEncoding js/process.stdin "utf8") (.on js/process.stdin "data" (fn [data] (pprint (js->clj (.safeLoad yaml data)))))