Skip to content

Commit

Permalink
Merge branch 'main' into extra/aerc
Browse files Browse the repository at this point in the history
  • Loading branch information
folke authored Jul 4, 2024
2 parents 96237c7 + 2562a63 commit 3d4ca10
Show file tree
Hide file tree
Showing 211 changed files with 9,146 additions and 5,872 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.2.0"
}
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"]
}
}
}
40 changes: 26 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
jobs:
extras:
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Install Neovim
shell: bash
Expand All @@ -17,12 +16,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 +36,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 +50,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' }}
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'folke' }}
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 -u tests/minit.lua -l lua/tokyonight/docs.lua
- name: panvimdoc
uses: kdheepak/panvimdoc@main
with:
Expand All @@ -67,26 +79,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
108 changes: 108 additions & 0 deletions .lazy.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
local M = {
module = "tokyonight",
colorscheme = "tokyonight",
opts = { style = "moon", plugins = { all = true } },
globals = { vim = vim },
cache = {}, ---@type table<string, boolean>
}

function M.reset()
require("tokyonight.util").cache.clear()
local colors = require("tokyonight.colors").setup()
M.globals.colors = colors
M.globals.c = colors
end

---@param name string
---@param buf number
function M.hl_group(name, buf)
return vim.api.nvim_buf_get_name(buf):find("kinds") and "LspKind" .. name or name
end

local function reload()
for k in pairs(package.loaded) do
if k:find("^" .. M.module) then
package.loaded[k] = nil
end
end
M.cache = {}
require(M.module).setup(M.opts)
M.reset()
local colorscheme = vim.g.colors_name or M.colorscheme
colorscheme = colorscheme:find(M.colorscheme) and colorscheme or M.colorscheme
vim.cmd.colorscheme(colorscheme)
local hi = require("mini.hipatterns")
for _, buf in ipairs(require("mini.hipatterns").get_enabled_buffers()) do
hi.update(buf)
end
end
reload = vim.schedule_wrap(reload)

local augroup = vim.api.nvim_create_augroup("colorscheme_dev", { clear = true })
vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy",
group = augroup,
callback = reload,
})
vim.api.nvim_create_autocmd("BufWritePost", {
group = augroup,
pattern = "*/lua/" .. M.module .. "/**.lua",
callback = reload,
})

return {
{
"echasnovski/mini.hipatterns",
opts = function(_, opts)
local hi = require("mini.hipatterns")

opts.highlighters = opts.highlighters or {}

opts.highlighters = vim.tbl_extend("keep", opts.highlighters or {}, {
hex_color = hi.gen_highlighter.hex_color({ priority = 2000 }),

hl_group = {
pattern = function(buf)
return vim.api.nvim_buf_get_name(buf):find("lua/" .. M.module) and '^%s*%[?"?()[%w%.@]+()"?%]?%s*='
end,
group = function(buf, match)
local group = M.hl_group(match, buf)
if group then
if M.cache[group] == nil then
M.cache[group] = false
local hl = vim.api.nvim_get_hl(0, { name = group, link = false, create = false })
if not vim.tbl_isempty(hl) then
hl.fg = hl.fg or vim.api.nvim_get_hl(0, { name = "Normal", link = false }).fg
M.cache[group] = true
vim.api.nvim_set_hl(0, group .. "Dev", hl)
end
end
return M.cache[group] and group .. "Dev" or nil
end
end,
extmark_opts = { priority = 2000 },
},

hl_color = {
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 color = vim.tbl_get(M.globals, unpack(parts))
return type(color) == "string" and require("mini.hipatterns").compute_hex_color_group(color, "fg")
end,
extmark_opts = function(_, _, data)
return {
virt_text = { { "", data.hl_group } },
virt_text_pos = "inline",
priority = 2000,
}
end,
},
})
end,
},
}
Loading

0 comments on commit 3d4ca10

Please sign in to comment.