Skip to content

Tokyonight should be initialized as intended #1357

Closed
@warbacon

Description

@warbacon

Incorrect Initialization of tokyonight.nvim

I have noticed that tokyonight.nvim is being initialized in a way that is not aligned with the recommended approach by @folke.

Expected Initialization

According to the official README, the proper way to install and initialize the plugin is:

{
  "folke/tokyonight.nvim",
  lazy = false,
  priority = 1000,
  opts = {},
}

This does not set the colorscheme; it only initializes the plugin. However, it is important to call setup() before configuring the theme. This is because tokyonight.nvim applies only the necessary highlight groups based on the installed plugins, which helps optimize startup time.

Correct Way to Apply the Colorscheme

To properly apply the colorscheme, the configuration should look like this:

{
  "folke/tokyonight.nvim",
  lazy = false,
  priority = 1000,
  config = function()
    require("tokyonight").setup()
    vim.cmd.colorscheme("tokyonight")
  end
}

Disabling Italics in Comments (as Kickstart Does)

If you want to disable italics in comments, similar to what Kickstart currently does, use:

{
  "folke/tokyonight.nvim",
  lazy = false,
  priority = 1000,
  config = function()
    require("tokyonight").setup({
      styles = {
        comments = { italic = false },
      },
    })
    vim.cmd.colorscheme("tokyonight")
  end
}

Alternative Method (Less Documented in lazy.nvim)

Although not well-documented in lazy.nvim, you can also achieve the same effect with:

{
  "folke/tokyonight.nvim",
  priority = 1000,
  opts = {
    styles = {
      comments = { italic = false },
    },
  },
  config = function(_, opts)
    require("tokyonight").setup(opts)
    vim.cmd.colorscheme("tokyonight-night")
  end,
}

Would it be possible to align the initialization of tokyonight.nvim with the recommended approach?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions