help.txt project-specific-modifications.txt                 

                        Project specific modifications

The idea around project specific modifications is to have a file with 
functions, actions and keybindings that are useful in a specific context, 
like within a project.

The file or the content of the file should then just be evaluated when 
working on that project enhancing Liquid with project specific functionality. 


The code here will generate a list of functions within paredit-bundle.js and
assign CTRL+o in insert mode to do a typeahead insert of one of the functions
in the list.

Of cause any list can be used and any keybinding.

(ns user
  (:require [liq.util :as util]
            [liq.editor :as editor]
            [liq.buffer :as buffer]))

(def content
    (slurp (util/resolve-home "~/proj/paredit.js/paredit-bundle.js"))))

(swap! editor/state assoc-in 
  [::editor/modes :fundamental-mode :insert "C-o"]
  (fn []
     (((editor/get-mode :typeahead-mode) :init)
      (fn [s]
          (fn [buf] (-> buf
                        (buffer/insert-string (str s ""))
                        (buffer/right (count s)))))))))

File navigation typeahead

The code in this section will create a list of clj and js files in the /tmp

The "-" key will be assiged to a typeahead of this list where the file 
choosen will be opened.

By changing the folder to the root of a project, all the files in the project
can be opened just by pressing "-" (or whatever keybinding is used) and
choosing the file using typeahead.

(ns user
  (:require [ :as io]
            [liq.util :as util]
            [liq.editor :as editor]
            [liq.buffer :as buffer]))

(defn filesbelow
  (filter #(re-find #"\.(clj|js)" %)
          (filter util/file?
                  (map #(.getAbsolutePath %)
                       (file-seq (io/file (util/resolve-home path)))))))

(swap! editor/state assoc-in 
  [::editor/modes :fundamental-mode :normal "-"]
  #(((editor/get-mode :typeahead-mode) :init)
    (filesbelow "/tmp")
    str editor/open-file))