Skip to content

Commit

Permalink
Merge branch 'main' into slack-theme
Browse files Browse the repository at this point in the history
  • Loading branch information
folke authored Jul 4, 2024
2 parents 78fb3d6 + 3839702 commit f0fc9e4
Show file tree
Hide file tree
Showing 196 changed files with 8,271 additions and 5,963 deletions.
3 changes: 3 additions & 0 deletions .github/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "4.1.3"
}
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ body:
label: Repro
description: Minimal `init.lua` to reproduce this issue. Save as `repro.lua` and run with `nvim -u repro.lua`
value: |
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
Expand All @@ -74,9 +73,10 @@ body:
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
"folke/tokyonight.nvim",
-- add any other plugins here
{
"folke/tokyonight.nvim",
opts = {},
}
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
Expand Down
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
28 changes: 28 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
core:
- all:
- changed-files:
- any-glob-to-any-file: "lua/tokyonight/**"
- all-globs-to-all-files:
- "!lua/tokyonight/groups/**"
- "!lua/tokyonight/colors/**"
- "!lua/tokyonight/extra/**"

extras:
- changed-files:
- any-glob-to-any-file: "lua/tokyonight/extra/**"

groups:
- changed-files:
- any-glob-to-any-file: "lua/tokyonight/groups/**"

base:
- changed-files:
- any-glob-to-any-file:
- "lua/tokyonight/groups/base.lua"
- "lua/tokyonight/groups/kinds.lua"
- "lua/tokyonight/groups/treesitter.lua"
- "lua/tokyonight/groups/semantic_tokens.lua"

colors:
- changed-files:
- any-glob-to-any-file: "lua/tokyonight/colors/**"
9 changes: 9 additions & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"packages": {
".": {
"release-type": "simple",
"extra-files": ["lua/tokyonight/config.lua"]
}
}
}
37 changes: 25 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
chmod a+x ./nvim.appimage
./nvim.appimage --appimage-extract
echo "/tmp/nvim/squashfs-root/usr/bin/" >> $GITHUB_PATH
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build Extras
run: |
nvim -u NONE -E -R --headless --cmd "set rtp^=." --cmd "packloadall" --cmd "lua require('tokyonight.extra').setup()" --cmd qa
- name: Push changes
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore(build): auto-generate extras"
commit_user_name: "github-actions[bot]"
Expand All @@ -37,7 +37,7 @@ jobs:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Neovim
shell: bash
run: |
Expand All @@ -51,14 +51,27 @@ jobs:
run: |
nvim --version
[ ! -d tests ] && exit 0
nvim --headless -u tests/init.lua -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/init.lua', sequential = true}"
./tests/run
docs:
runs-on: ubuntu-latest
needs: tests
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: git pull
- name: Install Neovim
shell: bash
run: |
mkdir -p /tmp/nvim
wget -q https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage -O /tmp/nvim/nvim.appimage
cd /tmp/nvim
chmod a+x ./nvim.appimage
./nvim.appimage --appimage-extract
echo "/tmp/nvim/squashfs-root/usr/bin/" >> $GITHUB_PATH
- name: Generate docs
run: |
nvim --version
nvim -l tests/docs.lua
- name: panvimdoc
uses: kdheepak/panvimdoc@main
with:
Expand All @@ -67,26 +80,26 @@ jobs:
demojify: true
treesitter: true
- name: Push changes
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore(build): auto-generate vimdoc"
commit_user_name: "github-actions[bot]"
commit_user_email: "github-actions[bot]@users.noreply.github.com"
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
release:
name: release
if: ${{ github.ref == 'refs/heads/main' }}
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'folke' }}
needs:
- docs
- tests
- docs
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
- uses: googleapis/release-please-action@v4
id: release
with:
release-type: simple
package-name: tokyonight.nvim
- uses: actions/checkout@v3
config-file: .github/release-please-config.json
manifest-file: .github/.release-please-manifest.json
- uses: actions/checkout@v4
- name: tag stable versions
if: ${{ steps.release.outputs.release_created }}
run: |
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Pull Request Labeler"
on:
- pull_request_target

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
41 changes: 41 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Lint PR"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: read

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
requireScope: true
subjectPattern: ^(?![A-Z]).+$
scopes: |
.+
types: |
build
chore
ci
docs
feat
fix
merge
perf
refactor
revert
style
test
wip
ignoreLabels: |
autorelease: pending
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
tt.*
.tests
.docs
doc/tags
debug
.repro
Expand Down
122 changes: 122 additions & 0 deletions .lazy.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
--# selene: allow(global_usage)
--# selene: allow(mixed_table)

