diff options
author | amelia squires <[email protected]> | 2025-03-04 03:04:24 -0600 |
---|---|---|
committer | amelia squires <[email protected]> | 2025-03-04 03:04:24 -0600 |
commit | d56fb1ab6e76a23817c6836249edd44cf6252554 (patch) | |
tree | e48cc02ebdbe6e03121e249980431b236aeaec65 /fnl | |
parent | bea349474eddf5b1b4e30e7c2212a1b9503baddf (diff) |
settings + bar
Diffstat (limited to 'fnl')
-rw-r--r-- | fnl/layouts/ide.fnl | 15 | ||||
-rw-r--r-- | fnl/layouts/quiet.fnl | 15 | ||||
-rw-r--r-- | fnl/layouts/writing.fnl | 17 | ||||
-rw-r--r-- | fnl/opt.fnl | 37 | ||||
-rw-r--r-- | fnl/plugins/edgy.fnl | 3 | ||||
-rw-r--r-- | fnl/plugins/jabs.fnl | 14 | ||||
-rw-r--r-- | fnl/plugins/lualine.fnl | 92 | ||||
-rw-r--r-- | fnl/plugins/notify.fnl | 1 | ||||
-rw-r--r-- | fnl/plugins/which_key.fnl | 18 | ||||
-rw-r--r-- | fnl/settings-ui.fnl | 14 |
10 files changed, 206 insertions, 20 deletions
diff --git a/fnl/layouts/ide.fnl b/fnl/layouts/ide.fnl index 8ba6182..10858d5 100644 --- a/fnl/layouts/ide.fnl +++ b/fnl/layouts/ide.fnl @@ -1,4 +1,11 @@ -(fn [] -(vim.cmd "ToggleTerm direction=horizontal") -(vim.cmd "Neotree toggle") -(vim.cmd "Outline")) +{ +:enable (fn [] + (vim.cmd "ToggleTerm direction=horizontal") + (vim.cmd "Neotree toggle") + (vim.cmd "Outline")) + +:disable (fn [] + (vim.cmd "ToggleTerm direction=horizontal") + (vim.cmd "Neotree toggle") + (vim.cmd "Outline")) +} diff --git a/fnl/layouts/quiet.fnl b/fnl/layouts/quiet.fnl index 73d8b0f..3435628 100644 --- a/fnl/layouts/quiet.fnl +++ b/fnl/layouts/quiet.fnl @@ -1,4 +1,11 @@ -(fn [] -(tset vim.opt :number false) -(tset vim.o :signcolumn :no) -(tset vim.opt :fillchars {:eob " "})) +{ +:enable (fn [] + (tset vim.opt :number false) + (tset vim.o :signcolumn :no) + (tset vim.opt :fillchars {:eob " "})) + +:disable (fn [] + (tset vim.opt :number true) + (tset vim.o :signcolumn :yes) + (tset vim.opt :fillchars {:eob "~"})) +} diff --git a/fnl/layouts/writing.fnl b/fnl/layouts/writing.fnl new file mode 100644 index 0000000..76a4e38 --- /dev/null +++ b/fnl/layouts/writing.fnl @@ -0,0 +1,17 @@ +{ +:enable (fn [] + (tset vim.opt :number false) + (tset vim.o :signcolumn :no) + (tset vim.opt :fillchars {:eob " "}) + (tset vim.opt :wrap true) + (tset vim.opt :linebreak true) + (_G.opt.trans-enable)) + +:disable (fn [] + (tset vim.opt :number true) + (tset vim.o :signcolumn :yes) + (tset vim.opt :fillchars {:eob "~"}) + (tset vim.opt :wrap false) + (tset vim.opt :linebreak false) + (_G.opt.trans-disable)) +} diff --git a/fnl/opt.fnl b/fnl/opt.fnl index ef27af0..2925595 100644 --- a/fnl/opt.fnl +++ b/fnl/opt.fnl @@ -14,17 +14,38 @@ ;--vim.opt.fillchars = { eob = ""} (local color_change (fn [] - (vim.api.nvim_set_hl 0 :Normal {:bg :none}) + ;havent found how to make toggleterm to work, it wont switch until you select the window + ;possible bug with toggleterm? + (vim.api.nvim_set_hl 0 :Normal {:bg :none :fg :none}) (vim.api.nvim_set_hl 0 :SignColumn {:bg :none}) (vim.api.nvim_set_hl 0 :EndOfBuffer {:bg :none}) (vim.api.nvim_set_hl 0 :NormalFloat {:bg :none}) - (vim.api.nvim_set_hl 0 :FloatBorder {:bg :none}))) + (vim.api.nvim_set_hl 0 :FloatBorder {:bg :none}) + (vim.api.nvim_set_hl 0 :NvimTreeNormal {:bg :none}) + (vim.api.nvim_set_hl 0 :NormalNC {:bg :none}) + (vim.api.nvim_set_hl 0 :TermCursor {:bg :none}) + (vim.api.nvim_set_hl 0 :TermCursorNC {:bg :none}) + (vim.api.nvim_set_hl 0 :VertSplit {:bg :none}) + (vim.api.nvim_set_hl 0 :LineNr {:bg :none}) + (vim.api.nvim_set_hl 0 :StatusLine {:bg :none}))) -(when (= _G.settings.trans "enable") +(global _trans_ false) + +(fn trans-disable [] + (global _trans_ false) + (vim.api.nvim_clear_autocmds {:event :Colorscheme}) + (vim.cmd (.. "colorscheme " _G.settings.colorscheme))) + +(fn trans-enable [] + (global _trans_ true) (vim.api.nvim_create_autocmd "Colorscheme" { :pattern :* :callback color_change}) - (color_change)) + (color_change) + (vim.cmd (.. "colorscheme " _G.settings.colorscheme))) + +(when (= _G.settings.trans "enable") + (trans-enable)) (vim.cmd (.. "colorscheme " _G.settings.colorscheme)) @@ -35,5 +56,9 @@ (tset vim.o :undodir target_path) (tset vim.o :undofile true)) -(when (not= _G.settings.layout "") - (util.after-setup (require (.. :layouts. _G.settings.layout)))) +(tset _G :current_layout "") +(when (and (not= _G.settings.layout "") (not= _G.settings.layout "none")) + (util.after-setup (. (require (.. :layouts. _G.settings.layout)) :enable)) + (tset _G :current_layout _G.settings.layout)) + +{:trans-disable trans-disable :trans-enable trans-enable} diff --git a/fnl/plugins/edgy.fnl b/fnl/plugins/edgy.fnl index 4868367..ec4c77c 100644 --- a/fnl/plugins/edgy.fnl +++ b/fnl/plugins/edgy.fnl @@ -1,4 +1,7 @@ (_G.util.setup! :edgy { + :options { + :bottom {:size 9} + } :bottom [:toggleterm] :left [:neo-tree {:ft :Outline :title (fn [] (local buf_name (vim.api.nvim_buf_get_name 0)); or "[No Name]" diff --git a/fnl/plugins/jabs.fnl b/fnl/plugins/jabs.fnl new file mode 100644 index 0000000..1690121 --- /dev/null +++ b/fnl/plugins/jabs.fnl @@ -0,0 +1,14 @@ +(print "hi") +(_G.util.setup! :jabs {:use_devicons false + :keymap {:close :x} + :symbols { + :current "C" + :split "S" + :alternate "A" + :hidden "H" + :locked "L" + :ro "R" + :edited "E" + :terminal "T" + :default_file "D" + :terminal_symbol ">_"}}) diff --git a/fnl/plugins/lualine.fnl b/fnl/plugins/lualine.fnl new file mode 100644 index 0000000..9cda2ef --- /dev/null +++ b/fnl/plugins/lualine.fnl @@ -0,0 +1,92 @@ +(local colors { + :bg :#252629 + :fade-bg :#121314 + :yellow :#ECBE7B + :cyan :#008080 + :darkblue :#081633 + :green :#98be65 + :orange :#FF8800 + :violet :#a9a1e1 + :magenta :#c678dd + :blue :#51afef + :red :#ec5f67 + :grey :#6a6a6a +}) + +(macro color [code] + {:fg code}) + +(lambda table-to-pair [table] + (var idx 1) + (var out {}) + (while (not= (. table (+ idx 1)) nil) + (tset out (. table idx) (. table (+ idx 1))) + (set idx (+ idx 2))) + out) + + +(fn add [section mod col ...] + (var opt (table-to-pair [...])) + (when (= opt nil) (set opt {})) + (tset opt 1 mod) + (tset opt :color col) + (table.insert section opt)) + +(local a []) +(local b []) +(local c []) +(local x []) +(local y []) +(local z []) + +(local inactive-a []) +(local inactive-b []) +(local inactive-c []) +(local inactive-x []) +(local inactive-y []) +(local inactive-z []) + +(add c :filesize (color colors.red)) +(add c :filename (color colors.magenta)) +(add c :diagnostics) + +(add c :branch (color colors.cyan) :icon "" :fmt (fn [s] (.. "(" s ")"))) +(add c :diff) + +(add x :searchcount (color colors.cyan)) +(add x :location (color colors.grey)) +(add x :progress (color colors.grey)) + +(add inactive-c :filesize (color colors.grey)) +(add inactive-c :filename (color colors.grey)) +(add inactive-c :diagnostics (color colors.grey)) + +(add inactive-x :progress (color colors.grey)) + + +(_G.util.setup! :lualine { + :options { + :theme { + :normal { :c {:bg colors.bg}} + :inactive { :c {:bg colors.fade-bg}} + } + :component_separators { :left "" :right "" } + :section_separators { :left "" :right "" } + } + :sections { + :lualine_a a + :lualine_b b + :lualine_c c + :lualine_x x + :lualine_y y + :lualine_z z + } + :inactive_sections { + :lualine_a inactive-a + :lualine_b inactive-b + :lualine_c inactive-c + :lualine_x inactive-x + :lualine_y inactive-y + :lualine_z inactive-z + } +}) diff --git a/fnl/plugins/notify.fnl b/fnl/plugins/notify.fnl deleted file mode 100644 index 46e3cd0..0000000 --- a/fnl/plugins/notify.fnl +++ /dev/null @@ -1 +0,0 @@ -(tset vim :notify (_G.util.require! :notify)) diff --git a/fnl/plugins/which_key.fnl b/fnl/plugins/which_key.fnl index 16b10a1..643dfa3 100644 --- a/fnl/plugins/which_key.fnl +++ b/fnl/plugins/which_key.fnl @@ -6,6 +6,12 @@ (macro gmap [k group] {1 (.. " " k) :group group}) +(fn swap-layout [new] + (_G.loaded.edgy.goto_main) + (when (not= _G.current_layout "") ((. (require (.. :layouts. _G.current_layout)) :disable))) + (when (not= new "") ((. (require (.. :layouts. new)) :enable))) + (tset _G :current_layout new)) + (local mappings [ ;;common (wmap :f "<cmd>Neotree toggle<CR>" "fs") @@ -28,8 +34,11 @@ ;;layouts (gmap :l "layout") - (wmap :li (require :layouts.ide) "ide") - (wmap :lq (require :layouts.quiet) "quiet") + (wmap :li (fn [] (swap-layout :ide)) "ide") + (wmap :lq (fn [] (swap-layout :quiet)) "quiet") + (wmap :lw (fn [] (swap-layout :writing)) "writing") + (wmap :lx (fn [] (swap-layout "")) "none") + ;;visual (gmap :v "visual") @@ -40,9 +49,14 @@ (gmap :q "quick") (wmap :qs "\"+y" "system grab") (wmap :ql "0v$" "line") + (wmap :qw "^v$" "line w/out whitespace") + (wmap :qa "0ggvG$" "select all") (wmap :qr "<cmd>SnipRun<CR>" "run highlighted") (wmap :qf "<cmd>RunFile<CR>" "run file") (wmap :qe "<cmd>RunCode<CR>" "run code") + (wmap :qt (fn [] + (if _G._trans_ (_G.opt.trans-disable) + (_G.opt.trans-enable)) ) "toggle trans") ]) (tset mappings :mode [:n :v]) diff --git a/fnl/settings-ui.fnl b/fnl/settings-ui.fnl index 61d3e5e..1f74868 100644 --- a/fnl/settings-ui.fnl +++ b/fnl/settings-ui.fnl @@ -1,8 +1,12 @@ +(fn update-layout [new old] + (when (and (not= old "") (not= old "none")) ((. (require (.. :layouts. old)) :disable))) + (when (and (not= new "") (not= new "none")) ((. (require (.. :layouts. new)) :enable)))) + (local options { - :colorscheme {:array false :options [:oxocarbon :monochrome :doom-one]} + :colorscheme {:array false :options [:oxocarbon :monochrome :doom-one] :update (fn [color] (vim.cmd (.. "colorscheme " color)))} :lsp {:array true} - :layout {:array false :options [:ide :quiet]} - :trans {:array false :options [:enable :disable]}}) + :layout {:array false :options [:ide :quiet] :update (fn [layout] (update-layout layout _G.settings.layout))} + :trans {:array false :options [:enable :disable] :update (fn [en] ((. _G.opt (.. :trans- en))))}}) (local options_k {}) (each [k v (pairs options)] (table.insert options_k k)) @@ -59,6 +63,10 @@ (where n (= n "remove")) (set action 2)) (set rest (trim rest)) + + ;call update before so the function can know the previous value + (when (and (not= (. options option) nil) (not= (. options option :update) nil)) ((. options option :update) item rest)) + (when (= action 0) (tset _G.settings option (.. item (nothing-if-false (not= rest "") (.. " " rest))))) (when (= action 1) (tset _G.settings option (.. (nothing-if-nil (?. _G.settings option) ",") rest))) (when (= action 2) (tset _G.settings option (tarray (rem (carray (. _G.settings option)) rest)))) |