liquid

smnplk 2018-12-28T02:08:00.008400Z

Can I change to Vim default key bindings for movement ? hjkl?

seancorfield 2018-12-28T02:27:19.010400Z

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...

seancorfield 2018-12-28T02:28:07.010800Z

You'll probably want to change J as well for consistency?

smnplk 2018-12-28T02:33:17.011900Z

@seancorfield Cool. I'll give it a spin now. Yes, J too.

seancorfield 2018-12-28T03:00:29.013Z

@smnplk Here's my .liq file with hjkl set -- and i for insert/`esc` to leave insert mode

seancorfield 2018-12-28T03:00:35.013200Z

(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)

👍 1
seancorfield 2018-12-28T03:01:23.014Z

The doseq piece is needed because there are a few buffers already created at startup before your .liq file is loaded.

seancorfield 2018-12-28T03:02:21.014900Z

This leaves J as beginning of line and overwrites h for run-macro so ... ¯\(ツ)

mogenslund 2018-12-28T07:23:23.016700Z

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!

ScottStackelhouse 2018-12-28T20:12:37.019200Z

Just wanted to stop in and say I am very happy to see this project 🙂

☝️ 2
🙂 1
John Wright 2018-12-28T20:13:19.019500Z

newbie question: how do you navigate to the underlying clojure code of the editor, is that possible?

mogenslund 2018-12-28T20:20:48.023200Z

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.

John Wright 2018-12-28T20:21:28.023600Z

yes, ok, thanks!