Can I change to Vim default key bindings for movement ? hjkl?
It looks like you should be able to change those by calling dk.salza.liq.apps.textapp/set-navigation-key
in your local customization... but bear in mind h
is bound to run macro by default...
You'll probably want to change J
as well for consistency?
@seancorfield Cool. I'll give it a spin now. Yes, J too.
@smnplk Here's my .liq
file with hjkl set -- and i
for insert/`esc` to leave insert mode
(require '[dk.salza.liq.apps.textapp :as textapp]
'[dk.salza.liq.editor :as editor])
(textapp/set-navigation-key "h" editor/backward-char)
(textapp/set-navigation-key "j" editor/forward-line)
(textapp/set-navigation-key "k" editor/backward-line)
(textapp/set-navigation-key "l" editor/forward-char)
(textapp/set-navigation-key "^" editor/beginning-of-line)
(textapp/set-navigation-key "i" #(editor/set-keymap @textapp/keymap-insert))
(textapp/set-insert-key "\t" #(editor/insert "\t"))
(textapp/set-insert-key "esc" #(editor/set-keymap @textapp/keymap-navigation))
;; update all existing buffers, ending up on the current buffer again
(doseq [buffer (reverse (editor/buffer-names))]
(editor/switch-to-buffer buffer)
(editor/set-keymap @textapp/keymap-navigation))
(editor/set-default-keymap @textapp/keymap-navigation)
The doseq
piece is needed because there are a few buffers already created at startup before your .liq
file is loaded.
This leaves J
as beginning of line and overwrites h
for run-macro
so ... ¯\(ツ)/¯
Hi. Just a tip: The .liq file is not very flexible. You should consider switching to an approcach similar to https://github.com/mogenslund/liquid-starter-kit, that is, load Liquid through a custom clj project. It is a bit more complex to understand, but it allows loading extensions and libraries through deps.edn. I use this approach to integrate with third party libraries like Selenium, to do automated testing from Liquid, JDBC to do SQL queries from Liquid. I also use it to integrate with some of my other local non-liquid projects. This way extensions to Liquid can be loaded directly from Github! I do not need to create a package manager. Clj+Github+Maven+Clojars+Local is the package manager!
Just wanted to stop in and say I am very happy to see this project 🙂
newbie question: how do you navigate to the underlying clojure code of the editor, is that possible?
Do you mean like "goto definition" functionality? Shift+o on a function will try to find the definition of the function, navigate to the file and scroll to the function. If it is successful depends on how the function is loaded, if it is in a jar file or not, etc. I have a local checkout of Liquid that I refer from my setup. This way goto-definition has somewhere to navigate to.
yes, ok, thanks!