Add vim example
This commit is contained in:
parent
566eff4b94
commit
f15d609b45
2 changed files with 21 additions and 0 deletions
|
|
@ -307,3 +307,7 @@ META-INF/maven/borkdude/sci/pom.xml
|
||||||
META-INF/leiningen/borkdude/sci/project.clj
|
META-INF/leiningen/borkdude/sci/project.clj
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Invoke vim inside a script
|
||||||
|
|
||||||
|
See [examples/vim.clj](../examples/vim.clj).
|
||||||
|
|
|
||||||
17
examples/vim.clj
Executable file
17
examples/vim.clj
Executable file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env bb
|
||||||
|
(require '[clojure.java.io :as io])
|
||||||
|
|
||||||
|
(defn vim [file]
|
||||||
|
(->
|
||||||
|
(ProcessBuilder. ["vim" file])
|
||||||
|
(.inheritIO)
|
||||||
|
(.start)
|
||||||
|
(.waitFor)))
|
||||||
|
|
||||||
|
(def readme
|
||||||
|
(let [f (io/file "README.md")]
|
||||||
|
(when (not (.exists f))
|
||||||
|
(vim (.getPath f)))
|
||||||
|
(slurp f)))
|
||||||
|
|
||||||
|
(println readme)
|
||||||
Loading…
Reference in a new issue