Emacs minor mode that changes cursor appearance in terminal based on cursor-type, with performance optimization, error handling, and buffer-local state tracking.
- Changes cursor shape (box, bar, hbar) based on cursor-type
- Controls cursor blinking with blink-cursor-mode
- Sets cursor color from cursor face
- Performance optimized (updates only when state changes)
- Buffer-local state tracking (no cross-buffer interference)
- Error handling for unsupported terminals
- Global mode for all buffers
(load-file "terminal-cursor-mode.el")
(global-terminal-cursor-mode 1) ; Enable for all buffers(global-terminal-cursor-mode 1) ; Enable for all buffers
(global-terminal-cursor-mode 0) ; Disable(terminal-cursor-mode 1) ; Enable for current buffer
(terminal-cursor-mode 0) ; Disable(setq cursor-type 'bar) ; Bar cursor
(setq cursor-type 'box) ; Block cursor
(setq cursor-type 'hbar) ; Underline cursor
(blink-cursor-mode 1) ; Enable blinking
(set-face-attribute 'cursor nil :background "red") ; Set color- Emacs running in terminal (emacs -nw)
- Terminal supporting ANSI escape sequences