Vimcraft Docs / vim.highlight - Syntax Highlighting
vim.highlight - Syntax Highlighting
Customize syntax highlighting with the highlight function.
Basic Usage
// Simple color vim.highlight('Comment', { fg: '#6c6c6c' }); // With styling vim.highlight('Function', { fg: '#61afef', bold: true }); // Background and foreground vim.highlight('CursorLine', { bg: '#2c323c' }); // Multiple attributes vim.highlight('Error', { fg: '#e06c75', bg: '#3e2a2a', bold: true, underline: true });
Common Highlight Groups
// Editor elements vim.highlight('Normal', { fg: '#d4d4d4', bg: '#1e1e1e' }); vim.highlight('LineNr', { fg: '#5a5a5a' }); vim.highlight('CursorLine', { bg: '#2c323c' }); vim.highlight('CursorLineNr', { fg: '#61afef', bold: true }); vim.highlight('Visual', { bg: '#3e4451' }); // Syntax highlighting vim.highlight('Comment', { fg: '#6c6c6c', italic: true }); vim.highlight('Constant', { fg: '#d19a66' }); vim.highlight('String', { fg: '#98c379' }); vim.highlight('Function', { fg: '#61afef' }); vim.highlight('Keyword', { fg: '#c678dd' }); vim.highlight('Type', { fg: '#e5c07b' }); vim.highlight('Operator', { fg: '#56b6c2' }); // Diagnostics vim.highlight('Error', { fg: '#e06c75' }); vim.highlight('Warning', { fg: '#e5c07b' }); vim.highlight('Info', { fg: '#61afef' }); vim.highlight('Hint', { fg: '#56b6c2' });
See Also
- Configuration Guide - Complete theming examples
- Changelog - Track feature releases