Skip to content

Instantly share code, notes, and snippets.

@siduck
Last active September 7, 2024 14:28
Show Gist options
  • Save siduck/cc7305db586d512b5fd3f4ea73c9cc81 to your computer and use it in GitHub Desktop.
Save siduck/cc7305db586d512b5fd3f4ea73c9cc81 to your computer and use it in GitHub Desktop.
vim.g.base46_cache = vim.fn.stdpath('data') .. '/base46_cache/'
  • Make sure to read nvconfig to know default options
  • lua/chadrc.lua file must return a table which follows the structure of nvconfig.
---@type ChadrcConfig
local M = {}

M.ui = {
  theme = "onedark"
}

return M

Install plugin

  • Base46 just compiles your theme + settings into bytecode , so its not a startup plugin.
{ "nvim-lua/plenary.nvim", lazy = true },

{
    "NvChad/base46",
    lazy = true,
    build = function()
      require("base46").load_all_highlights()
    end,
},

-- if u want nvchad's ui plugin :)
{
    "NvChad/ui",
    config = function()
      require "nvchad"
    end,
},

-- dependency for ui 
{
    "nvim-tree/nvim-web-devicons",
    lazy = true,
    opts = function()
      return { override = require "nvchad.icons.devicons" }
    end,
    config = function(_, opts)
      dofile(vim.g.base46_cache .. "devicons")
      require("nvim-web-devicons").setup(opts)
    end,
  },
  • Load cache file by dofile function ( add this in your startup )
dofile(vim.g.base46_cache .. "defaults")
dofile(vim.g.base46_cache .. "statusline")
require('base46').load_all_highlights() -- this compiles + loads hl
  • You can load all cache files at once instead of lazyloding them
for _, v in ipairs(vim.fn.readdir(vim.g.base46_cache)) do
  dofile(vim.g.base46_cache .. v)
end
@JavaIsNotHard
Copy link

hey @siduck, I am trying to follow the steps but it seems that base46_cache is not present in my stdpath. Am I missing something?

@siduck
Copy link
Author

siduck commented Mar 20, 2024

@JavaIsNotHard create that, the load_all_high... () should create that dir tho.

I linked even a video to show how to add base46. so i'm 100% sure it should work unless you're missing some steps

@David-Aguilo
Copy link

Hello, I was following this because I wanted to use the ui (which I like a lot, thanks you for making it) in my own config. Could you please add the information that nvim-tree/nvim-web-devicons is a dependency of the ui plugin? It took me a while to figure out it was the reason tabufline was erroring out.

@siduck
Copy link
Author

siduck commented Mar 20, 2024

@scarin
Copy link

scarin commented Mar 21, 2024

@JavaIsNotHard create that, the load_all_high... () should create that dir tho.

I linked even a video to show how to add base46. so i'm 100% sure it should work unless you're missing some steps

where is the video?

@siduck
Copy link
Author

siduck commented Mar 21, 2024

@JavaIsNotHard create that, the load_all_high... () should create that dir tho.
I linked even a video to show how to add base46. so i'm 100% sure it should work unless you're missing some steps

where is the video?

A video which shows me testing it on a non nvchad config https://0x0.st/Xrbn.mp4

@scarin
Copy link

scarin commented Mar 22, 2024

Detailed instructions for usage are needed, as I have tried countless times but still cannot use it successfully.

@siduck
Copy link
Author

siduck commented Mar 22, 2024

@scarin i literally showed a video, idk what you need instructions for, you dont even post any error, are you even running the dofile functions*? those are needed to load the cache files

@scarin
Copy link

scarin commented Mar 22, 2024

@scarin i literally showed a video, idk what you need instructions for, you dont even post any error, are you even running the dofile functions*? those are needed to load the cache files

OMG, I did it! After carefully checking the code, I realized that the base64 encoding never compiled successfully. Thank you for your help.

@siduck
Copy link
Author

siduck commented Mar 22, 2024

@scarin i literally showed a video, idk what you need instructions for, you dont even post any error, are you even running the dofile functions*? those are needed to load the cache files

OMG, I did it! After carefully checking the code, I realized that the base64 encoding never compiled successfully. Thank you for your help.

yea it compiles during the build phase of lazy.nvim

@DebXD
Copy link

DebXD commented Jun 15, 2024

@scarin i literally showed a video, idk what you need instructions for, you dont even post any error, are you even running the dofile functions*? those are needed to load the cache files

OMG, I did it! After carefully checking the code, I realized that the base64 encoding never compiled successfully. Thank you for your help.

yea it compiles during the build phase of lazy.nvim

Mine is getting build error for cmp_ui, but I am not using any ui just the base.
Sat Jun 15 10:29:34 AM IST 2024

@siduck
Copy link
Author

siduck commented Jun 15, 2024

@DebXD i hope you have copied all of nvconfig :)

image

@Pesky01
Copy link

Pesky01 commented Jun 27, 2024

nvconfig file no longer exists, do I just steal it from an old commit or is there another way to do it?

@siduck
Copy link
Author

siduck commented Jun 28, 2024

@Pesky01 chadrc is the file now, updated the guide!

btw this guide's temporary, will soon add actual help docs for the ui/base46 plugin detailing every single feature

@chiragverma11
Copy link

how can I make it work with LazyVim, I followed your instructions, but still no luck

@siduck
Copy link
Author

siduck commented Aug 15, 2024

@chiragverma11 wait a week, i'll make an announce it publicly with :h nvchad too

@ohnix
Copy link

ohnix commented Aug 22, 2024

No way! Proper LazyVim integration instruct? It's kind of amazing how much life you've breathed into so many colorschemes... and they're so much easier on my eyes than most themes out there. Thanks for all you do! Legend in this community for sure o7

so excited

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment