diff options
| author | ame <[email protected]> | 2025-08-31 14:47:14 -0500 | 
|---|---|---|
| committer | ame <[email protected]> | 2025-08-31 14:47:14 -0500 | 
| commit | 3f5d8d8f62e90d205f4e8ccf14dd434d0f3bd3eb (patch) | |
| tree | 609049b7a54e38b1150455a724fb3dc6e9646911 | |
| parent | 6e5735049ebf19e77f70c6609dec629870de973a (diff) | |
| -rw-r--r-- | fnl/opt.fnl | 4 | ||||
| -rw-r--r-- | fnl/plugins/oil.fnl | 19 | ||||
| -rw-r--r-- | fnl/settings-ui.fnl | 2 | ||||
| -rw-r--r-- | init.fnl | 11 | ||||
| -rw-r--r-- | lua/lua/oil-gitignore.lua | 54 | 
5 files changed, 83 insertions, 7 deletions
| diff --git a/fnl/opt.fnl b/fnl/opt.fnl index d3ff660..61c9625 100644 --- a/fnl/opt.fnl +++ b/fnl/opt.fnl @@ -16,9 +16,7 @@  (local color_change (fn []         ;havent found how to make toggleterm to work, it wont switch until you select the window        ;possible bug with toggleterm? -      (local groups [:Normal :NormalNC :Comment :Constant :Special :Identifier -                  :Statement :PreProc :Type :Underlined :Todo :String :Function -                  :Conditional :Repeat :Operator :Structure :LineNr :NonText +      (local groups [:Normal :NormalNC :PreProc :Repeat :LineNr :NonText                    :SignColumn :CursorLine :CursorLineNr :StatusLine :StatusLineNC                    :EndOfBuffer :NormalFloat :FloatBorder :NvimTreeNormal :TermCursor :TermCursorNC])        (each [_ v (pairs groups)] diff --git a/fnl/plugins/oil.fnl b/fnl/plugins/oil.fnl new file mode 100644 index 0000000..fa1e69d --- /dev/null +++ b/fnl/plugins/oil.fnl @@ -0,0 +1,19 @@ +(local oil (_G.util.require! :oil)) +;maybe use other one so dirs can show status +(local oil-git (_G.util.require! :oil-git)) +(local oil-gitignore (require "lua.oil-gitignore")) + +(oil.setup { +  :view_options { +                        ;heh, get it? +    :is_hidden_file (fn [en by] +      (local dir (oil.get_current_dir by)) +      (. oil-gitignore.git_status dir :ignored en) +    ) +  } + +  :float { +    :padding 7 +  } +}) +(oil-git.setup) diff --git a/fnl/settings-ui.fnl b/fnl/settings-ui.fnl index 1a748f9..743d1c0 100644 --- a/fnl/settings-ui.fnl +++ b/fnl/settings-ui.fnl @@ -3,7 +3,7 @@    (when (and (not= new "") (not= new "none")) ((. (require (.. :layouts. new)) :enable))))  (local options { -  :colorscheme {:array false :options [:oxocarbon :monochrome :doom-one :dayfox :nightfox :carbonfox :duskfox] :update (fn [color] (vim.cmd (.. "colorscheme " color)))} +  :colorscheme {:array false :options [:sakura :oxocarbon :monochrome :doom-one :dayfox :nightfox :carbonfox :duskfox] :update (fn [color] (vim.cmd (.. "colorscheme " color)))}    :lsp {:array true}    :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))))}}) @@ -32,12 +32,13 @@    (use! :matbme/JABS.nvim :require :plugins.jabs)    (use! :CRAG666/code_runner.nvim :config (util.setup! :code_runner))    (use! :sindrets/diffview.nvim) -  (use! :stevearc/oil.nvim :config (util.setup! :oil)) +  (use! :stevearc/oil.nvim :depends [:benomahony/oil-git.nvim] :require :plugins.oil)    ;use this to disable preview-tui    ;(use! :luukvbaal/nnn.nvim :config (util.setup! :nnn {:offset true :picker {:fullscreen false}}))    ;introduces too many erros:p cool otherwise, might find an altern--mostly covered by outline -  ;(use! :code-biscuits/nvim-biscuits :config (util.setup! :nvim-biscuits)) +  ;^ want to try it again +  (use! :code-biscuits/nvim-biscuits :config (util.setup! :nvim-biscuits {:cursor_line_only true}))    (use! :michaelb/sniprun :run "sh ./install.sh" :require :plugins.sniprun)    (use! :DNLHC/glance.nvim :config (util.setup! :glance)) @@ -81,13 +82,17 @@    ;lsp    (use! :nvim-treesitter/nvim-treesitter :require :plugins.treesitter) -  (use! :ray-x/lsp_signature.nvim :config (util.setup! :lsp_signature)) +  ;switch to the blink native one at some point +  (use! :ray-x/lsp_signature.nvim :config (util.setup! :lsp_signature {:hint_enable false}))    (use! :saghen/blink.cmp :require :plugins.blink)      (use! :xzbdmw/colorful-menu.nvim :config (util.setup! :colorful-menu {:max_width 45}))    (use! :neovim/nvim-lspconfig :require :plugins.lspconfig)    (use! :williamboman/mason.nvim :config (util.setup! :mason))    ;themes +  (use! :rktjmp/lush.nvim) + +  (use! :anAcc22/sakura.nvim)    (use! :kepano/flexoki-neovim)    (use! :kdheepak/monochrome.nvim)    (use! :nyoom-engineering/oxocarbon.nvim) diff --git a/lua/lua/oil-gitignore.lua b/lua/lua/oil-gitignore.lua new file mode 100644 index 0000000..a63eaf0 --- /dev/null +++ b/lua/lua/oil-gitignore.lua @@ -0,0 +1,54 @@ +--https://github.com/stevearc/oil.nvim/blob/master/doc/recipes.md#hide-gitignored-files-and-show-git-tracked-hidden-files + +local M = {} + +-- helper function to parse output +function M.parse_output(proc) +  local result = proc:wait() +  local ret = {} +  if result.code == 0 then +    for line in vim.gsplit(result.stdout, "\n", { plain = true, trimempty = true }) do +      -- Remove trailing slash +      line = line:gsub("/$", "") +      ret[line] = true +    end +  end +  return ret +end + +-- build git status cache +function M.new_git_status() +  return setmetatable({}, { +    __index = function(self, key) +      local ignore_proc = vim.system( +        { "git", "ls-files", "--ignored", "--exclude-standard", "--others", "--directory" }, +        { +          cwd = key, +          text = true, +        } +      ) +      local tracked_proc = vim.system({ "git", "ls-tree", "HEAD", "--name-only" }, { +        cwd = key, +        text = true, +      }) +      local ret = { +        ignored = M.parse_output(ignore_proc), +        tracked = M.parse_output(tracked_proc), +      } + +      rawset(self, key, ret) +      return ret +    end, +  }) +end +M.git_status = M.new_git_status() + +-- Clear git status cache on refresh +M.refresh = require("oil.actions").refresh +M.orig_refresh = M.refresh.callback +M.refresh.callback = function(...) +  git_status = M.new_git_status() +  M.orig_refresh(...) +end + +return M | 
