mirror of
https://github.com/catppuccin/nvim
synced 2024-09-16 13:24:08 +02:00
feat: add vim support (#340)
This commit is contained in:
parent
0184121f9d
commit
d1c3eb0409
21 changed files with 269 additions and 123 deletions
8
README.md
vendored
8
README.md
vendored
|
@ -117,7 +117,7 @@ vim.cmd.colorscheme "catppuccin"
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
|
|
||||||
You may pass a lua table to the setup() function in order to edit any of Catppuccin's settings:
|
There is no need to call `setup` if you don't want to change the default options and settings.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
require("catppuccin").setup({
|
require("catppuccin").setup({
|
||||||
|
@ -155,10 +155,14 @@ require("catppuccin").setup({
|
||||||
gitsigns = true,
|
gitsigns = true,
|
||||||
nvimtree = true,
|
nvimtree = true,
|
||||||
telescope = true,
|
telescope = true,
|
||||||
treesitter = true,
|
notify = false,
|
||||||
|
mini = false,
|
||||||
-- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
|
-- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- setup must be called before loading
|
||||||
|
vim.cmd.colorscheme "catppuccin"
|
||||||
```
|
```
|
||||||
|
|
||||||
Although settings already have self-explanatory names, here is where you can find info about each one of them and their classifications!
|
Although settings already have self-explanatory names, here is where you can find info about each one of them and their classifications!
|
||||||
|
|
21
autoload/clap/themes/catppuccin.vim
vendored
21
autoload/clap/themes/catppuccin.vim
vendored
|
@ -1 +1,20 @@
|
||||||
let g:clap#themes#catppuccin#palette = luaeval('require("catppuccin.utils.clap")')
|
let s:c = has("nvim") == 1 ? luaeval('require("catppuccin.palettes").get_palette()') : luaeval('vim.dict(require("catppuccin.palettes").get_palette())')
|
||||||
|
|
||||||
|
let s:p = {}
|
||||||
|
|
||||||
|
let s:p.display = { 'guibg': s:c.mantle }
|
||||||
|
|
||||||
|
let s:p.input = s:p.display
|
||||||
|
let s:p.indicator = { 'guifg': s:c.subtext1, 'guibg': s:c.mantle }
|
||||||
|
let s:p.spinner = { 'guifg': s:c.yellow, 'guibg': s:c.mantle, 'gui': "bold" }
|
||||||
|
let s:p.search_text = { 'guifg': s:c.text, 'guibg': s:c.mantle, 'gui': "bold" }
|
||||||
|
|
||||||
|
let s:p.preview = { 'guibg': s:c.base }
|
||||||
|
|
||||||
|
let s:p.selected = { 'guifg': s:c.sapphire, 'gui': "bold,underline" }
|
||||||
|
let s:p.current_selection = { 'guibg': s:c.surface0, 'gui': "bold" }
|
||||||
|
|
||||||
|
let s:p.selected_sign = { 'guifg': s:c.red }
|
||||||
|
let s:p.current_selection_sign = copy(s:p.selected_sign)
|
||||||
|
|
||||||
|
let g:clap#themes#catppuccin#palette = s:p
|
||||||
|
|
22
autoload/lightline/colorscheme/catppuccin.vim
vendored
22
autoload/lightline/colorscheme/catppuccin.vim
vendored
|
@ -1,2 +1,20 @@
|
||||||
let g:lightline#colorscheme#catppuccin#palette = lightline#colorscheme#fill(
|
let s:c = has("nvim") == 1 ? luaeval('require("catppuccin.palettes").get_palette()') : luaeval('vim.dict(require("catppuccin.palettes").get_palette())')
|
||||||
\ luaeval('require("catppuccin.utils.lightline")'))
|
|
||||||
|
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||||
|
let s:p.normal.left = [ [ s:c.mantle, s:c.blue ], [ s:c.blue, s:c.base ] ]
|
||||||
|
let s:p.normal.right = [ [ s:c.overlay0, s:c.base ], [ s:c.blue, s:c.surface0 ] ]
|
||||||
|
let s:p.inactive.right = [ [ s:c.surface1, s:c.base ], [ s:c.overlay0, s:c.base ] ]
|
||||||
|
let s:p.inactive.left = [ [ s:c.blue, s:c.base ], [ s:c.overlay0, s:c.base ] ]
|
||||||
|
let s:p.insert.left = [ [ s:c.mantle, s:c.teal ], [ s:c.blue, s:c.base ] ]
|
||||||
|
let s:p.replace.left = [ [ s:c.mantle, s:c.red ], [ s:c.blue, s:c.base ] ]
|
||||||
|
let s:p.visual.left = [ [ s:c.mantle, s:c.mauve ], [ s:c.blue, s:c.base ] ]
|
||||||
|
let s:p.normal.middle = [ [ s:c.blue, s:c.surface1 ] ]
|
||||||
|
let s:p.inactive.middle = [ [ s:c.surface1, s:c.base ] ]
|
||||||
|
let s:p.tabline.left = [ [ s:c.overlay0, s:c.base ], [ s:c.overlay0, s:c.base ] ]
|
||||||
|
let s:p.tabline.tabsel = [ [ s:c.blue, s:c.surface1 ], [ s:c.overlay0, s:c.base] ]
|
||||||
|
let s:p.tabline.middle = [ [ s:c.surface1, s:c.base ] ]
|
||||||
|
let s:p.tabline.right = copy(s:p.inactive.right)
|
||||||
|
let s:p.normal.error = [ [ s:c.mantle, s:c.red ] ]
|
||||||
|
let s:p.normal.warning = [ [ s:c.mantle, s:c.yellow ] ]
|
||||||
|
|
||||||
|
let g:lightline#colorscheme#catppuccin#palette = lightline#colorscheme#fill(s:p)
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
require("catppuccin").load "frappe"
|
|
1
colors/catppuccin-frappe.vim
vendored
Normal file
1
colors/catppuccin-frappe.vim
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
lua require("catppuccin").load "frappe"
|
|
@ -1 +0,0 @@
|
||||||
require("catppuccin").load "latte"
|
|
1
colors/catppuccin-latte.vim
vendored
Normal file
1
colors/catppuccin-latte.vim
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
lua require("catppuccin").load "latte"
|
|
@ -1 +0,0 @@
|
||||||
require("catppuccin").load "macchiato"
|
|
1
colors/catppuccin-macchiato.vim
vendored
Normal file
1
colors/catppuccin-macchiato.vim
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
lua require("catppuccin").load "macchiato"
|
|
@ -1 +0,0 @@
|
||||||
require("catppuccin").load "mocha"
|
|
1
colors/catppuccin-mocha.vim
vendored
Normal file
1
colors/catppuccin-mocha.vim
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
lua require("catppuccin").load "mocha"
|
|
@ -1 +0,0 @@
|
||||||
require("catppuccin").load()
|
|
1
colors/catppuccin.vim
vendored
Normal file
1
colors/catppuccin.vim
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
lua require("catppuccin").load()
|
10
doc/catppuccin.txt
vendored
10
doc/catppuccin.txt
vendored
|
@ -65,8 +65,8 @@ Table of Contents *catppuccin-table-of-contents*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
4. Configuration *catppuccin-configuration*
|
4. Configuration *catppuccin-configuration*
|
||||||
|
|
||||||
You may pass a lua table to the setup() function in order to edit any of
|
There is no need to call `setup` if you don’t want to change the default
|
||||||
Catppuccin’s settings:
|
options and settings.
|
||||||
|
|
||||||
>
|
>
|
||||||
require("catppuccin").setup({
|
require("catppuccin").setup({
|
||||||
|
@ -104,10 +104,14 @@ Catppuccin’s settings:
|
||||||
gitsigns = true,
|
gitsigns = true,
|
||||||
nvimtree = true,
|
nvimtree = true,
|
||||||
telescope = true,
|
telescope = true,
|
||||||
treesitter = true,
|
notify = false,
|
||||||
|
mini = false,
|
||||||
-- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
|
-- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- setup must be called before loading
|
||||||
|
vim.cmd.colorscheme "catppuccin"
|
||||||
<
|
<
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.get()
|
function M.get()
|
||||||
local operators = cp.sky
|
|
||||||
local cl = cp.mauve -- conditionals, loops
|
|
||||||
local keywords = cp.mauve
|
|
||||||
|
|
||||||
local math_logic = cp.peach
|
|
||||||
|
|
||||||
if vim.treesitter.highlighter.hl_map then
|
if vim.treesitter.highlighter.hl_map then
|
||||||
vim.notify(
|
vim.notify(
|
||||||
[[Catppuccin (info):
|
[[Catppuccin (info):
|
||||||
|
@ -25,7 +19,7 @@ If you want to stay on nvim 0.7, either disable the integration or pin catppucci
|
||||||
["@error"] = { link = "Error" },
|
["@error"] = { link = "Error" },
|
||||||
["@preproc"] = { link = "PreProc" }, -- various preprocessor directives & shebangs
|
["@preproc"] = { link = "PreProc" }, -- various preprocessor directives & shebangs
|
||||||
["@define"] = { link = "Define" }, -- preprocessor definition directives
|
["@define"] = { link = "Define" }, -- preprocessor definition directives
|
||||||
["@operator"] = { fg = operators, style = cnf.styles.operators or {} }, -- For any operator: +, but also -> and * in cp.
|
["@operator"] = { link = "Operator" }, -- For any operator: +, but also -> and * in cp.
|
||||||
|
|
||||||
-- Punctuation
|
-- Punctuation
|
||||||
["@punctuation.delimiter"] = { fg = cp.overlay2 }, -- For delimiters ie: .
|
["@punctuation.delimiter"] = { fg = cp.overlay2 }, -- For delimiters ie: .
|
||||||
|
@ -33,7 +27,7 @@ If you want to stay on nvim 0.7, either disable the integration or pin catppucci
|
||||||
["@punctuation.special"] = { fg = cp.sky, style = cnf.styles.operators or {} }, -- For special punctutation that does not fall in the catagories before.
|
["@punctuation.special"] = { fg = cp.sky, style = cnf.styles.operators or {} }, -- For special punctutation that does not fall in the catagories before.
|
||||||
|
|
||||||
-- Literals
|
-- Literals
|
||||||
["@string"] = { fg = cp.green, style = cnf.styles.strings or {} }, -- For strings.
|
["@string"] = { link = "String" }, -- For strings.
|
||||||
["@string.regex"] = { fg = cp.peach, style = cnf.styles.strings or {} }, -- For regexes.
|
["@string.regex"] = { fg = cp.peach, style = cnf.styles.strings or {} }, -- For regexes.
|
||||||
["@string.escape"] = { fg = cp.pink, style = cnf.styles.strings }, -- For escape characters within a string.
|
["@string.escape"] = { fg = cp.pink, style = cnf.styles.strings }, -- For escape characters within a string.
|
||||||
["@string.special"] = { fg = cp.blue }, -- other special strings (e.g. dates)
|
["@string.special"] = { fg = cp.blue }, -- other special strings (e.g. dates)
|
||||||
|
@ -41,12 +35,12 @@ If you want to stay on nvim 0.7, either disable the integration or pin catppucci
|
||||||
["@character"] = { link = "Character" }, -- character literals
|
["@character"] = { link = "Character" }, -- character literals
|
||||||
["@character.special"] = { link = "SpecialChar" }, -- special characters (e.g. wildcards)
|
["@character.special"] = { link = "SpecialChar" }, -- special characters (e.g. wildcards)
|
||||||
|
|
||||||
["@boolean"] = { fg = math_logic, style = cnf.styles.booleans or {} }, -- For booleans.
|
["@boolean"] = { link = "Boolean" }, -- For booleans.
|
||||||
["@number"] = { fg = math_logic, style = cnf.styles.numbers or {} }, -- For all numbers
|
["@number"] = { link = "Number" }, -- For all numbers
|
||||||
["@float"] = { fg = math_logic, style = cnf.styles.numbers or {} }, -- For floats.
|
["@float"] = { link = "Number" }, -- For floats.
|
||||||
|
|
||||||
-- Functions
|
-- Functions
|
||||||
["@function"] = { fg = cp.blue, style = cnf.styles.functions or {} }, -- For function (calls and definitions).
|
["@function"] = { link = "Function" }, -- For function (calls and definitions).
|
||||||
["@function.builtin"] = { fg = cp.peach, style = cnf.styles.functions or {} }, -- For builtin functions: table.insert in Lua.
|
["@function.builtin"] = { fg = cp.peach, style = cnf.styles.functions or {} }, -- For builtin functions: table.insert in Lua.
|
||||||
["@function.call"] = { link = "@function" }, -- function calls
|
["@function.call"] = { link = "@function" }, -- function calls
|
||||||
["@function.macro"] = { fg = cp.teal, style = cnf.styles.functions or {} }, -- For macro defined functions (calls and definitions): each macro_rules in Ruscp.
|
["@function.macro"] = { fg = cp.teal, style = cnf.styles.functions or {} }, -- For macro defined functions (calls and definitions): each macro_rules in Ruscp.
|
||||||
|
@ -58,21 +52,21 @@ If you want to stay on nvim 0.7, either disable the integration or pin catppucci
|
||||||
["@parameter"] = { fg = cp.maroon, style = { "italic" } }, -- For parameters of a function.
|
["@parameter"] = { fg = cp.maroon, style = { "italic" } }, -- For parameters of a function.
|
||||||
|
|
||||||
-- Keywords
|
-- Keywords
|
||||||
["@keyword"] = { fg = keywords, style = cnf.styles.keywords or {} }, -- For keywords that don't fall in previous categories.
|
["@keyword"] = { link = "Keyword" }, -- For keywords that don't fall in previous categories.
|
||||||
["@keyword.function"] = { fg = cp.mauve, style = cnf.styles.keywords or {} }, -- For keywords used to define a fuction.
|
["@keyword.function"] = { fg = cp.mauve, style = cnf.styles.keywords or {} }, -- For keywords used to define a fuction.
|
||||||
["@keyword.operator"] = { fg = cp.mauve, style = cnf.styles.operators or {} }, -- For new keyword operator
|
["@keyword.operator"] = { fg = cp.mauve, style = cnf.styles.operators or {} }, -- For new keyword operator
|
||||||
["@keyword.return"] = { fg = cp.mauve, style = cnf.styles.keywords or {} },
|
["@keyword.return"] = { fg = cp.mauve, style = cnf.styles.keywords or {} },
|
||||||
|
|
||||||
["@conditional"] = { fg = cl, style = cnf.styles.conditionals or {} }, -- For keywords related to conditionnals.
|
["@conditional"] = { link = "Conditional" }, -- For keywords related to conditionnals.
|
||||||
["@repeat"] = { fg = cl, style = cnf.styles.loops or {} }, -- For keywords related to loops.
|
["@repeat"] = { link = "Repeat" }, -- For keywords related to loops.
|
||||||
-- @debug ; keywords related to debugging
|
-- @debug ; keywords related to debugging
|
||||||
["@label"] = { fg = cp.sapphire }, -- For labels: label: in C and :label: in Lua.
|
["@label"] = { link = "Label" }, -- For labels: label: in C and :label: in Lua.
|
||||||
["@include"] = { fg = cp.mauve, style = cnf.styles.keywords or {} }, -- For includes: #include in C, use or extern crate in Rust, or require in Lua.
|
["@include"] = { link = "Include" }, -- For includes: #include in C, use or extern crate in Rust, or require in Lua.
|
||||||
["@exception"] = { fg = cp.mauve, style = cnf.styles.keywords or {} }, -- For exception related keywords.
|
["@exception"] = { fg = cp.mauve, style = cnf.styles.keywords or {} }, -- For exception related keywords.
|
||||||
|
|
||||||
-- Types
|
-- Types
|
||||||
|
|
||||||
["@type"] = { fg = cp.yellow, style = cnf.styles.types or {} }, -- For types.
|
["@type"] = { link = "Type" }, -- For types.
|
||||||
["@type.builtin"] = { fg = cp.yellow, style = cnf.styles.properties or "italic" }, -- For builtin types.
|
["@type.builtin"] = { fg = cp.yellow, style = cnf.styles.properties or "italic" }, -- For builtin types.
|
||||||
["@type.definition"] = { link = "@type" }, -- type definitions (e.g. `typedef` in C)
|
["@type.definition"] = { link = "@type" }, -- type definitions (e.g. `typedef` in C)
|
||||||
["@type.qualifier"] = { link = "@type" }, -- type qualifiers (e.g. `const`)
|
["@type.qualifier"] = { link = "@type" }, -- type qualifiers (e.g. `const`)
|
||||||
|
@ -84,12 +78,12 @@ If you want to stay on nvim 0.7, either disable the integration or pin catppucci
|
||||||
|
|
||||||
-- Identifiers
|
-- Identifiers
|
||||||
|
|
||||||
["@variable"] = { fg = cp.text, style = cnf.styles.variables or {} }, -- Any variable name that does not have another highlighcp.
|
["@variable"] = { link = "Identifiers" }, -- Any variable name that does not have another highlighcp.
|
||||||
["@variable.builtin"] = { fg = cp.red }, -- Variable names that are defined by the languages, like this or self.
|
["@variable.builtin"] = { fg = cp.red }, -- Variable names that are defined by the languages, like this or self.
|
||||||
|
|
||||||
["@constant"] = { fg = cp.peach }, -- For constants
|
["@constant"] = { fg = cp.peach }, -- For constants
|
||||||
["@constant.builtin"] = { fg = cp.peach, style = cnf.styles.keywords or {} }, -- For constant that are built in the language: nil in Lua.
|
["@constant.builtin"] = { fg = cp.peach, style = cnf.styles.keywords or {} }, -- For constant that are built in the language: nil in Lua.
|
||||||
["@constant.macro"] = { fg = cp.mauve }, -- For constants that are defined by macros: NULL in cp.
|
["@constant.macro"] = { link = "Macro" }, -- For constants that are defined by macros: NULL in cp.
|
||||||
|
|
||||||
["@namespace"] = { fg = cp.blue, style = { "italic" } }, -- For identifiers referring to modules and namespaces.
|
["@namespace"] = { fg = cp.blue, style = { "italic" } }, -- For identifiers referring to modules and namespaces.
|
||||||
["@symbol"] = { fg = cp.flamingo },
|
["@symbol"] = { fg = cp.flamingo },
|
||||||
|
|
|
@ -3,38 +3,39 @@ local M = {}
|
||||||
function M.get()
|
function M.get()
|
||||||
return {
|
return {
|
||||||
Comment = { fg = cp.surface2, style = cnf.styles.comments }, -- just comments
|
Comment = { fg = cp.surface2, style = cnf.styles.comments }, -- just comments
|
||||||
|
SpecialComment = { link = "Special" }, -- special things inside a comment
|
||||||
Constant = { fg = cp.peach }, -- (preferred) any constant
|
Constant = { fg = cp.peach }, -- (preferred) any constant
|
||||||
String = { fg = cp.green, style = cnf.styles.strings }, -- a string constant: "this is a string"
|
String = { fg = cp.green, style = cnf.styles.strings or {} }, -- a string constant: "this is a string"
|
||||||
Character = { fg = cp.teal }, -- a character constant: 'c', '\n'
|
Character = { fg = cp.teal }, -- a character constant: 'c', '\n'
|
||||||
Number = { fg = cp.peach }, -- a number constant: 234, 0xff
|
Number = { fg = cp.peach, style = cnf.styles.numbers or {} }, -- a number constant: 234, 0xff
|
||||||
Float = { fg = cp.peach }, -- a floating point constant: 2.3e10
|
Float = { fg = cp.peach, style = cnf.styles.numbers or {} }, -- a floating point constant: 2.3e10
|
||||||
Boolean = { fg = cp.peach }, -- a boolean constant: TRUE, false
|
Boolean = { fg = cp.peach, style = cnf.styles.booleans or {} }, -- a boolean constant: TRUE, false
|
||||||
Identifier = { fg = cp.flamingo, style = cnf.styles.variables }, -- (preferred) any variable name
|
Identifier = { fg = cp.text, style = cnf.styles.variables or {} }, -- (preferred) any variable name
|
||||||
Function = { fg = cp.blue, style = cnf.styles.functions }, -- function name (also: methods for classes)
|
Function = { fg = cp.blue, style = cnf.styles.functions or {} }, -- function name (also: methods for classes)
|
||||||
Statement = { fg = cp.mauve }, -- (preferred) any statement
|
Statement = { fg = cp.mauve }, -- (preferred) any statement
|
||||||
Conditional = { fg = cp.red }, -- if, then, else, endif, switch, etcp.
|
Conditional = { fg = cp.mauve, style = cnf.styles.conditionals or {} }, -- if, then, else, endif, switch, etcp.
|
||||||
Repeat = { fg = cp.red }, -- for, do, while, etcp.
|
Repeat = { fg = cp.mauve, style = cnf.styles.loops or {} }, -- for, do, while, etcp.
|
||||||
Label = { fg = cp.peach }, -- case, default, etcp.
|
Label = { fg = cp.sapphire }, -- case, default, etcp.
|
||||||
Operator = { fg = cp.sky }, -- "sizeof", "+", "*", etcp.
|
Operator = { fg = cp.sky, style = cnf.styles.operators or {} }, -- "sizeof", "+", "*", etcp.
|
||||||
Keyword = { fg = cp.pink, style = cnf.styles.keywords }, -- any other keyword
|
Keyword = { fg = cp.mauve, style = cnf.styles.keywords or {} }, -- any other keyword
|
||||||
-- Exception = { }, -- try, catch, throw
|
-- Exception = { }, -- try, catch, throw
|
||||||
|
|
||||||
PreProc = { fg = cp.pink }, -- (preferred) generic Preprocessor
|
PreProc = { fg = cp.pink }, -- (preferred) generic Preprocessor
|
||||||
Include = { fg = cp.pink }, -- preprocessor #include
|
Include = { fg = cp.mauve, style = cnf.styles.keywords or {} }, -- preprocessor #include
|
||||||
-- Define = { }, -- preprocessor #define
|
Define = { link = "PreProc" }, -- preprocessor #define
|
||||||
-- Macro = { }, -- same as Define
|
Macro = { fg = cp.mauve }, -- same as Define
|
||||||
-- PreCondit = { }, -- preprocessor #if, #else, #endif, etcp.
|
PreCondit = { link = "PreProc" }, -- preprocessor #if, #else, #endif, etc.
|
||||||
|
|
||||||
StorageClass = { fg = cp.yellow }, -- static, register, volatile, etcp.
|
StorageClass = { fg = cp.yellow }, -- static, register, volatile, etcp.
|
||||||
Structure = { fg = cp.yellow }, -- struct, union, enum, etcp.
|
Structure = { fg = cp.yellow }, -- struct, union, enum, etcp.
|
||||||
Typedef = { fg = cp.yellow }, -- A typedef
|
|
||||||
Special = { fg = cp.pink }, -- (preferred) any special symbol
|
Special = { fg = cp.pink }, -- (preferred) any special symbol
|
||||||
Type = { fg = cp.blue }, -- (preferred) int, long, char, etcp.
|
Type = { fg = cp.yellow, style = cnf.styles.types or {} }, -- (preferred) int, long, char, etcp.
|
||||||
-- SpecialChar = { }, -- special character in a constant
|
Typedef = { link = "Type" }, -- A typedef
|
||||||
-- Tag = { }, -- you can use CTRL-] on this
|
SpecialChar = { link = "Special" }, -- special character in a constant
|
||||||
-- Delimiter = { }, -- character that needs attention
|
Tag = { link = "Special" }, -- you can use CTRL-] on this
|
||||||
|
Delimiter = { link = "Special" }, -- character that needs attention
|
||||||
-- Specialoverlay0= { }, -- special things inside a overlay0
|
-- Specialoverlay0= { }, -- special things inside a overlay0
|
||||||
-- Debug = { }, -- debugging statements
|
Debug = { link = "Special" }, -- debugging statements
|
||||||
|
|
||||||
Underlined = { style = { "underline" } }, -- (preferred) text that stands out, HTML links
|
Underlined = { style = { "underline" } }, -- (preferred) text that stands out, HTML links
|
||||||
Bold = { style = { "bold" } },
|
Bold = { style = { "bold" } },
|
||||||
|
@ -88,16 +89,6 @@ function M.get()
|
||||||
GlyphPalette6 = { fg = cp.teal },
|
GlyphPalette6 = { fg = cp.teal },
|
||||||
GlyphPalette7 = { fg = cp.text },
|
GlyphPalette7 = { fg = cp.text },
|
||||||
GlyphPalette9 = { fg = cp.red },
|
GlyphPalette9 = { fg = cp.red },
|
||||||
|
|
||||||
Define = { link = "PreProc" }, -- preprocessor #define
|
|
||||||
Macro = { link = "PreProc" }, -- same as Define
|
|
||||||
PreCondit = { link = "PreProc" }, -- preprocessor #if, #else, #endif, etc.
|
|
||||||
|
|
||||||
SpecialChar = { link = "Special" }, -- special character in a constant
|
|
||||||
Tag = { link = "Special" }, -- you can use CTRL-] on this
|
|
||||||
Delimiter = { link = "Special" }, -- character that needs attention
|
|
||||||
SpecialComment = { link = "Special" }, -- special things inside a comment
|
|
||||||
Debug = { link = "Special" }, -- debugging statements
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
local is_vim = vim.fn.has "nvim" ~= 1
|
||||||
|
if is_vim then require "catppuccin.lib.vim" end
|
||||||
|
|
||||||
local M = {
|
local M = {
|
||||||
flavours = { "latte", "frappe", "macchiato", "mocha" },
|
flavours = { "latte", "frappe", "macchiato", "mocha" },
|
||||||
options = {
|
options = {
|
||||||
|
@ -28,7 +31,7 @@ local M = {
|
||||||
operators = {},
|
operators = {},
|
||||||
},
|
},
|
||||||
integrations = {
|
integrations = {
|
||||||
treesitter = true,
|
treesitter = not is_vim,
|
||||||
cmp = true,
|
cmp = true,
|
||||||
gitsigns = true,
|
gitsigns = true,
|
||||||
telescope = true,
|
telescope = true,
|
||||||
|
@ -58,12 +61,12 @@ local M = {
|
||||||
color_overrides = {},
|
color_overrides = {},
|
||||||
highlight_overrides = {},
|
highlight_overrides = {},
|
||||||
},
|
},
|
||||||
path_sep = ((jit and jit.os or nil) == "Windows") and "\\" or "/",
|
path_sep = jit and (jit.os == "Windows" and "\\" or "/") or package.config:sub(1, 1),
|
||||||
}
|
}
|
||||||
|
|
||||||
function M.compile()
|
function M.compile()
|
||||||
for _, flavour in pairs(M.flavours) do
|
for _, flavour in pairs(M.flavours) do
|
||||||
require("catppuccin.lib.compiler").compile(flavour)
|
require("catppuccin.lib." .. (is_vim and "vim." or "") .. "compiler").compile(flavour)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -146,6 +149,8 @@ function M.setup(user_conf)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if is_vim then return M end
|
||||||
|
|
||||||
vim.api.nvim_create_user_command("Catppuccin", function(inp)
|
vim.api.nvim_create_user_command("Catppuccin", function(inp)
|
||||||
if not vim.tbl_contains(M.flavours, inp.args) then
|
if not vim.tbl_contains(M.flavours, inp.args) then
|
||||||
vim.notify(
|
vim.notify(
|
||||||
|
|
58
lua/catppuccin/lib/vim/compiler.lua
Normal file
58
lua/catppuccin/lib/vim/compiler.lua
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
local C = require "catppuccin"
|
||||||
|
local config = C.options
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
-- Reference: https://github.com/EdenEast/nightfox.nvim
|
||||||
|
local fmt = string.format
|
||||||
|
|
||||||
|
function M.compile(flavour)
|
||||||
|
local theme = require("catppuccin.lib.mapper").apply(flavour)
|
||||||
|
local lines = {
|
||||||
|
[[
|
||||||
|
require("catppuccin").compiled = string.dump(function()
|
||||||
|
if vim.g.colors_name then vim.cmd("hi clear") end
|
||||||
|
vim.o.termguicolors = true
|
||||||
|
vim.g.colors_name = "catppuccin"]],
|
||||||
|
}
|
||||||
|
table.insert(lines, "vim.o.background = " .. (flavour == "latte" and [["light"]] or [["dark"]]))
|
||||||
|
|
||||||
|
local tbl = vim.tbl_deep_extend("keep", theme.custom_highlights, theme.integrations, theme.syntax, theme.editor)
|
||||||
|
|
||||||
|
if config.term_colors == true then
|
||||||
|
for k, v in pairs(theme.terminal) do
|
||||||
|
table.insert(lines, fmt('vim.g.%s = "%s"', k, v))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
table.insert(lines, "vim.cmd[[")
|
||||||
|
|
||||||
|
for group, color in pairs(tbl) do
|
||||||
|
if color.link then
|
||||||
|
table.insert(lines, fmt([[highlight! link %s %s]], group, color.link))
|
||||||
|
else
|
||||||
|
if color.style then color.style = table.concat(color.style, ",") end
|
||||||
|
if color.style == "" then color.style = nil end
|
||||||
|
table.insert(
|
||||||
|
lines,
|
||||||
|
fmt(
|
||||||
|
[[highlight %s guifg=%s guibg=%s gui=%s guisp=%s]],
|
||||||
|
group,
|
||||||
|
color.fg or "NONE",
|
||||||
|
color.bg or "NONE",
|
||||||
|
color.style or "NONE",
|
||||||
|
color.sp or "NONE"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.insert(lines, "]]end)")
|
||||||
|
if vim.fn.isdirectory(config.compile_path) == 0 then
|
||||||
|
os.execute(string.format("mkdir %s %s", C.is_windows and "" or "-p", config.compile_path))
|
||||||
|
end
|
||||||
|
local file = io.open(config.compile_path .. C.path_sep .. flavour .. "_compiled.lua", "wb")
|
||||||
|
loadstring(table.concat(lines, "\n"), "=")()
|
||||||
|
file:write(require("catppuccin").compiled)
|
||||||
|
file:close()
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
109
lua/catppuccin/lib/vim/init.lua
Normal file
109
lua/catppuccin/lib/vim/init.lua
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
-- TODO: private _G.vim
|
||||||
|
vim.cmd = vim.command
|
||||||
|
vim.cmd [[command! CatppuccinCompile lua require('catppuccin').compile() print("Catppuccin (info): compiled cache!")]]
|
||||||
|
loadstring = load or loadstring
|
||||||
|
bit = bit32 or {
|
||||||
|
rshift = function(a, b) return a >> b end,
|
||||||
|
bxor = function(a, b) return a ~ b end,
|
||||||
|
}
|
||||||
|
|
||||||
|
local function get_option(name, _) return vim.eval("&" .. name) end
|
||||||
|
|
||||||
|
local function set_option(name, opt, _)
|
||||||
|
if type(opt) == "boolean" then
|
||||||
|
vim.cmd("set " .. name)
|
||||||
|
else
|
||||||
|
vim.cmd("set " .. name .. "=" .. opt)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.o = setmetatable({}, {
|
||||||
|
__index = function(_, k) return get_option(k, {}) end,
|
||||||
|
__newindex = function(_, k, v) return set_option(k, v, {}) end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.fn.stdpath = function(what)
|
||||||
|
if what ~= "cache" then return end
|
||||||
|
if package.config:sub(1, 1) == "\\" then
|
||||||
|
return vim.fn.expand "%localappdata%" .. [[Temp\vim]]
|
||||||
|
else
|
||||||
|
return (os.getenv "XDG_CACHE_HOME" or vim.fn.expand "$HOME/.cache") .. "/vim"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.loop = {
|
||||||
|
fs_stat = function(file)
|
||||||
|
local mod = vim.fn.getftime(file)
|
||||||
|
if mod == -1 then return nil end
|
||||||
|
return { mtime = { sec = mod } }
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Reference: https://github.com/neovim/neovim/blob/master/runtime/lua/vim/shared.lua
|
||||||
|
function vim.tbl_isempty(t)
|
||||||
|
assert(type(t) == "table", string.format("Expected table, got %s", type(t)))
|
||||||
|
return next(t) == nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function vim.tbl_islist(t)
|
||||||
|
if type(t) ~= "table" then return false end
|
||||||
|
|
||||||
|
local count = 0
|
||||||
|
|
||||||
|
for k, _ in pairs(t) do
|
||||||
|
if type(k) == "number" then
|
||||||
|
count = count + 1
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if count > 0 then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
-- TODO(bfredl): in the future, we will always be inside nvim
|
||||||
|
-- then this check can be deleted.
|
||||||
|
if vim._empty_dict_mt == nil then return false end
|
||||||
|
return getmetatable(t) ~= vim._empty_dict_mt
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function can_merge(v) return type(v) == "table" and (vim.tbl_isempty(v) or not vim.tbl_islist(v)) end
|
||||||
|
|
||||||
|
function vim.tbl_contains(t, value)
|
||||||
|
for _, v in ipairs(t) do
|
||||||
|
if v == value then return true end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local function tbl_extend(behavior, deep_extend, ...)
|
||||||
|
if behavior ~= "error" and behavior ~= "keep" and behavior ~= "force" then
|
||||||
|
error('invalid "behavior": ' .. tostring(behavior))
|
||||||
|
end
|
||||||
|
|
||||||
|
if select("#", ...) < 2 then
|
||||||
|
error("wrong number of arguments (given " .. tostring(1 + select("#", ...)) .. ", expected at least 3)")
|
||||||
|
end
|
||||||
|
|
||||||
|
local ret = {}
|
||||||
|
if vim._empty_dict_mt ~= nil and getmetatable(select(1, ...)) == vim._empty_dict_mt then ret = vim.empty_dict() end
|
||||||
|
|
||||||
|
for i = 1, select("#", ...) do
|
||||||
|
local tbl = select(i, ...)
|
||||||
|
if tbl then
|
||||||
|
for k, v in pairs(tbl) do
|
||||||
|
if deep_extend and can_merge(v) and can_merge(ret[k]) then
|
||||||
|
ret[k] = tbl_extend(behavior, true, ret[k], v)
|
||||||
|
elseif behavior ~= "force" and ret[k] ~= nil then
|
||||||
|
if behavior == "error" then error("key found in more than one map: " .. k) end -- Else behavior is "keep".
|
||||||
|
else
|
||||||
|
ret[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
function vim.tbl_deep_extend(behavior, ...) return tbl_extend(behavior, true, ...) end
|
|
@ -1,19 +0,0 @@
|
||||||
local cp = require("catppuccin.palettes").get_palette()
|
|
||||||
local catppuccin = {}
|
|
||||||
|
|
||||||
catppuccin.display = { guibg = cp.mantle }
|
|
||||||
|
|
||||||
catppuccin.input = catppuccin.display
|
|
||||||
catppuccin.indicator = { guifg = cp.subtext1, guibg = cp.mantle }
|
|
||||||
catppuccin.spinner = { guifg = cp.yellow, guibg = cp.mantle, gui = "bold" }
|
|
||||||
catppuccin.search_text = { guifg = cp.text, guibg = cp.mantle, gui = "bold" }
|
|
||||||
|
|
||||||
catppuccin.preview = { guibg = cp.base }
|
|
||||||
|
|
||||||
catppuccin.selected = { guifg = cp.sapphire, gui = "bold,underline" }
|
|
||||||
catppuccin.current_selection = { guibg = cp.surface0, gui = "bold" }
|
|
||||||
|
|
||||||
catppuccin.selected_sign = { guifg = cp.red }
|
|
||||||
catppuccin.current_selection_sign = catppuccin.selected_sign
|
|
||||||
|
|
||||||
return catppuccin
|
|
|
@ -1,37 +0,0 @@
|
||||||
local cp = require("catppuccin.palettes").get_palette()
|
|
||||||
local catppuccin = {}
|
|
||||||
|
|
||||||
catppuccin.normal = {
|
|
||||||
left = { { cp.mantle, cp.blue }, { cp.blue, cp.base } },
|
|
||||||
middle = { { cp.blue, cp.surface1 } },
|
|
||||||
right = { { cp.overlay0, cp.base }, { cp.blue, cp.surface0 } },
|
|
||||||
error = { { cp.mantle, cp.red } },
|
|
||||||
warning = { { cp.mantle, cp.yellow } },
|
|
||||||
}
|
|
||||||
|
|
||||||
catppuccin.insert = {
|
|
||||||
left = { { cp.mantle, cp.teal }, { cp.blue, cp.base } },
|
|
||||||
}
|
|
||||||
|
|
||||||
catppuccin.visual = {
|
|
||||||
left = { { cp.mantle, cp.mauve }, { cp.blue, cp.base } },
|
|
||||||
}
|
|
||||||
|
|
||||||
catppuccin.replace = {
|
|
||||||
left = { { cp.mantle, cp.red }, { cp.blue, cp.base } },
|
|
||||||
}
|
|
||||||
|
|
||||||
catppuccin.inactive = {
|
|
||||||
left = { { cp.blue, cp.base }, { cp.overlay0, cp.base } },
|
|
||||||
middle = { { cp.surface1, cp.base } },
|
|
||||||
right = { { cp.surface1, cp.base }, { cp.overlay0, cp.base } },
|
|
||||||
}
|
|
||||||
|
|
||||||
catppuccin.tabline = {
|
|
||||||
left = { { cp.overlay0, cp.base }, { cp.overlay0, cp.base } },
|
|
||||||
middle = { { cp.surface1, cp.base } },
|
|
||||||
right = { { cp.surface1, cp.base }, { cp.overlay0, cp.base } },
|
|
||||||
tabsel = { { cp.blue, cp.surface1 }, { cp.overlay0, cp.base } },
|
|
||||||
}
|
|
||||||
|
|
||||||
return catppuccin
|
|
Loading…
Reference in a new issue