Vimcraft Docs / Variables & Scopes
Variables & Scopes
Different variable scopes for configuration and state management.
Global Variables (vim.g)
// Leader key vim.g.mapLeader = ' '; vim.g.mapLocalLeader = ','; // Custom variables vim.g.myConfig = { theme: 'dark', fontSize: 14 };
Buffer Variables (vim.b)
// Buffer-specific settings vim.b.fileType = 'javascript'; vim.b.customFormatter = 'prettier';
Window Variables (vim.w)
// Window-specific state vim.w.statusLineActive = true;
Tab Variables (vim.t)
// Tab-specific state vim.t.tabName = 'Development';
Vim Variables (vim.v)
// Built-in Vim variables (read-only) const count = vim.v.count; const register = vim.v.register;
See Also
- vim.api - Variable functions
- Configuration Guide - Usage examples