enc: make modular config

This commit is contained in:
Pojok Code 2024-07-09 16:48:34 +07:00
parent d46370f0b3
commit 624d3aceb6
10 changed files with 610 additions and 374 deletions

View file

@ -2,7 +2,7 @@
"Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" },
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
"alpha-nvim": { "branch": "main", "commit": "41283fb402713fc8b327e60907f74e46166f4cfd" },
"auto-conform.nvim": { "branch": "main", "commit": "8d2fbcbd8b8dfd44e1bc2edffc3fe7372b5b520e" },
"auto-conform.nvim": { "branch": "main", "commit": "d04389f955dd0990e85a269b226199f458de32a6" },
"auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" },
"bigfile.nvim": { "branch": "main", "commit": "33eb067e3d7029ac77e081cfe7c45361887a311a" },
"bufferline.nvim": { "branch": "main", "commit": "81820cac7c85e51e4cf179f8a66d13dbf7b032d9" },
@ -17,21 +17,21 @@
"conform.nvim": { "branch": "master", "commit": "60e6fbddbdf37d7790de07dc7420beefaf650e5e" },
"darcula-dark.nvim": { "branch": "main", "commit": "cce636860dc5151b6980a35dd378f54a238e0f0e" },
"dressing.nvim": { "branch": "master", "commit": "71349f24c6e07b39f33600985843c289ca735308" },
"friendly-snippets": { "branch": "main", "commit": "682157939e57bd6a2c86277dfd4d6fbfce63dbac" },
"friendly-snippets": { "branch": "main", "commit": "45a1b96e46efe5fce8af325d4bed45feb9d29d0f" },
"gitsigns.nvim": { "branch": "main", "commit": "0b04035bb7b3c83e999b9676e2fb46fd0aa9f910" },
"indent-blankline.nvim": { "branch": "master", "commit": "65e20ab94a26d0e14acac5049b8641336819dfc7" },
"lazy.nvim": { "branch": "main", "commit": "6ca23c15f64e88e3ba26be9795343c4c7f2ee851" },
"lazy.nvim": { "branch": "main", "commit": "f918318d21956b0874a65ab35ce3d94d9057aabf" },
"live-server.nvim": { "branch": "main", "commit": "f34ae262bf046981d9e5f7cd4f41a353a9647a22" },
"lsp-progress.nvim": { "branch": "main", "commit": "c5858bba2043cac5ad4113fe1263366125b1b314" },
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
"lualine.nvim": { "branch": "master", "commit": "6a40b530539d2209f7dc0492f3681c8c126647ad" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "4ba55f9755ebe8297d92c419b90a946123292ae6" },
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
"mini.indentscope": { "branch": "main", "commit": "1222393d9c5e8d92b913ccab6701a7164b21781c" },
"neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" },
"noice.nvim": { "branch": "main", "commit": "03c6a75661e68012e30b0ed81f050358b1e2233c" },
"noice.nvim": { "branch": "main", "commit": "55e6cc74d1c8a985ae83cb7ce80785c357ec551e" },
"nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" },
"nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" },
"nvim-autopairs": { "branch": "master", "commit": "78a4507bb9ffc9b00f11ae0ac48243d00cb9194d" },
"nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" },
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
"nvim-dap": { "branch": "master", "commit": "5ba8ceace596360321cf33fa4b56d9d46e057ce9" },
@ -45,10 +45,10 @@
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
"nvim-scrollview": { "branch": "main", "commit": "30ca6e18265928eb4ea7402346b4dfddbd8ce41e" },
"nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" },
"nvim-treesitter": { "branch": "master", "commit": "a8c082b4f5b3b70bde2ffb08cc112dfd7e515fb3" },
"nvim-treesitter": { "branch": "master", "commit": "c1ad655b6a0c83ab48e55240f367e2bc0c15af31" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" },
"nvim-ts-autotag": { "branch": "main", "commit": "ddfccbf0df1b9349c2b9e9b17f4afa8f9b6c1ed1" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "2b7dcf6aab0947b9c4195f1d8aa592cdcd944ffe" },
"nvim-ts-autotag": { "branch": "main", "commit": "323a3e16ed603e2e17b26b1c836d1e86c279f726" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "f1905136b99b5d706858d4c9274a3b152b4359ed" },
"nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" },
"playground": { "branch": "master", "commit": "bcfab84f98a33f2ad34dda6c842046dca70aabf6" },
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },

