From 91ba1c79fd205c5b83f363f32853a0eafbc4ef4a Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Mon, 17 Apr 2023 08:31:49 +0200 Subject: check for print-dev-env output --- fnl/conf/init.fnl | 7 ++++ fnl/conf/nix-develop/init.fnl | 15 ++++---- fnl/conf/pkgs/heirline.fnl | 81 ++++++++++++++++++++++++------------------- fnl/conf/settings.fnl | 7 ++-- 4 files changed, 65 insertions(+), 45 deletions(-) diff --git a/fnl/conf/init.fnl b/fnl/conf/init.fnl index d07293d..87ad11d 100644 --- a/fnl/conf/init.fnl +++ b/fnl/conf/init.fnl @@ -35,3 +35,10 @@ (vim.inspect v))] (each [_ printer (ipairs inspected)] (print printer))))) + +(vim.api.nvim_create_user_command :HomeManager + (fn [ctx] + (vim.cmd (.. ":Dispatch home-manager switch --impure " + (os.getenv :HOME) "/flake#" + (. ctx.fargs 1)))) + {:nargs :1}) diff --git a/fnl/conf/nix-develop/init.fnl b/fnl/conf/nix-develop/init.fnl index 62b0429..fed6173 100644 --- a/fnl/conf/nix-develop/init.fnl +++ b/fnl/conf/nix-develop/init.fnl @@ -62,13 +62,14 @@ (set nix-print-dev-env (.. nix-print-dev-env data)) (do (P {:msg "stdout end" : stdout}) - (vim.schedule #(each [key {: type : value} (pairs (. (vim.fn.json_decode nix-print-dev-env) - :variables))] - (do - (if (and (exported? type) - (not (ignored? key))) - (do - (set-env key value))))))))))) + (if (not= data "") + (vim.schedule #(each [key {: type : value} (pairs (. (vim.fn.json_decode nix-print-dev-env) + :variables))] + (do + (if (and (exported? type) + (not (ignored? key))) + (do + (set-env key value)))))))))))) (vim.api.nvim_create_user_command :NixDevelop (fn [ctx] diff --git a/fnl/conf/pkgs/heirline.fnl b/fnl/conf/pkgs/heirline.fnl index 3579d9c..dac19b7 100644 --- a/fnl/conf/pkgs/heirline.fnl +++ b/fnl/conf/pkgs/heirline.fnl @@ -6,6 +6,13 @@ (local Align {:provider "%="}) (local Space {:provider " "}) +(fn with [tbl with-kv] + (local w {}) + (each [k v (pairs tbl)] + (tset w k v)) + (each [k v (pairs with-kv)] + (tset w k v)) + w) (heirline.load_colors colors) (fn palette [name] @@ -86,17 +93,6 @@ (.. "" purity "(" name ")")) :hl {:fg (theme :syn :fun) :bold true :bg (theme :ui :bg_m3)}}) -(local StatusLine [FileNameBlock - Space - DAPMessages - Align - Nix - Space - Ruler - Space - ScrollBar - Space]) - (local harpoon (require :harpoon)) (local harpoon-mark (require :harpoon.mark)) (local harpoon-colors [(theme :syn :identifier) @@ -104,29 +100,29 @@ (theme :syn :identifier)]) (fn mark-component [i mark] - (utils.insert {} {:hl {:bold true :fg (. harpoon-colors i)} - :provider (.. :M i "(")} - {:hl {:fg (theme :syn :fun)} - :provider (vim.fn.pathshorten mark.filename)} - {:hl {:bold true :fg (. harpoon-colors i)} :provider ")"} Space)) - -(local HarpoonMarks (utils.insert {:hl :TabLineSel} - {:provider "🌊 " - :hl {:fg (theme :syn :identifier) - :bold true}} - {:init (lambda [self] - (local mark-list - (. (harpoon.get_mark_config) - :marks)) - (each [i mark (ipairs mark-list)] - (tset self i - (self:new (mark-component i - mark) - i))) - (while (> (length self) - (length mark-list)) - (table.remove self (length self))))} - Align)) + (utils.insert {} {:hl {:bg (theme :ui :bg_m1) + :bold true + :fg (. harpoon-colors i)} + :provider (fn [self] + (.. :M i " "))})) + +;{:hl {:fg (theme :syn :fun)} :provider (vim.fn.pathshorten mark.filename)})) +; {:hl {:bold true :fg (. harpoon-colors i)} :provider ")"} Space)) + +(local HarpoonMarks + (utils.insert {:hl :TabLineSel} + {:provider "🌊 " + :hl {:bg (theme :ui :bg_m1) + :fg (theme :syn :identifier) + :bold true}} + {:init (lambda [self] + (local mark-list + (. (harpoon.get_mark_config) :marks)) + (each [i mark (ipairs mark-list)] + (tset self i + (self:new (mark-component i mark) i))) + (while (> (length self) (length mark-list)) + (table.remove self (length self))))})) (local Tabpage {:provider (lambda [self] @@ -193,4 +189,19 @@ (local TabPages (utils.insert TabPages (utils.make_tablist Tabpage) TabpageClose)) -(heirline.setup {:statusline StatusLine :tabline [HarpoonMarks TabPages]}) +(local StatusLine [FileNameBlock + Space + HarpoonMarks + Space + TabPages + DAPMessages + Align + Space + Nix + Space + Ruler + Space + ScrollBar + Space]) + +(heirline.setup {:statusline StatusLine}) diff --git a/fnl/conf/settings.fnl b/fnl/conf/settings.fnl index 6537a0e..aedb88e 100644 --- a/fnl/conf/settings.fnl +++ b/fnl/conf/settings.fnl @@ -23,7 +23,6 @@ dirvish_mode ":sort | sort ,^.*[^/]$, r") (settings - cmdheight 0 +shortmess "c" +diffopt vertical +isfname "@-@" @@ -61,7 +60,9 @@ complete ".,w,k,kspell,b" foldopen "block,hor,jump,mark,percent,quickfix,search,tag" laststatus 3 - winbar "%=%m %f" + ; winbar "%=%m %f" + winbar "" hlsearch off clipboard "" - showtabline 2) + showtabline 0 + cmdheight 0) -- cgit v1.2.3