Repository navigation
Buffer Local Config
Ahmet Zeybek edited this page Sep 27, 2026
·
3 revisions
You can override global settings for specific buffers using Neovim buffer variables (vim.b). This is the highest-priority configuration layer.
| Variable | Type | Description |
|---|---|---|
vim.b.camouflage_enabled |
boolean |
Enable/disable masking for this buffer |
vim.b.camouflage_style |
string |
Masking style: 'stars', 'dotted', 'text', 'scramble'
|
vim.b.camouflage_mask_char |
string |
Mask character for the stars style (dotted always uses •) |
vim.b.camouflage_mask_length |
number |
Fixed mask length (overrides actual value length) |
vim.b.camouflage_highlight_group |
string |
Highlight group for masked text |
vim.b.camouflage_terminal |
boolean |
Set to false to skip a single terminal buffer, see Terminal Masking
|
vim.b.camouflage_enabled = falsevim.b.camouflage_style = 'scramble'vim.b.camouflage_mask_char = '#'vim.b.camouflage_mask_length = 8vim.b.camouflage_highlight_group = 'NonText'The most common use case is setting buffer-local overrides via autocommands for specific file patterns or directories:
vim.api.nvim_create_autocmd('BufEnter', {
pattern = '*/production/.env*',
callback = function()
vim.b.camouflage_style = 'text'
end,
})text draws the same fixed text over every value, so not even the length shows. Don't use scramble for this: it shuffles the real characters and leaks the length and character set.
vim.api.nvim_create_autocmd('BufEnter', {
pattern = { '*.example', '*.sample', '*.template' },
callback = function()
vim.b.camouflage_enabled = false
end,
})vim.api.nvim_create_autocmd('BufEnter', {
pattern = '*/staging/*',
callback = function()
vim.b.camouflage_mask_length = 16
vim.b.camouflage_mask_char = 'X'
end,
})- Set buffer variables before entering the buffer, or call
:CamouflageRefreshafter setting them - Use the exact variable names:
vim.b.camouflage_enabled(notvim.b.camouflage.enabled) - Buffer-local settings override all other configuration layers (defaults, setup, project config)
-
Presentation Mode masks a buffer even when
vim.b.camouflage_enabled = false, and puts the variable back when it ends
1. Defaults (lowest priority)
2. setup() options
3. Project config (.camouflage.yaml)
4. Buffer-local overrides (highest priority, this page)
- Configuration: Global configuration reference
- Project Config: Repo-level configuration