Skip to content

Commit 82a5781

Browse files
committed
Add TypeKeys() for testing indentation after keystrokes
1 parent 6a4a9e3 commit 82a5781

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

clj/src/vim_clojure_static/test.clj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,16 @@
138138
[string & opts]
139139
(let [{:keys [in out pre keys]} (apply hash-map opts)
140140
test-file (str "tmp/test-indent-" (string/replace string #"[^\w-]" "-") ".clj")
141-
vim-expr (format "IndentFile(%s)"
142-
(if keys
143-
(string/replace (pr-str keys) "\\\\" "\\")
144-
""))]
141+
vim-expr (if keys
142+
(format "TypeKeys(%s)" (string/replace (pr-str keys) "\\\\" "\\"))
143+
"IndentFile()")]
145144
`(with-transform-test ~string
146145
{:in ~in :out ~out}
147146
[tmp#]
148147
;; FIXME: Too much file IO
148+
(~io/make-parents ~test-file)
149149
(spit ~test-file "")
150-
(~vim-exec ~test-file (slurp tmp#) ~vim-expr :pre ~pre)
150+
(~vim-exec ~test-file (slurp tmp#) ~vim-expr ~@(when pre [:pre pre]))
151151
(spit tmp# (slurp ~test-file)))))
152152

153153
(defn benchmark [n file buf & exprs]

clj/vim/test-runtime.vim

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
execute 'set rtp=' . expand('%:p:h:h:h') . ',$VIMRUNTIME'
44
filetype plugin indent on
55
syntax on
6-
set synmaxcol=0
6+
set synmaxcol=0 backspace=2
77
setfiletype clojure
88

99
function! EDN(value)
@@ -20,8 +20,12 @@ function! ClojureSynIDNames()
2020
return EDN(names)
2121
endfunction
2222

23-
function! IndentFile(...)
24-
if a:0 | execute 'normal! ' . a:1 | endif
23+
function! TypeKeys(keys)
24+
execute 'normal! ' . a:keys
25+
write
26+
endfunction
27+
28+
function! IndentFile()
2529
normal! gg=G
2630
write
2731
endfunction

0 commit comments

Comments
 (0)