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 | |
parent | bea349474eddf5b1b4e30e7c2212a1b9503baddf (diff) |
settings + bar
-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 | ||||
-rw-r--r-- | init.fnl | 11 | ||||
-rw-r--r-- | lua/lua/lualine.lua | 279 |
12 files changed, 212 insertions, 304 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)))) @@ -3,12 +3,13 @@ (packer-setup! {}) (global settings (require :settings)) -(require :settings-ui) (when (~= (vim.fn.getenv :NVIM_DEBUG) :1) (require :keybinds) (require :defaults) - (require :opt)) + (global opt (require :opt))) + +(require :settings-ui) (local util (require :util)) (tset _G :util util) @@ -25,10 +26,10 @@ :depends [:nvim-lua/plenary.nvim :nvim-tree/nvim-web-devicons :MunifTanjim/nui.nvim :3rd/image.nvim]) (use! :sindrets/winshift.nvim :config (util.setup! :winshift)) - (use! :rcarriga/nvim-notify :require :plugins.notify) + (use! :rcarriga/nvim-notify :config (util.setup! :notify {:background_colour "#000000"})) (use! :akinsho/toggleterm.nvim :require :plugins.toggleterm) (use! :nvim-telescope/telescope.nvim) - (use! :matbme/JABS.nvim :config (util.setup! :jabs {:use_devicons false})) + (use! :matbme/JABS.nvim :require :plugins.jabs) (use! :CRAG666/code_runner.nvim :config (util.setup! :code_runner)) (use! :sindrets/diffview.nvim) @@ -54,7 +55,7 @@ ;(use! :wfxr/minimap.vim) ;make things pretty - (use! :nvim-lualine/lualine.nvim :require :lua.lualine) + (use! :nvim-lualine/lualine.nvim :require :plugins.lualine) (use! :max397574/startup.nvim :require :plugins.startup) (use! :lewis6991/gitsigns.nvim :config (util.setup! :gitsigns)) (use! :stevearc/dressing.nvim :require :plugins.dressing) diff --git a/lua/lua/lualine.lua b/lua/lua/lualine.lua deleted file mode 100644 index 5737895..0000000 --- a/lua/lua/lualine.lua +++ /dev/null @@ -1,279 +0,0 @@ --- Eviline config for lualine --- Author: shadmansaleh --- Credit: glepnir -local lualine = require('lualine') - --- Color table for highlights --- stylua: ignore -local colors = { - bg = '#202328', - fg = '#bbc2cf', - yellow = '#ECBE7B', - cyan = '#008080', - darkblue = '#081633', - green = '#98be65', - orange = '#FF8800', - violet = '#a9a1e1', - magenta = '#c678dd', - blue = '#51afef', - red = '#ec5f67', -} - -if _G.settings.trans == "enable" then - colors.bg = "none" -end - -local conditions = { - buffer_not_empty = function() - return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 - end, - hide_in_width = function() - return vim.fn.winwidth(0) > 80 - end, - check_git_workspace = function() - local filepath = vim.fn.expand('%:p:h') - local gitdir = vim.fn.finddir('.git', filepath .. ';') - return gitdir and #gitdir > 0 and #gitdir < #filepath - end, -} - --- Config -local config = { - options = { - -- Disable sections and component separators - disabled_filetypes = { - 'neo-tree', 'toggleterm' - }, - component_separators = '', - section_separators = '', - theme = { - -- We are going to use lualine_c an lualine_x as left and - -- right section. Both are highlighted by c theme . So we - -- are just setting default looks o statusline - normal = { c = { fg = colors.fg, bg = colors.bg } }, - inactive = { c = { fg = colors.fg, bg = colors.bg } }, - }, - }, - sections = { - -- these are to remove the defaults - lualine_a = {}, - lualine_b = {}, - lualine_y = {}, - lualine_z = {}, - -- These will be filled later - lualine_c = {}, - lualine_x = {}, - }, - inactive_sections = { - -- these are to remove the defaults - lualine_a = {}, - lualine_b = {}, - lualine_y = {}, - lualine_z = {}, - lualine_c = {}, - lualine_x = {}, - }, -} --- Inserts a component in lualine_c at left section -local function ins_left_inactive(component) - table.insert(config.inactive_sections.lualine_c, component) -end - --- Inserts a component in lualine_x at right section -local function ins_right_inactive(component) - table.insert(config.inactive_sections.lualine_x, component) -end - --- Inserts a component in lualine_c at left section -local function ins_left(component) - table.insert(config.sections.lualine_c, component) -end - --- Inserts a component in lualine_x at right section -local function ins_right(component) - table.insert(config.sections.lualine_x, component) -end - -local function ins_both_left(component) - ins_left(component); ins_left_inactive(component); -end - -local function ins_both_right(component) - ins_right(component); ins_right_inactive(component); -end - ---[[ins_left { - function() - return '▊' - end, - color = { fg = colors.blue }, -- Sets highlighting of component - padding = { left = 0, right = 1 }, -- We don't need space before this -}]] -ins_left_inactive { - -- mode component - function() - return ' ' - end, - color = function() - -- auto change color according to neovims mode - local mode_color = { - n = colors.red, - i = colors.green, - v = colors.blue, - [''] = colors.blue, - v = colors.blue, - c = colors.magenta, - no = colors.red, - s = colors.orange, - s = colors.orange, - [''] = colors.orange, - ic = colors.yellow, - r = colors.violet, - rv = colors.violet, - cv = colors.red, - ce = colors.red, - r = colors.cyan, - rm = colors.cyan, - ['r?'] = colors.cyan, - ['!'] = colors.red, - t = colors.red, - } - return { fg = mode_color[vim.fn.mode()] } - end, - padding = { right = 1 }, -} - -ins_left { - -- mode component - function() - return '' - end, - color = function() - -- auto change color according to neovims mode - local mode_color = { - n = colors.red, - i = colors.green, - v = colors.blue, - [''] = colors.blue, - v = colors.blue, - c = colors.magenta, - no = colors.red, - s = colors.orange, - s = colors.orange, - [''] = colors.orange, - ic = colors.yellow, - r = colors.violet, - rv = colors.violet, - cv = colors.red, - ce = colors.red, - r = colors.cyan, - rm = colors.cyan, - ['r?'] = colors.cyan, - ['!'] = colors.red, - t = colors.red, - } - return { fg = mode_color[vim.fn.mode()] } - end, - padding = { right = 1 }, -} - -ins_both_left { - -- filesize component - 'filesize', - cond = conditions.buffer_not_empty, -} - -ins_both_left { - 'filename', - cond = conditions.buffer_not_empty, - color = { fg = colors.magenta, gui = 'bold' }, -} - -ins_left { 'location' } - -ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } } - -ins_left { - 'diagnostics', - sources = { 'nvim_diagnostic' }, - symbols = { error = ' ', warn = ' ', info = ' ' }, - diagnostics_color = { - error = { fg = colors.red }, - warn = { fg = colors.yellow }, - info = { fg = colors.cyan }, - }, -} - --- Insert mid section. You can make any number of sections in neovim :) --- for lualine it's any number greater then 2 -ins_left { - function() - return '%=' - end, -} - ---[[ins_left { - -- Lsp server name . - function() - local msg = 'No Active Lsp' - local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then - return msg - end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return client.name - end - end - return msg - end, - icon = ' LSP:', - color = { fg = '#ffffff', gui = 'bold' }, -}]] - --- Add components to right sections ---[[ins_right { - 'o:encoding', -- option component same as &encoding in viml - fmt = string.upper, -- I'm not sure why it's upper case either ;) - cond = conditions.hide_in_width, - color = { fg = colors.green, gui = 'bold' }, -}]] ---[[ -ins_right { - 'fileformat', - fmt = string.upper, - icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh - color = { fg = colors.green, gui = 'bold' }, -} - -ins_right { - 'branch', - icon = '', - color = { fg = colors.violet, gui = 'bold' }, -}]] - -ins_right { - 'diff', - -- Is it me or the symbol for modified us really weird - symbols = { added = '+', modified = '~', removed = '-' }, - diff_color = { - added = { fg = colors.green }, - modified = { fg = colors.orange }, - removed = { fg = colors.red }, - }, - cond = conditions.hide_in_width, -} - ---[[ -ins_right { - function() - return '▊' - end, - color = { fg = colors.blue }, - padding = { left = 1 }, -}]] - --- Now don't forget to initialize lualine -lualine.setup(config) |