Catppuccin for Neovim

repository·main·Indexed 27 days ago

https://github.com/catppuccin/nvim

A highly configurable, soothing color scheme for Neovim featuring four flavors: Latte, Frappé, Macchiato, and Mocha. It includes a comprehensive setup API for customizing palettes, overriding highlight groups, and integrating with plugins such as lualine.nvim, bufferline.nvim, and lspsaga.nvim. The theme supports true color terminals and provides a compilation cache to optimize execution time.

Tokens
5.2K
Snippets
21
Records
22
Agent score
43%

What's inside catppuccin-nvim

  1. Configure lspsaga.nvim integration

    main

    To use custom Lsp Kind Icons and Colors with lspsaga.nvim, use the custom_kind() method from the Catppuccin integration module.

    require("lspsaga").setup {
        ui = {
            kind = require("catppuccin.groups.integrations.lsp_saga").custom_kind(),
        },
    }
  2. Install Catppuccin for Neovim

    main

    Install Catppuccin using your preferred Neovim plugin manager.

    Neovim 0.12+ (vim.pack)

    vim.pack.add { { src = "https://github.com/catppuccin/nvim", name = "catppuccin" } }

    lazy.nvim

    { "catppuccin/nvim", name = "catppuccin", priority = 1000 }

    packer.nvim

    use { "catppuccin/nvim", as = "catppuccin" }

    rocks.nvim

    :Rocks install catppuccin.nvim
  3. Configure reactive.nvim integration

    main

    Catppuccin provides two presets for reactive.nvim: cursor and cursorline. You can load them for any flavor (e.g., catppuccin-mocha-cursor).

    require('reactive').setup {
      load = { 'catppuccin-mocha-cursor', 'catppuccin-mocha-cursorline' }
    }
  4. Use Catppuccin colorscheme

    main

    After installation, apply the colorscheme using Vimscript or Lua.

    Vimscript

    colorscheme catppuccin-nvim " Available flavours: catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha

    Lua

    vim.cmd.colorscheme "catppuccin-nvim"
  5. Configure barbecue.nvim integration

    main

    To use Catppuccin with barbecue.nvim, enable the integration in Catppuccin and then set the theme in your barbecue configuration using one of the Catppuccin flavors (catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, or catppuccin-mocha).

    -- Catppuccin setup
    require("catppuccin").setup({
        integrations = {
            barbecue = {
                dim_dirname = true,
                bold_basename = true,
                dim_context = false,
                alt_background = false,
            },
        }
    })
    
    -- Barbecue setup
    require("barbecue").setup {
      theme = "catppuccin-nvim",
    }
  6. Configure blink.pairs integration

    main

    To use Catppuccin with blink.pairs, enable the integration and configure the highlight groups in the blink.pairs setup.

    -- Catppuccin setup
    require("catppuccin").setup({
        integrations = {
            blink_pairs = true,
        }
    })
    
    -- Blink.pairs setup
    require("blink.pairs").setup {
        highlights = {
            groups = {
                "BlinkPairsRed",
                "BlinkPairsYellow",
                "BlinkPairsBlue",
                "BlinkPairsOrange",
                "BlinkPairsGreen",
                "BlinkPairsPurple",
                "BlinkPairsCyan",
            },
        },
    }
  7. Configure feline.nvim integration

    main

    To use Catppuccin with feline.nvim, use the catppuccin.special.feline module.

    Note: Feline does not officially support custom themes. To ensure :colorscheme catppuccin-<flavour> works, use the following autocmd workaround:

    -- Workaround for theme switching
    vim.api.nvim_create_autocmd("ColorScheme", {
        pattern = "*",
        callback = function()
            package.loaded["feline"] = nil
            package.loaded["catppuccin.special.feline"] = nil
            require("feline").setup {
                components = require("catppuccin.special.feline").get_statusline(),
            }
        end,
    })
    
    -- Basic setup
    local ctp_feline = require('catppuccin.special.feline')
    ctp_feline.setup()
    require("feline").setup({
        components = ctp_feline.get_statusline(),
    })
  8. Configure bufferline.nvim integration

    main

    To use Catppuccin with bufferline.nvim, you must load bufferline.nvim after setting up Catppuccin. Use require("catppuccin.special.bufferline").get_theme() to retrieve the correct highlights. You can also pass custom styles and overrides.

    -- Example using lazy.nvim
    use "akinsho/bufferline.nvim" {
      after = "catppuccin",
      config = function()
        require("bufferline").setup {
          highlights = require("catppuccin.special.bufferline").get_theme()
        }
      end
    }
    
    -- Example with custom styles
    local mocha = require("catppuccin.palettes").get_palette "mocha"
    require("bufferline").setup {
        highlights = require("catppuccin.special.bufferline").get_theme {
            styles = { "italic", "bold" },
            custom = {
                all = {
                    fill = { bg = "#000000" },
                },
                mocha = {
                    background = { fg = mocha.text },
                },
                latte = {
                    background = { fg = "#000000" },
                },
            },
        },
    }
  9. Configure lualine.nvim integration

    main

    Catppuccin provides advanced integration for lualine.nvim, allowing you to override colors per flavor or per mode. You can use a function that consumes the current palette to create dynamic overrides.

    -- In your catppuccin config
    require("catppuccin").setup({
        integrations = {
            lualine = {
                all = function(colors) -- Applies to all flavors
                    return {
                        normal = {
                            a = { bg = colors.lavender, gui = "italic" },
                            b = { fg = colors.lavender },
                        }
                    }
                end,
                macchiato = {
                    normal = {
                        a = { bg = "#abcdef" },
                    }
                },
            },
        }
    })
    
    -- In your lualine config
    require('lualine').setup {
        options = {
            theme = "catppuccin-nvim"
        }
    }
  10. Configure Catppuccin via setup()

    main

    Use require("catppuccin").setup() to customize the theme. Note: setup() must be called before loading the colorscheme.

    Key configuration options include:

    • flavour: Set to "auto", "latte", "frappe", "macchiato", or "mocha".
    • background: Define light and dark flavours.
    • transparent_background: Boolean to disable background color.
    • styles: Customize styles (e.g., italic) for groups like comments, conditionals, strings, etc.
    • integrations: Enable/disable plugin integrations (e.g., cmp, gitsigns, nvimtree, mini).
    require("catppuccin").setup({
        flavour = "auto", -- latte, frappe, macchiato, mocha
        background = {
            light = "latte",
            dark = "mocha",
        },
        transparent_background = false,
        float = {
            transparent = false,
            solid = false,
        },
        term_colors = false,
        dim_inactive = {
            enabled = false,
            shade = "dark",
            percentage = 0.15,
        },
        no_italic = false,
        no_bold = false,
        no_underline = false,
        styles = {
            comments = { "italic" },
            conditionals = { "italic" },
            loops = {},
            functions = {},
            keywords = {},
            strings = {},
            variables = {},
            numbers = {},
            booleans = {},
            properties = {},
            types = {},
            operators = {},
        },
        lsp_styles = {
            virtual_text = {
                errors = { "italic" },
                hints = { "italic" },
                warnings = { "italic" },
                information = { "italic" },
                ok = { "italic" },
            },
            underlines = {
                errors = { "underline" },
                hints = { "underline" },
                information = { "underline" },
                ok = { "underline" },
            },
            inlay_hints = {
                background = true,
            },
        },
        color_overrides = {},
        custom_highlights = {},
        auto_integrations = true,
        integrations = {
            cmp = true,
            gitsigns = true,
            nvimtree = true,
            notify = false,
            mini = {
                enabled = true,
                indentscope_color = "",
            },
        },
    })
    
    -- setup must be called before loading
    vim.cmd.colorscheme "catppuccin-nvim"