3c158484cd
ci(github): Add pull request check on dev branch |
2 years ago | |
---|---|---|
.github/workflows | 2 years ago | |
assets | 2 years ago | |
autoload/lightline/colorscheme | 3 years ago | |
colors | 3 years ago | |
lua | 2 years ago | |
.editorconfig | 3 years ago | |
.gitignore | 3 years ago | |
CONTRIBUTING.md | 3 years ago | |
LICENSE.md | 3 years ago | |
README.md | 2 years ago | |
stylua.toml | 3 years ago |
README.md
Catppuccin for NeoVim
About
This port of Catppuccin is special because it was the first one and the one that originated the project itself. Given this, it's important to acknowledge that it all didn't come to be what it is now out of nowhere. So, if you are interested in knowing more about the initial stages of the theme, you can find it under the old-catppuccino
branch.
🎁 Features
- Handy CLI.
- Extensible for many use cases.
- Compile user's configuration
- Integrations with a bunch of plugins:
Usage
You can use your favorite plugin manager for this. Here are some examples with the most popular ones:
Vim-plug
Plug 'catppuccin/nvim', {'as': 'catppuccin'}
Packer.nvim
use({
"catppuccin/nvim",
as = "catppuccin"
})
Vundle
Plugin 'catppuccin/nvim', {'name': 'catppuccin'}
Setup
There are already some sane defaults that you may like, however you can change them to match your taste. These are the defaults:
dim_inactive = false,
transparent_background = false,
term_colors = false,
compile = {
enable = false,
path = vim.fn.stdpath "cache" .. "/catppuccin",
suffix = "_compiled"
},
styles = {
comments = { "italic" },
conditionals = { "italic" },
loops = {},
functions = {},
keywords = {},
strings = {},
variables = {},
numbers = {},
booleans = {},
properties = {},
types = {},
operators = {},
},
integrations = {
treesitter = true,
native_lsp = {
enabled = true,
virtual_text = {
errors = { "italic" },
hints = { "italic" },
warnings = { "italic" },
information = { "italic" },
},
underlines = {
errors = { "underline" },
hints = { "underline" },
warnings = { "underline" },
information = { "underline" },
},
},
coc_nvim = false,
lsp_trouble = false,
cmp = true,
lsp_saga = false,
gitgutter = false,
gitsigns = true,
telescope = true,
nvimtree = {
enabled = true,
show_root = true,
transparent_panel = false,
},
neotree = {
enabled = false,
show_root = true,
transparent_panel = false,
},
which_key = false,
indent_blankline = {
enabled = true,
colored_indent_levels = false,
},
dashboard = true,
neogit = false,
vim_sneak = false,
fern = false,
barbar = false,
bufferline = true,
markdown = true,
lightspeed = false,
ts_rainbow = false,
hop = false,
notify = true,
telekasten = true,
symbols_outline = true,
mini = false,
}
The way you setup the settings on your configuration varies based on whether you are using vimL for this or Lua.
For init.lua
local catppuccin = require("catppuccin")
-- configure it
catppuccin.setup(<settings>)
For init.vim
lua << EOF
local catppuccin = require("catppuccin")
-- configure it
catppuccin.setup(<settings>)
EOF
After setting things up, you can load catppuccin like so:
" Vim Script
let g:catppuccin_flavour = "frappe" " latte, frappe, macchiato, mocha
colorscheme catppuccin
-- Lua
vim.g.catppuccin_flavour = "frappe" -- latte, frappe, macchiato, mocha
vim.cmd[[colorscheme catppuccin]]
Remember that if you want to switch your Catppuccin flavour "on the fly" you may use the :Catppuccin <flavour>
command.
Note: the command has autocompletion enabled, so you can just press tab to cycle through the flavours
Configuration
Although settings already have self-explanatory names, here is where you can find info about each one of them and their classifications!
General
This settings are unrelated to any group and are independent.
transparent_background
: (Boolean) if true, disables setting the background color.term_colors
: (Boolean) if true, sets terminal colors (e.g.g:terminal_color_0
).dim_inactive
: (Boolean) if true, dims the background color of inactive window or buffer or split.
Styles
Handles the style of general hi groups (see :h highlight-args
):
comments
: (String) changed the style of the comments.functions
: (String) changed the style of the functions.keywords
: (String) changed the style of the keywords.strings
: (String) changed the style of the strings.variables
: (String) changed the style of the variables.
Integrations
These integrations allow catppuccin to set the theme of various plugins/stuff. To enable an integration you just need to set it to true
, however, there are some special integrations...
If you'd like to know which highlight groups are being affected by catppuccin, checkout this directory: lua/catppuccin/core/integrations/
.
Special Integrations
- Feline.nvim: First make sure that the kyazdani42/nvim-web-devicons plugin is installed. Then update your Feline config to use the Catppuccin components:
require("feline").setup({
components = require('catppuccin.core.integrations.feline'),
})
- Indent-blankline.nvim: setting
enabled
totrue
enables this integration.colored_indent_levels
enables char highlights per indent level. Follow the instructions here to set the latter up. - Lightline: use this to set it up (Note:
catppuccin
is the only valid colorscheme name. It will pick the one set in your config):
let g:lightline = {'colorscheme': 'catppuccin'}
- Lualine: use this to set it up (Note:
catppuccin
is the only valid theme name. It will pick the one set in your config):
require('lualine').setup {
options = {
theme = "catppuccin"
-- ... the rest of your lualine config
}
}
- Native Nvim LSP: setting
enabled
totrue
enables this integration. In the inners tables you can set the style for the diagnostics, bothvirtual_text
(what you see on the side) andunderlines
(what points directly at the thing (e.g. an error)). - NvimTree: setting
enabled
totrue
enables this integration:
integration = {
nvimtree = {
enabled = true,
show_root = true, -- makes the root folder not transparent
transparent_panel = false, -- make the panel transparent
}
}
- Neo-tree: setting
enabled
totrue
enables this integration:
integration = {
neotree = {
enabled = true,
show_root = true, -- makes the root folder not transparent
transparent_panel = false, -- make the panel transparent
}
}
Compile
Catppuccin is a highly customizable and configurable colorscheme. This does however come at the cost of complexity and execution time.
Catppuccin can pre compute the results of your configuration and store the results in a compiled lua file. We use these precached values to set it's highlights.
To enable compile enables it in setup function:
compile = {
enable = true,
path = vim.fn.stdpath "cache" .. "/catppuccin",
suffix = "_compiled"
},
By default catppuccin writes the compiled results into the system's cache directory.
Catppuccin provides these commands to work with the catppuccin compiler.
:CatppuccinCompile # Create/update the compile file
:CatppuccinClean # Delete compiled file
It's recommended to add :CatppuccinCompile
to run everytime you update your config. For example:
use {
"catppuccin/nvim",
as = "catppuccin",
run = ":CatppuccinCompile",
}
To auto-compile catppuccin after :PackerCompile
, create an autocmd PackerCompileDone
in User group
For example, if your plugin specification is in ~/.config/nvim/lua/plugins.lua
then the pattern is plugins.lua
vim.api.nvim_create_autocmd("User PackerCompileDone", {
pattern = "plugins.lua",
callback = function()
vim.cmd "CatppuccinCompile"
end,
})
Acknowledge: nightfox.nvim#compile
Extra
API
The API allows you fetch data from Catppuccin. It can be required as a Lua module:
local cp_api = require("catppuccin.api.<module>")
Modules
colors
cp_api.get_colors()
Returns a table where the key is the name of the color and the value is its hex value.
Overwriting highlight groups
Highlight groups can be overwritten like so:
catppuccin.remap({ <hi_group> = { <fields> }, })
Here is an example:
local colors = require'catppuccin.api.colors'.get_colors() -- fetch colors with API
catppuccin.remap({ Comment = { fg = colors.flamingo }, })
Overwriting colors
Colors can be overwritten using vim.g.catppucin_override_colors
:
vim.g.catppuccin_override_colors = {
base = "#ff0000",
mantle = "#242424",
crust = "#474747",
}
Hooks
Use them to execute code at certain events. These are the ones available:
Function | Description |
---|---|
before_loading() |
Before loading a colorscheme |
after_loading() |
After loading a colorscheme |
They can be used like so:
local catppuccin = require("catppuccin")
catppuccin.before_loading = function ()
print("I ran before loading Catppuccin!")
end
Autocmd
Instead of after_loading
hook, you can use autocmd event like this:
vim.api.nvim_create_autocmd("User", {
pattern = "CatppuccinLoaded",
callback = function()
local colors = require("catppuccin.api.colors").get_colors()
-- do something with colors
end
})
💝 Thanks to
Copyright © 2021-present Catppuccin Org