summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Vink <>2023-04-12 22:14:28 +0200
committerMike Vink <>2023-04-12 22:14:28 +0200
commitb53108c413d6cb25e5a6ae55aef13a8173c052c9 (patch)
tree14129e568668b2edd2ec04e6af5bd69f3a541460
parent2b401d8b92d8d39c50333159e8e81fa60eff194f (diff)
fixup
-rw-r--r--fnl/conf/wictl-nvim/init.fnl60
-rw-r--r--fnl/conf/wictl-nvim/resolvers.fnl5
-rw-r--r--fnl/conf/wictl-nvim/term.fnl11
-rw-r--r--fnl/conf/wictl-nvim/term.lua1
4 files changed, 58 insertions, 19 deletions
diff --git a/fnl/conf/wictl-nvim/init.fnl b/fnl/conf/wictl-nvim/init.fnl
index 935f1f8..3aeeb9b 100644
--- a/fnl/conf/wictl-nvim/init.fnl
+++ b/fnl/conf/wictl-nvim/init.fnl
@@ -1,31 +1,55 @@
+(local Path (require :plenary.path))
(tset package.loaded :conf.wict-nvim nil)
(local wict (require :conf.wict-nvim))
+(tset package.loaded :conf.wictl-nvim.resolvers nil)
+(local Resolver (require :conf.wictl-nvim.resolvers))
(local bld wict.builder)
(local eff wict.effects)
+(local config_path (vim.fn.stdpath :config))
+(local data_path (vim.fn.stdpath :data))
+(local user_config (string.format "%s/wictl.json" config_path))
+(local cache_config (string.format "%s/wictl.json" data_path))
+
(local m {})
(local WictlConfig {})
;; {
;; ["/path/to/project"] = {
-;; jobs = [...]
;; terms = [{cmd = "k9s"}]
;; }
-(var last-buf -1)
-(local ui (-> (bld.For {:buffer (fn [] (P last-buf)
- last-buf)
- :maps [{:mode [:n :v :o]
- :lhs :q
- :rhs (fn [effects window]
- (fn [] (effects:close)))}]})
- (bld.Padding 1)
- (bld.RightOf (-> (bld.For {:buffer (fn []
- (P last-buf)
- last-buf)
- :maps []})
- (bld.Padding 1)) 0.2)
- (bld.Build (eff:new))))
-
-(ui wict.root-frame)
-(table.tostring {:hi :there})
+
+(fn m.Edit [project])
+
+(fn m.Read [path]
+ (local p (Path:new path))
+ (vim.fn.json_decode (p:read)))
+
+(fn m.Save []
+ (local cache-path (Path:new cache_config))
+ (cache-path:write (vim.fn.json_encode WictlConfig) :w))
+
+(local ensure-complete-project (fn [config]
+ (var config (or config {:terms []}))
+ (if (not config.terms)
+ (set config.terms [{:name :k9s :cmd :k9s}]))
+ config))
+
+(local get-project (fn []
+ (local proj (. WictlConfig (Resolver.project_key)))
+ (ensure-complete-project (or proj
+ (do
+ (local cfg {})
+ (tset WictlConfig
+ (Resolver.project_key)
+ cfg)
+ cfg)))))
+
+(fn m.Get-Terms-Config []
+ (local proj (get-project))
+ proj.terms)
+
+(m.Save)
+(m.Read cache_config)
+(m.Get-Terms-Config)
diff --git a/fnl/conf/wictl-nvim/resolvers.fnl b/fnl/conf/wictl-nvim/resolvers.fnl
new file mode 100644
index 0000000..df5f2ac
--- /dev/null
+++ b/fnl/conf/wictl-nvim/resolvers.fnl
@@ -0,0 +1,5 @@
+(local m {})
+(fn m.project_key []
+ (vim.loop.cwd))
+
+m
diff --git a/fnl/conf/wictl-nvim/term.fnl b/fnl/conf/wictl-nvim/term.fnl
new file mode 100644
index 0000000..1aea597
--- /dev/null
+++ b/fnl/conf/wictl-nvim/term.fnl
@@ -0,0 +1,11 @@
+(local ui-bld (require :conf.wict-nvim))
+(local ui-eff (require :conf.wict-nvim.effects))
+(local M {})
+
+(local ProjectBufs {})
+(local ui (-> (ui-bld.For {:buffer M.selected-buffer})))
+
+(fn M.open [idx])
+(fn M.start [])
+
+M
diff --git a/fnl/conf/wictl-nvim/term.lua b/fnl/conf/wictl-nvim/term.lua
deleted file mode 100644
index 68faa1f..0000000
--- a/fnl/conf/wictl-nvim/term.lua
+++ /dev/null
@@ -1 +0,0 @@
-(local m {})