Vimcraft Docs / Autocommands
Autocommands
Status: Phase 4 (In Development)
Event-driven automation system.
Creating Autocommands (Coming Soon)
// File type detection vim.api.nvimCreateAutocmd('BufRead', { pattern: '*.js', callback: (args) => { vim.opt.tabStop = 2; vim.opt.shiftWidth = 2; } }); // Auto-save on focus lost vim.api.nvimCreateAutocmd('FocusLost', { pattern: '*', command: 'silent! wa' }); // Format on save vim.api.nvimCreateAutocmd('BufWritePre', { pattern: ['*.ts', '*.js'], callback: () => { vim.lsp.buf.format(); } });
Event Types (Coming Soon)
- BufRead, BufWrite - Buffer operations
- FileType - File type detection
- InsertEnter, InsertLeave - Mode changes
- CursorMoved, CursorHold - Cursor events
- TextChanged, TextChangedI - Text modifications
- VimEnter, VimLeave - Editor lifecycle