oakes / Nightlight

An embedded editor for Clojure
https://sekao.net/nightlight/
The Unlicense
788 stars 35 forks source link

Lack of keyboard shortcuts #26

Closed hswick closed 7 years ago

hswick commented 7 years ago

Would be great if there were keyboard shortcuts for switching to recent files as it is in Nightcode, and key commands for eval forms as stated in issue #9.

Currently the only key command is tab for completion in cljs/nightlight/completions.cljs

(defn completion-shortcut? [e] (and (= 9 (.-keyCode e)) (not (.-shiftKey e)) (psd/get-completion-info) (some-> (psd/get-focused-top-level) (psd/get-cursor-position true) set count (= 1))))

(defn init-completions [path extension editor-atom elem] (when (c/completion-exts extension) (events/listen elem "keyup" (fn [e] (when (completion-shortcut? e) (when-let [comps (get-in @s/runtime-state [:completions path])] (when-let [info (psd/get-completion-info)] (select-completion @editor-atom info (:value (first comps))) (refresh-completions path extension))))))))

This is intuitive, but not documented.

hswick commented 7 years ago

Submitted pull request that adds key commands