View file

@ -1,54 +1,54 @@
local transparent = false
local data_exists, custom_ui = pcall(require, "custom.ui")
if not data_exists then
return
end
local transparent_mode = custom_ui.transparent_mode
if transparent_mode ~= nil then
if transparent_mode == 1 then
transparent = true
end
end
require("catppuccin").setup({
flavour = "macchiato", -- latte, frappe, macchiato, mocha
background = { -- :h background
light = "latte",
dark = "macchiato",
},
transparent_background = transparent,
show_end_of_buffer = false, -- show the '~' characters after the end of buffers
term_colors = false,
dim_inactive = {
enabled = false,
shade = "dark",
percentage = 0.15,
},
no_italic = false, -- Force no italic
no_bold = false, -- Force no bold
styles = {
comments = { "italic" },
conditionals = { "italic" },
loops = {},
functions = {},
keywords = {},
strings = {},
variables = {},
numbers = {},
booleans = {},
properties = {},
types = {},
operators = {},
},
color_overrides = {},
custom_highlights = {},
integrations = {
cmp = true,
gitsigns = true,
nvimtree = true,
telescope = true,
notify = false,
mini = false,
-- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
},
})
-- local transparent = false
-- local data_exists, custom_ui = pcall(require, "custom.ui")
-- if not data_exists then
-- return
-- end
-- local transparent_mode = custom_ui.transparent_mode
-- if transparent_mode ~= nil then
-- if transparent_mode == 1 then
-- transparent = true
-- end
-- end
--
-- require("catppuccin").setup({
-- flavour = "macchiato", -- latte, frappe, macchiato, mocha
-- background = { -- :h background
-- light = "latte",
-- dark = "macchiato",
-- },
-- transparent_background = transparent,
-- show_end_of_buffer = false, -- show the '~' characters after the end of buffers
-- term_colors = false,
-- dim_inactive = {
-- enabled = false,
-- shade = "dark",
-- percentage = 0.15,
-- },
-- no_italic = false, -- Force no italic
-- no_bold = false, -- Force no bold
-- styles = {
-- comments = { "italic" },
-- conditionals = { "italic" },
-- loops = {},
-- functions = {},
-- keywords = {},
-- strings = {},
-- variables = {},
-- numbers = {},
-- booleans = {},
-- properties = {},
-- types = {},
-- operators = {},
-- },
-- color_overrides = {},
-- custom_highlights = {},
-- integrations = {
-- cmp = true,
-- gitsigns = true,
-- nvimtree = true,
-- telescope = true,
-- notify = false,
-- mini = false,
-- -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
-- },
-- })

View file

