home/develop/emacs: add yasnippet snippets and make snippet dirs configurable
This commit makes two significant changes to the Emacs configuration:
1. Refactors emacs.nix to use proper NixOS module structure:
- Converts from simple configuration to a module with options/config
- Adds `tb.emacs.extraSnippetDirs` option to allow per-machine snippet
directories (defaults to ~/.emacs.d/snippets/)
- Moves yasnippet configuration from custom.el to nix-generated elisp,
enabling dynamic snippet directory configuration via Nix
2. Adds a comprehensive collection of yasnippet snippets for multiple modes:
- C++ mode: 50 snippets for common patterns (class, namespace, operators,
copy/move semantics, debug helpers, documentation, threading primitives)
- CC mode (shared C/C++): for, switch, main, include guards, etc.
- CMake mode: if/else, foreach, function, macro, project boilerplate
- LaTeX mode: document structure, beamer frames, figures, lists
- Perl mode: package boilerplate, shebang
- Python/Shell/Nix/Protobuf/Java/CSS/Dockerfile modes: horizontal rules
and common patterns
- Text mode: modeline snippets for locale settings
The snippets use yasnippet's inheritance system via .yas-parents files,
so c++-mode inherits from cc-mode and text-mode, reducing duplication.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
9
home/develop/emacs/snippets/latex-mode/figure
Normal file
9
home/develop/emacs/snippets/latex-mode/figure
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: figure
|
||||
# key: figure
|
||||
# --
|
||||
\begin{figure}[ht]
|
||||
\centering
|
||||
\includegraphics[${1:options}]{figures/${2:path.pdf}}
|
||||
\caption{\label{fig:${3:label}} $0}
|
||||
\end{figure}
|
||||
Reference in New Issue
Block a user