Skip to content

Presentation Mode

Ahmet Zeybek edited this page Sep 27, 2026 · 2 revisions

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!    " off

What it changes

While it is on:

  • masking is on globally, including in buffers carrying vim.b.camouflage_enabled = false and in files of another repository whose project config says enabled: false
  • any revealed line is hidden and follow cursor is stopped
  • :CamouflageReveal, :CamouflageFollowCursor and :CamouflageToggle refuse 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.

What it does not change

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.

Seeing which mode you are in

: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]',
      },
    },
  },
})

Lua API

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' })

See Also

Clone this wiki locally