@ -1,76 +1,76 @@
local status_ok, chatgpt = pcall(require, "chatgpt")
if not status_ok then
return
end
local WELCOME_MESSAGE = [[
Welcome to ChatGPT.
]]
chatgpt.setup({
welcome_message = WELCOME_MESSAGE, -- set to "" if you don't like the fancy godot robot
loading_text = "loading",
question_sign = "", -- you can use emoji if you want e.g. 🙂
answer_sign = "", -- 🤖
max_line_length = 120,
yank_register = "+",
chat_layout = {
relative = "editor",
position = "50%",
size = {
height = "80%",
width = "80%",
},
},
settings_window = {
border = {
style = "rounded",
text = {
top = " Settings ",
},
},
},
chat_window = {
filetype = "chatgpt",
border = {
highlight = "FloatBorder",
style = "rounded",
text = {
top = " ChatGPT ",
},
},
},
chat_input = {
prompt = "",
border = {
highlight = "FloatBorder",
style = "rounded",
text = {
top_align = "center",
top = " Prompt ",
},
},
},
openai_params = {
model = "text-davinci-003",
frequency_penalty = 0,
presence_penalty = 0,
max_tokens = 300,
temperature = 0,
top_p = 1,
n = 1,
},
openai_edit_params = {
model = "code-davinci-edit-001",
temperature = 0,
top_p = 1,
n = 1,
},
keymaps = {
close = { "<C-c>", "<Esc>" },
yank_last = "<C-y>",
scroll_up = "<C-u>",
scroll_down = "<C-d>",
toggle_settings = "<C-o>",
new_session = "<C-n>",
cycle_windows = "<Tab>",
},
})
-- local status_ok, chatgpt = pcall(require, "chatgpt")
-- if not status_ok then
-- return
-- end
-- local WELCOME_MESSAGE = [[
-- Welcome to ChatGPT.
-- ]]
-- chatgpt.setup({
-- welcome_message = WELCOME_MESSAGE, -- set to "" if you don't like the fancy godot robot
-- loading_text = "loading",
-- question_sign = "", -- you can use emoji if you want e.g. 🙂
-- answer_sign = "", -- 🤖
-- max_line_length = 120,
-- yank_register = "+",
-- chat_layout = {
-- relative = "editor",
-- position = "50%",
-- size = {
-- height = "80%",
-- width = "80%",
-- },
-- },
-- settings_window = {
-- border = {
-- style = "rounded",
-- text = {
-- top = " Settings ",
-- },
-- },
-- },
-- chat_window = {
-- filetype = "chatgpt",
-- border = {
-- highlight = "FloatBorder",
-- style = "rounded",
-- text = {
-- top = " ChatGPT ",
-- },
-- },
-- },
-- chat_input = {
-- prompt = "  ",
-- border = {
-- highlight = "FloatBorder",
-- style = "rounded",
-- text = {
-- top_align = "center",
-- top = " Prompt ",
-- },
-- },
-- },
-- openai_params = {
-- model = "text-davinci-003",
-- frequency_penalty = 0,
-- presence_penalty = 0,
-- max_tokens = 300,
-- temperature = 0,
-- top_p = 1,
-- n = 1,
-- },
-- openai_edit_params = {
-- model = "code-davinci-edit-001",
-- temperature = 0,
-- top_p = 1,
-- n = 1,
-- },
-- keymaps = {
-- close = { "<C-c>", "<Esc>" },
-- yank_last = "<C-y>",
-- scroll_up = "<C-u>",
-- scroll_down = "<C-d>",
-- toggle_settings = "<C-o>",
-- new_session = "<C-n>",
-- cycle_windows = "<Tab>",
-- },
-- })

View file

@ -1,6 +1,6 @@
local status_ok, impatient = pcall(require, "impatient")
if not status_ok then
return
end
impatient.enable_profile()
-- local status_ok, impatient = pcall(require, "impatient")
-- if not status_ok then
-- return
-- end
--
-- impatient.enable_profile()

View file

@ -1,86 +1,86 @@
M = {}
local status_ok, jaq_nvim = pcall(require, "jaq-nvim")
if not status_ok then
return
end
jaq_nvim.setup({
-- Commands used with 'Jaq'
cmds = {
-- Default UI used (see `Usage` for options)
default = "term",
-- Uses external commands such as 'g++' and 'cargo'
external = {
typescript = "deno run %",
javascript = "node %",
-- markdown = "glow %",
python = "python %",
-- rust = "rustc % && ./$fileBase && rm $fileBase",
rust = "cargo run",
cpp = "g++ % -o $fileBase && ./$fileBase",
go = "go run %",
sh = "sh %",
java = "java %",
},
-- Uses internal commands such as 'source' and 'luafile'
internal = {
-- lua = "luafile %",
-- vim = "source %",
},
},
behavior = {
-- Default type
default = "terminal",
-- Start in insert mode
startinsert = false,
-- Use `wincmd p` on startup
wincmd = false,
-- Auto-save files
autosave = false,
},
-- UI settings
ui = {
-- Floating Window / FTerm settings
float = {
-- Floating window border (see ':h nvim_open_win')
border = "rounded", -- none, single, double, rounded
-- Num from `0 - 1` for measurements
height = 0.8,
width = 0.8,
x = 0.5,
y = 0.5,
-- Highlight group for floating window/border (see ':h winhl')
border_hl = "FloatBorder",
float_hl = "Normal",
-- Floating Window Transparency (see ':h winblend')
blend = 0,
},
terminal = {
-- Position of terminal
position = "bot",
-- Open the terminal without line numbers
line_no = false,
-- Size of terminal
size = 20,
},
},
})
local opts = { noremap = true, silent = true }
local keymap = vim.api.nvim_set_keymap
keymap("n", "<m-r>", ":silent only | Jaq<cr>", opts)
return M
-- M = {}
-- local status_ok, jaq_nvim = pcall(require, "jaq-nvim")
-- if not status_ok then
-- return
-- end
--
-- jaq_nvim.setup({
-- -- Commands used with 'Jaq'
-- cmds = {
-- -- Default UI used (see `Usage` for options)
-- default = "term",
--
-- -- Uses external commands such as 'g++' and 'cargo'
-- external = {
-- typescript = "deno run %",
-- javascript = "node %",
-- -- markdown = "glow %",
-- python = "python %",
-- -- rust = "rustc % && ./$fileBase && rm $fileBase",
-- rust = "cargo run",
-- cpp = "g++ % -o $fileBase && ./$fileBase",
-- go = "go run %",
-- sh = "sh %",
-- java = "java %",
-- },
--
-- -- Uses internal commands such as 'source' and 'luafile'
-- internal = {
-- -- lua = "luafile %",
-- -- vim = "source %",
-- },
-- },
--
-- behavior = {
-- -- Default type
-- default = "terminal",
--
-- -- Start in insert mode
-- startinsert = false,
--
-- -- Use `wincmd p` on startup
-- wincmd = false,
--
-- -- Auto-save files
-- autosave = false,
-- },
--
-- -- UI settings
-- ui = {
-- -- Floating Window / FTerm settings
-- float = {
-- -- Floating window border (see ':h nvim_open_win')
-- border = "rounded", -- none, single, double, rounded
--
-- -- Num from `0 - 1` for measurements
-- height = 0.8,
-- width = 0.8,
-- x = 0.5,
-- y = 0.5,
--
-- -- Highlight group for floating window/border (see ':h winhl')
-- border_hl = "FloatBorder",
-- float_hl = "Normal",
--
-- -- Floating Window Transparency (see ':h winblend')
-- blend = 0,
-- },
--
-- terminal = {
-- -- Position of terminal
-- position = "bot",
--
-- -- Open the terminal without line numbers
-- line_no = false,
--
-- -- Size of terminal
-- size = 20,
-- },
-- },
-- })
--
-- local opts = { noremap = true, silent = true }
-- local keymap = vim.api.nvim_set_keymap
--
-- keymap("n", "<m-r>", ":silent only | Jaq<cr>", opts)
-- return M

