• Stars
    star
    243
  • Rank 162,512 (Top 4 %)
  • Language
    Lua
  • Created almost 2 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A theme for Neovim with support for LSP, Treesitter, Telescope, and more.


A customisable theme for Neovim with support for popular Neovim plugins. Written in Lua.



Lua Python
nvim-tree telescope.nvim
nvim-cmp Transparent background

Features


Requirements

Important
Some plugin integrations require Neovim v0.8. If your Neovim version doesn't support a plugin integration, Tundra displays a warning message when enabling that integration. Use Neovim v0.8.0 or higher, or downgrade to Tundra v0.1.0 to avoid warning messages.

  • A terminal with true colour support.

Note
The default macOS terminal doesn't support true colour. Use a terminal that supports true colour such as iTerm2.


Installation

Install Tundra with your favourite package manager.

use 'sam4llis/nvim-tundra' -- packer.nvim
Plug 'sam4llis/nvim-tundra' " vim-plug

Usage

To use Tundra's default configuration, add the following to your Neovim configuration:

vim.opt.background = 'dark'
vim.cmd('colorscheme tundra')

Configuration

Tundra provides a setup function to overwrite default settings. Omitted fields in the setup function default to their respective default configuration setting. The creator of Tundra recommends the following configuration as a starting point:

require('nvim-tundra').setup({
  transparent_background = false,
  dim_inactive_windows = {
    enabled = false,
    color = nil,
  },
  sidebars = {
    enabled = true,
    color = nil,
  },
  editor = {
    search = {},
    substitute = {},
  },
  syntax = {
    booleans = { bold = true, italic = true },
    comments = { bold = true, italic = true },
    conditionals = {},
    constants = { bold = true },
    fields = {},
    functions = {},
    keywords = {},
    loops = {},
    numbers = { bold = true },
    operators = { bold = true },
    punctuation = {},
    strings = {},
    types = { italic = true },
  },
  diagnostics = {
    errors = {},
    warnings = {},
    information = {},
    hints = {},
  },
  plugins = {
    lsp = true,
    semantic_tokens = true,
    treesitter = true,
    telescope = true,
    nvimtree = true,
    cmp = true,
    context = true,
    dbui = true,
    gitsigns = true,
    neogit = true,
    textfsm = true,
  },
  overwrite = {
    colors = {},
    highlights = {},
  },
})

vim.opt.background = 'dark'
vim.cmd('colorscheme tundra')

You must invoke the setup function before the :colorscheme tundra command to respect your configuration settings.

Note
You can omit empty tables and nil fields in the configuration table to respect default settings.

Special integrations

lualine.nvim

To use the Tundra integration for lualine.nvim, add the following to your Neovim configuration:

require('lualine').setup({
  options = {
    -- ...
    theme = 'tundra',
    -- ...
  },
})

Settings

General

  • transparent_background (boolean): If true, certain highlight groups inherit a transparent background. Defaults to false.

  • dim_inactive_windows (table):

    • enabled (boolean): If true, non-current windows inherit the background colour color. Defaults to false.

    • color (string | nil): A hexadecimal colour value or colour keyword that the background of non-current windows inherits. If nil, non-current windows use the default colour for dimmed windows. Defaults to nil.

  • sidebars (table):

    • enabled (boolean): If true, all 'sidebar' windows (outlined below) inherit the background colour color. Defaults to false.

    • color (string | nil): A hexadecimal colour value or colour keyword that the background of 'sidebar' windows inherits. If nil, all 'sidebar' windows use the default colour for 'sidebar' windows. Defaults to nil.

    • filetypes (array[str] table): Defines filetypes treated as 'sidebar' windows. Leaving filetypes as an empty table inherits the default filetypes. Adding a filetype to filetypes overwrites the default filetypes. Defaults to sidebars.filetypes.

Note
You can toggle general settings using the :Tundra command line sugar.

Plugins

The plugins subtable in the Tundra setup function activates plugin-specific highlight groups for supported plugins. The base configuration implicitly enables native LSP and nvim-treesitter by default. Enabling other supported plugins requires a setup function call.

For example, to use Tundra's telescope.nvim highlight groups:

require('nvim-tundra').setup({
  -- ...
  plugins = {
    telescope = true,
  },
  -- ...
})

Miscellaneous

In the preceding example configuration the editor, syntax, and diagnostics subtables provide an interface to overwrite styles for specific elements. Each field within these subtables can accept any key from h: highlight args as a boolean.

  • A common use-case for editor subtable involves reversing the highlight groups for the search and substitute fields by adding a reverse = true flag to the respective field.

  • Conventionally, syntactic elements like booleans and functions use the syntax subtable to add key-value pairs such as bold = true and italic = true.

  • A common use-case for the diagnostic subtable involves changing the foreground or background colour of diagnostic groups using the respective fg = '<HEX_VALUE>' or bg = '<HEX_VALUE>' flags.


Command line sugar

You can change Tundra configuration settings in real-time using the :Tundra command.

  • :Tundra toggle_transparency: Toggles the transparent_background option specified in the Tundra setup function.

  • :Tundra toggle_dim: Toggles the dim_inactive_windows.enabled option specified in the Tundra setup function.

  • :Tundra toggle_sidebars: Toggles the sidebars.enabled option specified in the Tundra setup function.


Customising highlights

Overwriting syntax groups

The syntax subtable in Tundra's setup function can accept foreground or background colours to overwrite syntax highlight groups. As an example, if you want to change boolean elements from an orange shade to an indigo shade, you can add the following to the setup function in your configuration:

local cp = require('nvim-tundra.palette.arctic')

require('nvim-tundra').setup({
  -- ...
  syntax = {
    -- ...
    booleans = { fg = cp.indigo._400, bold = true, italic = true },
    -- ...
  },
  -- ...
})

The fg and bg flags also accept hexadecimal values if you want to add your own colours.

Note
Colour shades in Tundra palettes range from 0 to 1000. These numbers represent the lightest and darkest shades of each colour. Shades typically increment in values of 100.

Overwriting Tundra colours

To change a particular colour in the Tundra theme, add it to the overwrite.colors subtable in the Tundra setup function. As an example, if you want to change the sky._500 colour to a custom shade of blue, you can add the following to the setup function in your configuration:

require('nvim-tundra').setup({
  -- ...
  overwrite = {
    colors = {
      sky = {
        _500 = '#6EABCF', -- An `ocean` colour instead of `sky`.
      },
    },
  },
  -- ...
})
Overwriting highlight groups

To change a highlight group in the Tundra theme, add it to the overwrite.highlights subtable in the Tundra setup function. As an example, if you want to change the @field treesitter highlight group to have a bold and red foreground you can add the following to the setup function in your configuration:

local cp = require('nvim-tundra.palette.arctic')

require('nvim-tundra').setup({
  -- ...
  overwrite = {
    highlights = {
      ['@field'] = { fg = cp.red._400, bold = true },
    },
  },
  -- ...
})

Important
Highlights defined in the overwrite.highlights subtable take precedence over highlights defined in the editor and syntax subtables in Tundra's setup function.


Extras

The extras folder of this repository contains configurations for Alacritty, fzf, iTerm-2, Kitty, WezTerm, and Windows Terminal. To use these configurations, refer to the respective documentation.


Supported plugins


Acknowledgements

  • The Catppuccin colorscheme for Neovim, for inspiring the extensible user configuration options for Tundra.

  • The Nightfox colorscheme for Neovim, for inspiring the distinction between colors and palettes for Tundra.

  • The NvChad configuration, for inspiring the UI and highlight groups for Telescope.

  • Logo inspired from the artist RNH.