docs: added extras to docs

This commit is contained in:
Folke Lemaitre 2023-04-22 10:30:43 +02:00
parent ee1ebf7bc4
commit d5ff62d399
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
2 changed files with 83 additions and 52 deletions

View File

@ -22,39 +22,33 @@ extra themes for Kitty, Alacritty, iTerm and Fish.
## ✨ Features ## ✨ Features
- supports the latest Neovim 5.0 features like TreeSitter and LSP - supports the latest Neovim 0.9.0 features
- minimal inactive statusline - terminal colors
- vim terminal colors
- darker background for sidebar-like windows - darker background for sidebar-like windows
- color configs for - supports all major plugins
[Kitty](https://sw.kovidgoyal.net/kitty/conf.html?highlight=include), - TokyoNight [extras](#-extras) for a lot of other apps
[Alacritty](https://github.com/alacritty/alacritty) and
[Fish Shell](https://fishshell.com/)
- **lualine** theme
### Plugin Support ### 🍭 Extras
- [TreeSitter](https://github.com/nvim-treesitter/nvim-treesitter) <!-- extras:start -->
- [LSP Diagnostics](https://neovim.io/doc/user/lsp.html) - [Alacritty](https://github.com/alacritty/alacritty) ([alacritty](tree/main/extras/alacritty))
- [LSP Trouble](https://github.com/folke/lsp-trouble.nvim) - [Delta](https://github.com/dandavison/delta) ([delta](tree/main/extras/delta))
- [LSP Saga](https://github.com/glepnir/lspsaga.nvim) - [Fish](https://fishshell.com/docs/current/index.html) ([fish](tree/main/extras/fish))
- [Git Signs](https://github.com/lewis6991/gitsigns.nvim) - [Fish Themes](https://fishshell.com/docs/current/interactive.html#syntax-highlighting) ([fish_themes](tree/main/extras/fish_themes))
- [Git Gutter](https://github.com/airblade/vim-gitgutter) - [Foot](https://codeberg.org/dnkl/foot) ([foot](tree/main/extras/foot))
- [Telescope](https://github.com/nvim-telescope/telescope.nvim) - [iTerm](https://iterm2.com/) ([iterm](tree/main/extras/iterm))
- [NvimTree](https://github.com/kyazdani42/nvim-tree.lua) - [Kitty](https://sw.kovidgoyal.net/kitty/conf.html) ([kitty](tree/main/extras/kitty))
- [WhichKey](https://github.com/liuchengxu/vim-which-key) - [Lua Table for testing](https://www.lua.org) ([lua](tree/main/extras/lua))
- [Indent Blankline](https://github.com/lukas-reineke/indent-blankline.nvim) - [Prism](https://prismjs.com) ([prism](tree/main/extras/prism))
- [Dashboard](https://github.com/glepnir/dashboard-nvim) - [Sublime Text](https://www.sublimetext.com/docs/themes) ([sublime](tree/main/extras/sublime))
- [BufferLine](https://github.com/akinsho/nvim-bufferline.lua) - [Terminator](https://gnome-terminator.readthedocs.io/en/latest/config.html) ([terminator](tree/main/extras/terminator))
- [Barbecue](https://github.com/utilyre/barbecue.nvim) - [Tilix](https://github.com/gnunn1/tilix) ([tilix](tree/main/extras/tilix))
- [Lualine](https://github.com/hoob3rt/lualine.nvim) - [Tmux](https://github.com/tmux/tmux/wiki) ([tmux](tree/main/extras/tmux))
- [Lightline](https://github.com/itchyny/lightline.vim) - [WezTerm](https://wezfurlong.org/wezterm/config/) ([wezterm](tree/main/extras/wezterm))
- [Neogit](https://github.com/TimUntersberger/neogit) - [Windows Terminal](https://aka.ms/terminal-documentation) ([windows_terminal](tree/main/extras/windows_terminal))
- [vim-sneak](https://github.com/justinmk/vim-sneak) - [Xfce Terminal](https://docs.xfce.org/apps/terminal/advanced) ([xfceterm](tree/main/extras/xfceterm))
- [Fern](https://github.com/lambdalisue/fern.vim) - [Xresources](https://wiki.archlinux.org/title/X_resources) ([xresources](tree/main/extras/xresources))
- [Barbar](https://github.com/romgrk/barbar.nvim) <!-- extras:end -->
- [Scrollbar](https://github.com/petertriho/nvim-scrollbar)
- [Mini](https://github.com/echasnovski/mini.nvim)
## ⚡️ Requirements ## ⚡️ Requirements

View File

@ -1,5 +1,28 @@
local M = {} local M = {}
-- map of plugin name to plugin extension
--- @type table<string, {ext:string, url:string, label:string}>
-- stylua: ignore
M.extras = {
kitty = {ext = "conf", url = "https://sw.kovidgoyal.net/kitty/conf.html", label = "Kitty"},
fish = {ext = "fish", url = "https://fishshell.com/docs/current/index.html", label = "Fish"},
fish_themes = {ext = "theme", url = "https://fishshell.com/docs/current/interactive.html#syntax-highlighting", label = "Fish Themes"},
alacritty = {ext = "yml", url = "https://github.com/alacritty/alacritty", label = "Alacritty"},
wezterm = {ext = "toml", url = "https://wezfurlong.org/wezterm/config/", label = "WezTerm"},
tmux = {ext = "tmux", url = "https://github.com/tmux/tmux/wiki", label = "Tmux"},
xresources = {ext = "Xresources", url = "https://wiki.archlinux.org/title/X_resources", label = "Xresources"},
xfceterm = {ext = "theme", url = "https://docs.xfce.org/apps/terminal/advanced", label = "Xfce Terminal"},
foot = {ext = "ini", url = "https://codeberg.org/dnkl/foot", label = "Foot"},
tilix = {ext = "json", url = "https://github.com/gnunn1/tilix", label = "Tilix"},
iterm = {ext = "itermcolors", url = "https://iterm2.com/", label = "iTerm"},
lua = {ext = "lua", url = "https://www.lua.org", label = "Lua Table for testing"},
sublime = {ext = "tmTheme", url = "https://www.sublimetext.com/docs/themes", label = "Sublime Text"},
delta = {ext = "gitconfig", url = "https://github.com/dandavison/delta", label = "Delta"},
terminator = {ext = "conf", url = "https://gnome-terminator.readthedocs.io/en/latest/config.html", label = "Terminator"},
prism = {ext = "js", url = "https://prismjs.com", label = "Prism"},
windows_terminal = {ext = "json", url = "https://aka.ms/terminal-documentation", label = "Windows Terminal"},
}
local function write(str, fileName) local function write(str, fileName)
print("[write] extra/" .. fileName) print("[write] extra/" .. fileName)
vim.fn.mkdir(vim.fs.dirname("extras/" .. fileName), "p") vim.fn.mkdir(vim.fs.dirname("extras/" .. fileName), "p")
@ -8,30 +31,44 @@ local function write(str, fileName)
file:close() file:close()
end end
function M.read_file(file)
local fd = assert(io.open(file, "r"))
---@type string
local data = fd:read("*a")
fd:close()
return data
end
function M.write_file(file, contents)
local fd = assert(io.open(file, "w+"))
fd:write(contents)
fd:close()
end
function M.docs()
local file = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":p:h:h:h:h") .. "/README.md"
local tag = "extras"
local pattern = "(<%!%-%- " .. tag .. ":start %-%->).*(<%!%-%- " .. tag .. ":end %-%->)"
local readme = M.read_file(file)
local lines = {}
local names = vim.tbl_keys(M.extras)
table.sort(names)
for _, name in ipairs(names) do
info = M.extras[name]
table.insert(
lines,
"- [" .. info.label .. "](" .. info.url .. ") ([" .. name .. "](tree/main/extras/" .. name .. "))"
)
end
readme = readme:gsub(pattern, "%1\n" .. table.concat(lines, "\n") .. "\n%2")
M.write_file(file, readme)
end
function M.setup() function M.setup()
M.docs()
local config = require("tokyonight.config") local config = require("tokyonight.config")
vim.o.background = "dark" vim.o.background = "dark"
-- map of plugin name to plugin extension
local extras = {
kitty = "conf",
fish = "fish",
fish_themes = "theme",
alacritty = "yml",
wezterm = "toml",
tmux = "tmux",
xresources = "Xresources",
xfceterm = "theme",
foot = "ini",
tilix = "json",
iterm = "itermcolors",
lua = "lua",
sublime = "tmTheme",
delta = "gitconfig",
terminator = "conf",
prism = "js",
windows_terminal = "json",
}
-- map of style to style name -- map of style to style name
local styles = { local styles = {
storm = " Storm", storm = " Storm",
@ -40,13 +77,13 @@ function M.setup()
moon = " Moon", moon = " Moon",
} }
for extra, ext in pairs(extras) do for extra, info in pairs(M.extras) do
package.loaded["tokyonight.extra." .. extra] = nil package.loaded["tokyonight.extra." .. extra] = nil
local plugin = require("tokyonight.extra." .. extra) local plugin = require("tokyonight.extra." .. extra)
for style, style_name in pairs(styles) do for style, style_name in pairs(styles) do
config.setup({ style = style }) config.setup({ style = style })
local colors = require("tokyonight.colors").setup({ transform = true }) local colors = require("tokyonight.colors").setup({ transform = true })
local fname = extra .. "/tokyonight_" .. style .. "." .. ext local fname = extra .. "/tokyonight_" .. style .. "." .. info.ext
colors["_upstream_url"] = "https://github.com/folke/tokyonight.nvim/raw/main/extras/" .. fname colors["_upstream_url"] = "https://github.com/folke/tokyonight.nvim/raw/main/extras/" .. fname
colors["_style_name"] = "Tokyo Night" .. style_name colors["_style_name"] = "Tokyo Night" .. style_name
write(plugin.generate(colors), fname) write(plugin.generate(colors), fname)