View file

@ -1,12 +1,12 @@
local status_ok, mason_null_ls = pcall(require, "mason-null-ls")
if not status_ok then
return
end
mason_null_ls.setup({
ensure_installed = {
-- Opt to list sources here, when available in mason.
},
automatic_setup = true,
handlers = {},
})
-- mason_null_ls.setup_handlers({})
-- local status_ok, mason_null_ls = pcall(require, "mason-null-ls")
-- if not status_ok then
-- return
-- end
-- mason_null_ls.setup({
-- ensure_installed = {
-- -- Opt to list sources here, when available in mason.
-- },
-- automatic_setup = true,
-- handlers = {},
-- })
-- -- mason_null_ls.setup_handlers({})

View file

@ -1,18 +1,18 @@
local sources = {}
local dap_data = pcode.dap_ensure_installed or {}
for _, nullls in pairs(dap_data) do
table.insert(sources, nullls)
end
require("mason").setup()
require("mason-nvim-dap").setup({
ensure_installed = sources,
automatic_setup = true,
handlers = {
function(config)
-- all sources with no handler get passed here
-- Keep original functionality
require("mason-nvim-dap").default_setup(config)
end,
},
})
-- local sources = {}
-- local dap_data = pcode.dap_ensure_installed or {}
-- for _, nullls in pairs(dap_data) do
-- table.insert(sources, nullls)
-- end
-- require("mason").setup()
-- require("mason-nvim-dap").setup({
-- ensure_installed = sources,
-- automatic_setup = true,
-- handlers = {
-- function(config)
-- -- all sources with no handler get passed here
--
-- -- Keep original functionality
-- require("mason-nvim-dap").default_setup(config)
-- end,
-- },
-- })

View file