local Util = require("tokyonight.util")

local colors ---@type ColorScheme
local cache = {} ---@type table<string,table<string,string>>
local hl_groups = {} ---@type table<string,boolean>

---@param hl tokyonight.Highlight|string
local function get_hl_group(hl)
local group = "TokyonightDev" .. vim.inspect(hl):gsub("%W+", "_")
if not hl_groups[group] then
hl = type(hl) == "string" and { link = hl } or hl
hl = vim.deepcopy(hl, true)
Util.resolve({ foo = hl })
hl.fg = hl.fg or colors.fg
vim.api.nvim_set_hl(0, group, hl)
hl_groups[group] = true
end
return group
end

local function get_group(buf)
local fname = vim.api.nvim_buf_get_name(buf or 0)
fname = vim.fs.normalize(fname)
if not fname:find("lua/tokyonight/groups") then
return
end
return vim.fn.fnamemodify(fname, ":t:r")
end

local function load(group)
if cache[group] then
return
end
cache[group] = {}
local opts
colors, opts = require("tokyonight.colors").setup(opts)
local highlights = require("tokyonight.groups").get(group, colors, opts)
for k, v in pairs(highlights) do
cache[group][k] = get_hl_group(v)
end
end

vim.api.nvim_create_autocmd("BufWritePost", {
group = vim.api.nvim_create_augroup("tokyonight_dev", { clear = true }),
pattern = "*/lua/tokyonight/**.lua",
callback = vim.schedule_wrap(function(ev)
local opts = require("tokyonight.config").options
for k in pairs(package.loaded) do
if k:find("^tokyonight") then
package.loaded[k] = nil
end
end
require("tokyonight").setup(opts)
require("tokyonight.util").cache.clear()
vim.cmd.colorscheme(vim.g.colors_name)
hl_groups = {}
local hi = require("mini.hipatterns")
local group = get_group(ev.buf)
if group then
cache[group] = nil
end
for _, buf in ipairs(hi.get_enabled_buffers()) do
hi.update(buf)
end
end),
})

return {
{
"echasnovski/mini.hipatterns",
opts = function(_, opts)
opts.highlighters = opts.highlighters or {}
opts.highlighters.tokyonight = {
pattern = function(buf)
local group = get_group(buf)
if not group or group == "init" then
return
end
load(group)
return group and '^%s*%[?"?()[%w%.@]+()"?%]?%s*='
end,
group = function(buf, match, data)
local name = get_group(buf)
if name == "kinds" then
match = "LspKind" .. match
end
return name and cache[name][match]
end,
extmark_opts = { priority = 2000 },
}

opts.highlighters.tokyonight_colors = {
pattern = {
"%f[%w]()c%.[%w_%.]+()%f[%W]",
"%f[%w]()colors%.[%w_%.]+()%f[%W]",
"%f[%w]()vim%.g%.terminal_color_%d+()%f[%W]",
},
group = function(_, match)
local parts = vim.split(match, ".", { plain = true })
local t = _G --[[@as table]]
if parts[1]:sub(1, 1) == "c" then
table.remove(parts, 1)
colors = colors or require("tokyonight.colors").setup()
t = colors
end
local color = vim.tbl_get(t, unpack(parts))
return type(color) == "string" and get_hl_group({ fg = color })
end,
extmark_opts = function(_, _, data)
return {
virt_text = { { "", data.hl_group } },
virt_text_pos = "inline",
priority = 2000,
}
end,
}
end,
},
}
Loading

0 comments on commit f0fc9e4

Please sign in to comment.