-
Notifications
You must be signed in to change notification settings - Fork 0
Presentation Mode
Before a demo there are several switches to remember: masking on, follow cursor off, no line left revealed, terminal masking on, and that one buffer where masking was turned off an hour ago. Missing one of them is the whole problem.
Presentation mode is one command that puts the session into a known state, and one that puts it back.
:CamouflagePresent " on
:CamouflagePresent! " offWhile it is on:
- masking is on globally, including in buffers carrying
vim.b.camouflage_enabled = falseand in files of another repository whose project config saysenabled: false - any revealed line is hidden and follow cursor is stopped
-
:CamouflageReveal,:CamouflageFollowCursorand:CamouflageTogglerefuse with a message that says how to leave. So do the Lua functions behind them (disable(),toggle(),reveal.reveal_line(),start_follow_cursor()), so a keymap written against the API can't get past it either - terminal masking is on, see Terminal Masking
Leaving it restores all of that: the global switch as it was, the terminal option as it was, the buffer-local overrides that were cleared, and follow cursor if it had been running.
Value lengths stay visible. The mask is as wide as the value it covers, so the file still lines up. If you want the length hidden too, set mask_length:
require('camouflage').setup({
mask_length = 12,
}):CamouflageYank still works. It copies a real value on purpose, with a confirmation prompt, so it is not something you trigger by accident while presenting.
:CamouflageStatus has a line for it:
[camouflage] Status:
Global: enabled
Buffer: masked
Parser: env
Masked values: 1
Policy: enabled
Policy ignored: 0
Presentation mode: on, 1 masked buffer
The Integrations lualine component shows [P] while it is on:
require('lualine').setup({
sections = {
lualine_x = {
{
'camouflage',
show_present_indicator = true, -- default
present_indicator = '[P]',
},
},
},
})local present = require('camouflage.present')
present.start() -- true when it turned on, false when it already was
present.stop() -- true when it turned off, false when it already was
present.toggle() -- returns the new state
present.is_active() -- boolean
present.status() -- 'off' or 'on, N masked buffers'A keymap for it:
vim.keymap.set('n', '<leader>mp', '<cmd>CamouflagePresent<cr>', { desc = 'Presentation Mode' })- Terminal Masking: what it turns on in terminal buffers
- Security Model: what masking protects against, and what it does not
- Commands and Keymaps: every command