@ -1,71 +1,71 @@
local status_ok, tokyonight = pcall(require, "tokyonight")
if not status_ok then
return
end
local transp = false
local sidebar = "normal" --"dark , transparent, normal"
local hilight = "#292e42"
local tras = pcode.transparent_mode or 0
if tras == 1 then
transp = true
sidebar = "transparent"
-- hilight = "#3E4254"
-- hilight = "#353a56"
hilight = "#292e42"
end
tokyonight.setup({
-- your configuration comes here
-- or leave it empty to use the default settings
style = "night", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
light_style = "day", -- The theme is used when the background is set to light
transparent = transp, -- Enable this to disable setting the background color
terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
styles = {
-- Style to be applied to different syntax groups
-- Value is any valid attr-list value for `:help nvim_set_hl`
-- local status_ok, tokyonight = pcall(require, "tokyonight")
-- if not status_ok then
-- return
-- end
-- local transp = false
-- local sidebar = "normal" --"dark , transparent, normal"
-- local hilight = "#292e42"
-- local tras = pcode.transparent_mode or 0
-- if tras == 1 then
-- transp = true
-- sidebar = "transparent"
-- -- hilight = "#3E4254"
-- -- hilight = "#353a56"
-- hilight = "#292e42"
-- end
--
-- tokyonight.setup({
-- -- your configuration comes here
-- -- or leave it empty to use the default settings
-- style = "night", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
-- light_style = "day", -- The theme is used when the background is set to light
-- transparent = transp, -- Enable this to disable setting the background color
-- terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
-- styles = {
-- -- Style to be applied to different syntax groups
-- -- Value is any valid attr-list value for `:help nvim_set_hl`
-- -- comments = { italic = true },
-- comments = { italic = true },
comments = { italic = true },
keywords = {},
functions = {},
variables = {},
-- Background styles. Can be "dark", "transparent" or "normal"
sidebars = sidebar, -- style for sidebars, see below
floats = sidebar, -- style for floating windows
},
sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]`
day_brightness = 0.2, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors
hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**.
dim_inactive = false, -- dims inactive windows
lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold
--- You can override specific color groups to use other groups or a hex color
--- function will be called with a ColorScheme table
-- @param colors ColorScheme
on_colors = function(colors)
colors.bg_highlight = hilight
colors.bg_statusline = colors.none
end,
--- You can override specific highlights to use other groups or a hex color
--- function will be called with a Highlights and ColorScheme table
--@param highlights Highlights
-- @param colors ColorScheme
on_highlights = function(highlights, colors)
highlights.NvimTreeFolderIcon = {
bg = colors.none,
fg = "#e0af68",
}
highlights.Underlined = {
underline = false,
}
highlights.NvimTreeWinSeparator = {
fg = colors.border,
}
highlights.BufferLineFill = { bg = colors.bg }
highlights.NvimTreeSpecialFile = { fg = colors.purple, underline = false }
highlights["@tag.attribute"] = { fg = colors.green1, italic = true }
-- highlights["@keyword.function"] = { fg = colors.blue, italic = true }
-- highlights["@function"] = { fg = colors.blue, italic = true }
end,
})
-- keywords = {},
-- functions = {},
-- variables = {},
-- -- Background styles. Can be "dark", "transparent" or "normal"
-- sidebars = sidebar, -- style for sidebars, see below
-- floats = sidebar, -- style for floating windows
-- },
-- sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]`
-- day_brightness = 0.2, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors
-- hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**.
-- dim_inactive = false, -- dims inactive windows
-- lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold
--
-- --- You can override specific color groups to use other groups or a hex color
-- --- function will be called with a ColorScheme table
-- -- @param colors ColorScheme
-- on_colors = function(colors)
-- colors.bg_highlight = hilight
-- colors.bg_statusline = colors.none
-- end,
--
-- --- You can override specific highlights to use other groups or a hex color
-- --- function will be called with a Highlights and ColorScheme table
-- --@param highlights Highlights
-- -- @param colors ColorScheme
-- on_highlights = function(highlights, colors)
-- highlights.NvimTreeFolderIcon = {
-- bg = colors.none,
-- fg = "#e0af68",
-- }
-- highlights.Underlined = {
-- underline = false,
-- }
-- highlights.NvimTreeWinSeparator = {
-- fg = colors.border,
-- }
-- highlights.BufferLineFill = { bg = colors.bg }
-- highlights.NvimTreeSpecialFile = { fg = colors.purple, underline = false }
-- highlights["@tag.attribute"] = { fg = colors.green1, italic = true }
-- -- highlights["@keyword.function"] = { fg = colors.blue, italic = true }
-- -- highlights["@function"] = { fg = colors.blue, italic = true }
-- end,
-- })

View file

@ -1,42 +1,42 @@
local status_ok, tokyonight = pcall(require, "tokyonight")
if not status_ok then
return
end
tokyonight.setup({
-- your configuration comes here
-- or leave it empty to use the default settings
style = "night", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
light_style = "day", -- The theme is used when the background is set to light
transparent = true, -- Enable this to disable setting the background color
terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
styles = {
-- Style to be applied to different syntax groups
-- Value is any valid attr-list value for `:help nvim_set_hl`
-- local status_ok, tokyonight = pcall(require, "tokyonight")
-- if not status_ok then
-- return
-- end
-- tokyonight.setup({
-- -- your configuration comes here
-- -- or leave it empty to use the default settings
-- style = "night", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
-- light_style = "day", -- The theme is used when the background is set to light
-- transparent = true, -- Enable this to disable setting the background color
-- terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
-- styles = {
-- -- Style to be applied to different syntax groups
-- -- Value is any valid attr-list value for `:help nvim_set_hl`
-- -- comments = { italic = true },
-- comments = { italic = true },
comments = { italic = true },
keywords = { italic = true },
functions = {},
variables = {},
-- Background styles. Can be "dark", "transparent" or "normal"
sidebars = "transparent", -- style for sidebars, see below
floats = "transparent", -- style for floating windows
},
sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]`
day_brightness = 0.2, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors
hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**.
dim_inactive = false, -- dims inactive windows
lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold
--- You can override specific color groups to use other groups or a hex color
--- function will be called with a ColorScheme table
--@param colors ColorScheme
on_colors = function(colors)
colors.bg_highlight = "#9EA0A9"
end,
--- You can override specific highlights to use other groups or a hex color
--- function will be called with a Highlights and ColorScheme table
--@param highlights Highlights
--@param colors ColorScheme
--on_highlights = function(highlights, colors) end,
})
-- keywords = { italic = true },
-- functions = {},
-- variables = {},
-- -- Background styles. Can be "dark", "transparent" or "normal"
-- sidebars = "transparent", -- style for sidebars, see below
-- floats = "transparent", -- style for floating windows
-- },
-- sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]`
-- day_brightness = 0.2, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors
-- hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**.
-- dim_inactive = false, -- dims inactive windows
-- lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold
--
-- --- You can override specific color groups to use other groups or a hex color
-- --- function will be called with a ColorScheme table
-- --@param colors ColorScheme
-- on_colors = function(colors)
-- colors.bg_highlight = "#9EA0A9"
-- end,
--
-- --- You can override specific highlights to use other groups or a hex color
-- --- function will be called with a Highlights and ColorScheme table
-- --@param highlights Highlights
-- --@param colors ColorScheme
-- --on_highlights = function(highlights, colors) end,
-- })

View file

@ -0,0 +1,236 @@
local M = {}
-- local Log = require "pcode.core.log"
local icons = vim.g.pcode_icons.kind
M.config = function()
pcode.builtin.breadcrumbs = {
active = true,
on_config_done = nil,
winbar_filetype_exclude = {
"help",
"startify",
"dashboard",
"lazy",
"neo-tree",
"neogitstatus",
"NvimTree",
"Trouble",
"alpha",
"lir",
"Outline",
"spectre_panel",
"toggleterm",
"DressingSelect",
"Jaq",
"harpoon",
"dap-repl",
"dap-terminal",
"dapui_console",
"dapui_hover",
"lab",
"notify",
"noice",
"neotest-summary",
"",
},
options = {
icons = {
Array = icons.Array .. " ",
Boolean = icons.Boolean .. " ",
Class = icons.Class .. " ",
Color = icons.Color .. " ",
Constant = icons.Constant .. " ",
Constructor = icons.Constructor .. " ",
Enum = icons.Enum .. " ",
EnumMember = icons.EnumMember .. " ",
Event = icons.Event .. " ",
Field = icons.Field .. " ",
File = icons.File .. " ",
Folder = icons.Folder .. " ",
Function = icons.Function .. " ",
Interface = icons.Interface .. " ",
Key = icons.Key .. " ",
Keyword = icons.Keyword .. " ",
Method = icons.Method .. " ",
Module = icons.Module .. " ",
Namespace = icons.Namespace .. " ",
Null = icons.Null .. " ",
Number = icons.Number .. " ",
Object = icons.Object .. " ",
Operator = icons.Operator .. " ",
Package = icons.Package .. " ",
Property = icons.Property .. " ",
Reference = icons.Reference .. " ",
Snippet = icons.Snippet .. " ",
String = icons.String .. " ",
Struct = icons.Struct .. " ",
Text = icons.Text .. " ",
TypeParameter = icons.TypeParameter .. " ",
Unit = icons.Unit .. " ",
Value = icons.Value .. " ",
Variable = icons.Variable .. " ",
},
highlight = true,
separator = " " .. pcode.icons.ui.ChevronRight .. " ",
depth_limit = 0,
depth_limit_indicator = "..",
},
}
end
M.setup = function()
local status_ok, navic = pcall(require, "nvim-navic")
if not status_ok then
return
end
M.create_winbar()
navic.setup(pcode.builtin.breadcrumbs.options)
if pcode.builtin.breadcrumbs.on_config_done then
pcode.builtin.breadcrumbs.on_config_done()
end
end
local function isempty(s)
return s == nil or s == ""
end
M.get_filename = function()
local filename = vim.fn.expand("%:t")
local extension = vim.fn.expand("%:e")
if not isempty(filename) then
local file_icon, hl_group
local devicons_ok, devicons = pcall(require, "nvim-web-devicons")
if pcode.use_icons and devicons_ok then
file_icon, hl_group = devicons.get_icon(filename, extension, { default = true })
if isempty(file_icon) then
file_icon = pcode.icons.kind.File
end
else
file_icon = ""
hl_group = "Normal"
end
local buf_ft = vim.bo.filetype
if buf_ft == "dapui_breakpoints" then
file_icon = pcode.icons.ui.Bug
end
if buf_ft == "dapui_stacks" then
file_icon = pcode.icons.ui.Stacks
end
if buf_ft == "dapui_scopes" then
file_icon = pcode.icons.ui.Scopes
end
if buf_ft == "dapui_watches" then
file_icon = pcode.icons.ui.Watches
end
-- if buf_ft == "dapui_console" then
-- file_icon = pcode.icons.ui.DebugConsole
-- end
local navic_text_hl = vim.api.nvim_get_hl(0, { name = "Normal" })
vim.api.nvim_set_hl(0, "Winbar", { fg = navic_text_hl.fg })
return " " .. "%#" .. hl_group .. "#" .. file_icon .. "%*" .. " " .. "%#Winbar#" .. filename .. "%*"
end
end
local get_gps = function()
local status_gps_ok, gps = pcall(require, "nvim-navic")
if not status_gps_ok then
return ""
end
local status_ok, gps_location = pcall(gps.get_location, {})
if not status_ok then
return ""
end
if not gps.is_available() or gps_location == "error" then
return ""
end
if not isempty(gps_location) then
return "%#NavicSeparator#" .. pcode.icons.ui.ChevronRight .. "%* " .. gps_location
else
return ""
end
end
local excludes = function()
return vim.tbl_contains(pcode.builtin.breadcrumbs.winbar_filetype_exclude or {}, vim.bo.filetype)
end
M.get_winbar = function()
if excludes() then
return
end
local value = M.get_filename()
local gps_added = false
if not isempty(value) then
local gps_value = get_gps()
value = value .. " " .. gps_value
if not isempty(gps_value) then
gps_added = true
end
end
if not isempty(value) and vim.api.nvim_get_option_value("mod", { buf = 0 }) then
-- TODO: replace with circle
local mod = "%#LspCodeLens#" .. pcode.icons.ui.Circle .. "%*"
if gps_added then
value = value .. " " .. mod
else
value = value .. mod
end
end
local num_tabs = #vim.api.nvim_list_tabpages()
if num_tabs > 1 and not isempty(value) then
local tabpage_number = tostring(vim.api.nvim_tabpage_get_number(0))
value = value .. "%=" .. tabpage_number .. "/" .. tostring(num_tabs)
end
local status_ok, _ = pcall(vim.api.nvim_set_option_value, "winbar", value, { scope = "local" })
if not status_ok then
return
end
end
M.create_winbar = function()
vim.api.nvim_create_augroup("_winbar", {})
vim.api.nvim_create_autocmd({
"CursorHoldI",
"CursorHold",
"BufWinEnter",
"BufFilePost",
"InsertEnter",
"BufWritePost",
"TabClosed",
"TabEnter",
}, {
group = "_winbar",
callback = function()
if pcode.builtin.breadcrumbs.active then
local status_ok, _ = pcall(vim.api.nvim_buf_get_var, 0, "lsp_floating_window")
if not status_ok then
-- TODO:
require("pcode.core.breadcrumbs").get_winbar()
end
end
end,
})
end
return M