Skip to content

Commit

Permalink
Deprecated: Configuration using vim.g.github_* removed.
Browse files Browse the repository at this point in the history
This commit includes the removal of all supportive modules from the Vim
configuration that were using `vim.g.github_*`. Please migrate to the
`setup` Lua function. Updated documentation can be found in the README.

Additionally, a new library called `deprecation` has been added for
writing deprecation warning messages.

For further information about the deprecated modules and their
replacements, please refer to the `:h github-theme.deprecated`
documentation.
  • Loading branch information
ful1e5 committed Apr 6, 2023
1 parent b888267 commit 88d4373
Show file tree
Hide file tree
Showing 11 changed files with 193 additions and 187 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

### What's New?

- Added a Deprecation library to print Deprecation Messages.

### Changes

- The `config.default` module has been changed to a variable and moved inside the `config` module.

### Deprecation

- The `config.vim_config` and `config.default` modules are now deprecated.
- The `config.apply_configuration()` function is also deprecated.

## [v0.0.7] - 16 January 2023

### Changes
Expand Down
92 changes: 0 additions & 92 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,7 @@ use({

Enable the colorscheme:

```vim
" Vim Script
colorscheme github_*
```

```lua
-- Lua
require('github-theme').setup()
```

Expand All @@ -108,26 +102,6 @@ require('github-theme').setup()
| transparent | `false` | Enable this to disable setting the background color |
| variable_style | `NONE` | Highlight style for variables and identifiers (check `:help highlight-args` for options) |

### Using `vim`

```vim
" Example config in VimScript
" NOTE: Configuration needs to be set BEFORE loading the color scheme with `colorscheme` command
let g:github_function_style = "italic"
let g:github_sidebars = ["qf", "vista_kind", "terminal", "packer"]
" Change the "hint" color to the "orange" color, and make the "error" color bright red
let g:github_colors = {
\ 'hint': 'orange',
\ 'error': '#ff0000'
\ }
" Load the colorscheme
colorscheme github_dark
```

### Using `lua`

```lua
-- Example config in Lua
require("github-theme").setup({
Expand Down Expand Up @@ -220,13 +194,7 @@ set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{25

#### Dark

```vim
" VimScript
colorscheme github_dark
```

```lua
-- Lua
require("github-theme").setup({
theme_style = "dark",
-- other config
Expand All @@ -237,13 +205,7 @@ require("github-theme").setup({

#### Dimmed

```vim
" VimScript
colorscheme github_dimmed
```

```lua
-- Lua
require("github-theme").setup({
theme_style = "dimmed",
-- other config
Expand All @@ -254,13 +216,7 @@ require("github-theme").setup({

#### Dark Default

```vim
" VimScript
colorscheme github_dark_default
```

```lua
-- Lua
require("github-theme").setup({
theme_style = "dark_default",
-- other config
Expand All @@ -271,13 +227,7 @@ require("github-theme").setup({

#### Dark Colorblind (Beta)

```vim
" VimScript
colorscheme github_dark_colorblind
```

```lua
-- Lua
require("github-theme").setup({
theme_style = "dark_colorblind",
-- other config
Expand All @@ -288,13 +238,7 @@ require("github-theme").setup({

#### Light

```vim
" VimScript
colorscheme github_light
```

```lua
-- Lua
require("github-theme").setup({
theme_style = "light",
-- other config
Expand All @@ -305,13 +249,7 @@ require("github-theme").setup({

#### Light Default

```vim
" VimScript
colorscheme github_light_default
```

```lua
-- Lua
require("github-theme").setup({
theme_style = "light_default",
-- other config
Expand All @@ -322,13 +260,7 @@ require("github-theme").setup({

#### Light Colorblind (Beta)

```vim
" VimScript
colorscheme github_light_colorblind
```

```lua
-- Lua
require("github-theme").setup({
theme_style = "light_colorblind",
-- other config
Expand All @@ -345,16 +277,7 @@ require("github-theme").setup({

#### Normal

```vim
" VimScript
let g:github_comment_style = "NONE"
let g:github_keyword_style = "NONE"
let g:github_function_style = "NONE"
let g:github_variable_style = "NONE"
```

```lua
-- Lua
require("github-theme").setup({
comment_style = "NONE",
keyword_style = "NONE",
Expand All @@ -368,16 +291,7 @@ require("github-theme").setup({

#### Italic

```vim
" VimScript
let g:github_comment_style = "italic"
let g:github_keyword_style = "italic"
let g:github_function_style = "italic"
let g:github_variable_style = "italic"
```

```lua
-- Lua
require("github-theme").setup({
comment_style = "italic",
keyword_style = "italic",
Expand All @@ -391,13 +305,7 @@ require("github-theme").setup({

### Minimal config

```vim
" VimScript
let g:github_dark_sidebar = 0
```

```lua
-- Lua
require("github-theme").setup({
dark_sidebar = false,
-- other config
Expand Down
16 changes: 16 additions & 0 deletions doc/gt_changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@

# Changelog

*github-theme.changelog-06042023*

Date: April 06, 2023

The secondary method of assigning configuration variables using
|'vim.g.github_*'| is now considered deprecated. Instead, it is recommended to
use the |'require("github-theme").setup({...})'| function to assign
configurations.

Any references to the deprecated modules and options can be found in the
documentation located at `:h gt_deprecated.txt`.



*github-theme.changelog-03012023*

Date: January 03, 2023
Expand All @@ -22,6 +36,8 @@ To ensure that the community is aware of any major changes before they are
implemented, I will provide advance warning before any potentially breaking
changes are pushed to upstream.



*github-theme.changelog-03082022*

Date: August 03, 2022
Expand Down
40 changes: 40 additions & 0 deletions doc/gt_deprecated.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
*gt_deprecated.txt* github-nvim-theme

GITHUB NVIM THEME DEPRECATION REFRENCE

github-nvim-theme *github-theme.deprecated*

The items listed below are deprecated: they will be removed in the future.
They should not be used in new scripts, and old scripts should be updated.

==============================================================================
Deprecated features


MODULES
- *'config.vim_config'* Deprecated.
- *'config.default'* Moved to |'github-theme.config'|
module and accessed with |'default'| variable.

GLOBAL OPTIONS
- *'vim.g.github_theme_style'* Use |setup| Lua function instead.
- *'vim.g.github_colors'* Use |setup| Lua function instead.
- *'vim.g.github_overrides'* Use |setup| Lua function instead.
- *'vim.g.github_dark_float'* Use |setup| Lua function instead.
- *'vim.g.github_dark_sidebar'* Use |setup| Lua function instead.
- *'vim.g.github_sidebars'* Use |setup| Lua function instead.
- *'vim.g.github_transparent'* Use |setup| Lua function instead.
- *'vim.g.github_hide_end_of_buffer'* Use |setup| Lua function instead.
- *'vim.g.github_hide_inactive_statusline'* Use |setup| Lua function instead.
- *'vim.g.github_msg_area_style'* Use |setup| Lua function instead.
- *'vim.g.github_comment_style'* Use |setup| Lua function instead.
- *'vim.g.github_function_style'* Use |setup| Lua function instead.
- *'vim.g.github_keyword_style'* Use |setup| Lua function instead.
- *'vim.g.github_variable_style'* Use |setup| Lua function instead.
- *'vim.g.github_dev'* Use |setup| Lua function instead.

FUNCTIONS
- *'config.apply_configuration()'* Deprecated.


vim:noet:tw=78:ts=8:ft=help:norl:
62 changes: 21 additions & 41 deletions lua/github-theme/config.lua
Original file line number Diff line number Diff line change
@@ -1,44 +1,24 @@
local vim_config = require('github-theme.config.vim_config')
local default_config = require('github-theme.config.default')
local M = {}
local types = require('github-theme.types')

---@class gt.Config
---@field schema gt.ConfigSchema
local config = {}

---Accessing global config using vim.g.github_* will help in autocompletion.

config.schema = {
colors = vim_config.get(vim.g.github_colors, default_config.colors),
comment_style = vim_config.get(vim.g.github_comment_style, default_config.comment_style),
dark_float = vim_config.get(vim.g.github_dark_float, default_config.dark_float),
dark_sidebar = vim_config.get(vim.g.github_dark_sidebar, default_config.dark_sidebar),
dev = vim_config.get(vim.g.github_dev, default_config.dev),
function_style = vim_config.get(vim.g.github_function_style, default_config.function_style),
hide_end_of_buffer = vim_config.get(vim.g.github_hide_end_of_buffer, default_config.hide_end_of_buffer),
hide_inactive_statusline = vim_config.get(vim.g.github_hide_inactive_statusline, default_config.hide_inactive_statusline),
keyword_style = vim_config.get(vim.g.github_keyword_style, default_config.keyword_style),
msg_area_style = vim_config.get(vim.g.github_msg_area_style, default_config.msg_area_style),
overrides = vim_config.get(vim.g.github_overrides, default_config.overrides),
sidebars = vim_config.get(vim.g.github_sidebars, default_config.sidebars),
theme_style = vim_config.get(vim.g.github_theme_style, default_config.theme_style),
transparent = vim_config.get(vim.g.github_transparent, default_config.transparent),
variable_style = vim_config.get(vim.g.github_variable_style, default_config.variable_style),
M.default = {
colors = {},
comment_style = types.gt.HighlightStyle.Italic,
dark_float = false,
dark_sidebar = true,
dev = false,
function_style = types.gt.HighlightStyle.None,
hide_end_of_buffer = true,
hide_inactive_statusline = true,
keyword_style = types.gt.HighlightStyle.Italic,
msg_area_style = types.gt.HighlightStyle.None,
overrides = function()
return {}
end,
sidebars = {},
theme_style = types.gt.ThemeStyle.Dark,
transparent = false,
variable_style = types.gt.HighlightStyle.None,
}

---Override user's configuration
---@param user_config gt.ConfigSchema
config.apply_configuration = function(user_config)
for key, value in pairs(user_config) do
if value ~= nil then
if config.schema[key] ~= nil then
-- override value
config.schema[key] = value
vim_config.set(key, value)
else
error('config ' .. key .. ' does not exist') -- luacheck: ignore
end
end
end
end

return config
return M
22 changes: 0 additions & 22 deletions lua/github-theme/config/default.lua

This file was deleted.

23 changes: 0 additions & 23 deletions lua/github-theme/config/vim_config.lua

This file was deleted.

Loading

0 comments on commit 88d4373

Please sign in to comment.