1
0

Compare commits

...

37 Commits

Author SHA1 Message Date
e81f3efde8 tb-scripts: add ,split-1G utility for splitting large files
Add a new utility script for splitting files into 1GB chunks:

,split-1G - File splitting wrapper
- Splits one or more files into 1GB chunks with numeric suffixes
- Uses split(1) with --bytes=1G for consistent chunk sizes
- Generates 5-digit numeric suffixes (.00000, .00001, etc) for up to 99,999 parts
- Outputs verbose progress information during splitting
- Fails fast with set -e to catch errors during multi-file operations
- Added to tb-scripts package with coreutils as runtime dependency

This is useful for preparing large files for upload to services with file
size limits, or for splitting backups/archives into manageable pieces.

Example usage:
  ,split-1G large-backup.tar.gz
  # Creates: large-backup.tar.gz.00000, large-backup.tar.gz.00001, ...

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-11 00:58:12 -08:00
8d95b381da tb-scripts: add ,optipng and ,zipdir utility scripts
Add two new shell utility scripts to the custom script packages:

,optipng - Parallel PNG optimization wrapper
- Detects available CPU cores and runs optipng in parallel using xargs
- Accepts optional file arguments, defaults to all *.png in current dir
- Uses maximum compression level (-o7) for best results
- Added to tb-dev-scripts package with optipng as runtime dependency

,zipdir - Quick directory archiving helper
- Creates a zip archive of the current directory
- Names the archive after the directory and places it in parent folder
- Uses maximum compression (-9) with extra attributes excluded (-X)
- Added to tb-scripts package with zip as runtime dependency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-08 23:48:37 -08:00
a0b0357466 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>
2025-12-08 22:42:14 -08:00
Timo Bingmann
3d098013a9 system/develop: add yaml module for Python3 2025-12-05 18:32:44 -08:00
41febdadfc tb-dev-scripts: add ,video_loop_extractor.py 2025-12-05 10:55:25 -08:00
Timo Bingmann
1000663cb5 also upgrade ebay-mac to 25.11 2025-12-04 12:21:39 -08:00
03b50ccb9f upgrade to 25.11 2025-12-02 17:13:56 -08:00
d28a6049ca home/private: add git base config 2025-12-01 19:26:03 -08:00
78c2a41c55 home/develop/emacs: add go mode 2025-11-23 08:22:16 -08:00
c9269c6644 develop/packages: fix Python3 2025-11-20 22:03:36 -08:00
6416611abe Add custom script packages with Nix dependency management
This commit introduces two new custom script packages: tb-scripts for
all systems and tb-dev-scripts for development machines. These packages
provide a maintainable way to distribute utility scripts across the
infrastructure with proper dependency management.

Created pkgs/ directory with two script collections:

1. **tb-scripts** - General utilities available on all systems:
   - ,jq_reformat: Reformat JSON files in-place with atomic file operations
   - ,rename_lower: Convert filenames to lowercase with validation

2. **tb-dev-scripts** - Development-specific tools:
   - ,cmake_update_fetchcontent: Update CMake FetchContent dependencies

All scripts have been significantly enhanced from their original versions:

- Proper quoting to handle filenames with spaces
- Secure temporary file creation using mktemp
- Atomic file replacement to prevent data loss
- Input validation and comprehensive error handling
- Usage help with -h/--help flag
- Extensive inline comments explaining each section
- Cleanup traps on error

- Complete rewrite in Python for consistency
- Validates files exist before attempting rename
- Checks if target lowercase filename already exists
- Skips files already lowercase (no-op)
- Descriptive error messages for each failure case
- Usage documentation with examples
- Proper exit codes

- Interactive CMake FetchContent dependency updater
- Recursively finds all CMakeLists.txt files via add_subdirectory()
- Queries GitHub API for latest releases/tags
- Compares semantic versions and commit hashes
- Shows available updates in formatted table
- Prompts for confirmation before applying updates
- Atomic file updates with validation

Scripts are packaged using writeShellApplication with proper dependency
injection via runtimeInputs:

- tb-scripts requires: jq, python3
- tb-dev-scripts requires: python3, git

Dependencies are automatically available in PATH when scripts run,
eliminating manual dependency checks.

Created system module files to import the script packages:

- system/default/scripts.nix: Adds tb-scripts to nixosModules.default
- system/develop/scripts.nix: Adds tb-dev-scripts to nixosModules.develop

Updated flake.nix to import these modules in the appropriate contexts.

- Scripts have proper Nix-managed dependencies
- No manual installation or PATH configuration needed
- Easy to extend with additional scripts
- Scripts are validated with shellcheck during build
- Clear separation between all-systems and dev-only utilities
- Comprehensive error handling and user documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 05:49:51 -08:00
36a2d10cb1 add zenwifi router 2025-11-15 23:59:17 -08:00
0c5a54499d Add homeManagerModules.claude for Claude Code configuration management
This commit introduces a new home-manager module that provides declarative
configuration management for Claude Code, Anthropic's official CLI tool. The
module follows the established pattern used by other home-manager modules in
this flake (default, private, macos, develop) and enables users to deploy
custom Claude Code slash commands and configuration files to ~/.claude/.

Changes included:

1. Created home/claude/config.nix module:
   - Defines a new home-manager module for Claude Code configuration
   - Uses home.file to deploy command files from the Nix store to ~/.claude/
   - Currently deploys two custom slash commands to ~/.claude/commands/

2. Added two custom slash commands:
   - commit.md: Automates git commit creation by reading staged diffs and
     generating comprehensive commit messages
   - go-plan.md: Writes detailed implementation plans to PLAN.md before
     starting work, supporting the planning workflow

3. Registered homeManagerModules.claude in flake.nix:
   - Added as a new, independent module group that can be imported separately
   - Positioned after the develop module for logical organization
   - Can be enabled by importing inputs.nix-shared.homeManagerModules.claude

4. Enhanced flake.nix documentation:
   - Added descriptive comments for all nixosModules and homeManagerModules
   - Clarifies the purpose of each module group (e.g., "Linux specific system
     configuration", "Add private homelab and cloud host aliases")
   - Improves maintainability and makes the flake structure self-documenting

The module structure supports easy extension - additional slash commands or
configuration files can be added by placing them in home/claude/config/ and
adding corresponding home.file entries in config.nix.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-13 23:29:04 -08:00
Timo Bingmann
192f09e86f packages: don't get clang 2025-11-10 10:29:28 -08:00
7f1f44174a enable forwardAgent for private hosts 2025-11-06 08:28:22 -08:00
78a52810d0 rename wg1 to tr1 at home 2025-11-05 18:57:59 -08:00
0de3ffd6b3 create homeManagerModules.private for ssh hosts 2025-11-04 22:34:57 -08:00
b0a0d1efcd linux: add openssh and tb user account 2025-11-04 18:50:32 -08:00
Timo Bingmann
e823d9af7a macos: Disable click on desktop action. 2025-09-24 09:08:56 -07:00
Timo Bingmann
dbd6913638 macos: add Terminal settings 2025-09-22 15:03:06 -07:00
Timo Bingmann
6a20426279 macos/hotkeys: add mission control left/right 2025-09-22 10:13:47 -07:00
ccdfedeaed develop/packages: add gnupg 2025-09-22 09:59:59 -07:00
1a5009f4af add system/linux/i18n.nix 2025-09-22 08:46:06 -07:00
abe5a405d0 add ssh-authorized-keys.nix for all hosts 2025-09-21 21:13:57 -07:00
ba45fb66ab add more development packages 2025-09-21 19:47:25 -07:00
05d4fd7ed2 create home/macos/home.nix 2025-09-21 19:15:01 -07:00
b699896f68 add nixosModules.develop containing packages 2025-09-21 18:52:49 -07:00
a204bbcf72 macos: set up symbol hotkeys 2025-09-21 18:04:38 -07:00
d93557d7bf macos: add yabai window manager 2025-09-21 16:03:27 -07:00
84ec7b5318 add nix settings and dir colors for MacOS 2025-09-21 15:49:19 -07:00
91a1aa83f7 macos/system: add shells 2025-09-21 09:20:39 -07:00
86e02b4e3b default/packages: add more global packages (missing on MacOS) 2025-09-21 09:10:24 -07:00
32df76566c macos/system.nix: use primaryUser 2025-09-21 08:52:46 -07:00
cf21b98a9d packages: add tree package everywhere 2025-09-20 10:38:02 -07:00
f36c140300 Disable core dumps via pam 2025-09-19 22:33:29 -07:00
9f57a00ffe system/default: add prompt.nix for prompt coloring 2025-09-19 22:17:53 -07:00
6cc3a633e6 enable formatter 2025-09-19 22:17:25 -07:00
145 changed files with 2852 additions and 175 deletions

123
flake.nix
View File

@@ -2,47 +2,92 @@
description = "Timo's Shared Nix Modules"; description = "Timo's Shared Nix Modules";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
}; };
outputs = { self, nixpkgs, ... }: outputs = { self, nixpkgs, ... }: {
{ # Set up formatter.
# System Modules formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
nixosModules.default = { ... }: {
imports = [
./system/default/editor.nix
./system/default/nix.nix
./system/default/packages.nix
];
};
nixosModules.linux = { ... }: { # Global all-hosts configuration
imports = [ nixosModules.default = { ... }: {
./system/linux/system.nix imports = [
]; ./system/default/editor.nix
}; ./system/default/nix.nix
./system/default/packages.nix
nixosModules.macos = { ... }: { ./system/default/prompt.nix
imports = [ ./system/default/scripts.nix
./system/macos/system.nix ./system/default/ssh-authorized-keys.nix
./system/macos/fonts.nix ];
];
};
# Home Manager Modules
homeManagerModules.default = { ... }: {
imports = [
./home/default/bash.nix
./home/default/basic.nix
./home/default/direnv.nix
./home/default/git.nix
];
};
homeManagerModules.develop = { ... }: {
imports = [
./home/develop/emacs.nix
];
};
}; };
# Linux specific system configuration
nixosModules.linux = { ... }: {
imports = [
./system/linux/i18n.nix
./system/linux/openssh.nix
./system/linux/system.nix
./system/linux/user-tb.nix
];
};
# MacOS specific system configuration
nixosModules.macos = { ... }: {
imports = [
./system/macos/environment.nix
./system/macos/fonts.nix
./system/macos/hotkeys.nix
./system/macos/nix.nix
./system/macos/system.nix
./system/macos/yabai.nix
];
};
# Tools on all development machines
nixosModules.develop = { ... }: {
imports = [
./system/develop/packages.nix
./system/develop/scripts.nix
];
};
# Home Manager Modules
homeManagerModules.default = { ... }: {
imports = [
./home/default/bash.nix
./home/default/basic.nix
./home/default/direnv.nix
./home/default/git.nix
];
};
# Add private homelab and cloud host aliases
homeManagerModules.private = { ... }: {
imports = [
./home/private/git.nix
./home/private/ssh-hosts.nix
];
};
# MacOS specific home configuration
homeManagerModules.macos = { ... }: {
imports = [
./home/macos/home.nix
];
};
# Emacs Configuration
homeManagerModules.develop = { ... }: {
imports = [
./home/develop/emacs.nix
];
};
# Claude Code configuration
homeManagerModules.claude = { ... }: {
imports = [
./home/claude/config.nix
];
};
};
} }

11
home/claude/config.nix Normal file
View File

@@ -0,0 +1,11 @@
{ lib, ... }:
{
# Copy Claude Code configuration files to ~/.claude/
# Using activation script instead of home.file to copy (not symlink) files
home.activation.copyClaudeCommands = lib.hm.dag.entryAfter ["writeBoundary"] ''
$DRY_RUN_CMD mkdir -p $VERBOSE_ARG $HOME/.claude/commands
$DRY_RUN_CMD cp $VERBOSE_ARG ${./config/commands/commit.md} $HOME/.claude/commands/commit.md
$DRY_RUN_CMD cp $VERBOSE_ARG ${./config/commands/go-plan.md} $HOME/.claude/commands/go-plan.md
$DRY_RUN_CMD chmod $VERBOSE_ARG 644 $HOME/.claude/commands/*.md
'';
}

View File

@@ -0,0 +1 @@
Make another git commit -- read the git diff of staged files and write a good long description

View File

@@ -0,0 +1 @@
Write the detailed plan to PLAN.md and start.

View File

@@ -4,7 +4,7 @@
enable = true; enable = true;
lfs.enable = true; lfs.enable = true;
extraConfig = { settings = {
pull.ff = "only"; pull.ff = "only";
merge.conflictstyle = "zdiff3"; merge.conflictstyle = "zdiff3";

View File

@@ -1,125 +1,149 @@
{ pkgs, ... }: { config, pkgs, lib, ... }:
let
snippetsPath = ./emacs/snippets;
extraSnippetDirs = config.tb.emacs.extraSnippetDirs;
allSnippetDirs = [ "${snippetsPath}" ] ++ extraSnippetDirs;
snippetDirsLisp = lib.concatMapStringsSep " " (d: ''"${d}"'') allSnippetDirs;
in
{ {
programs.emacs = { options.tb.emacs.extraSnippetDirs = lib.mkOption {
enable = true; type = lib.types.listOf lib.types.str;
default = ["~/.emacs.d/snippets/"];
# Optionally provide extra packages not in the configuration file. description = "Additional snippet directories for yasnippet";
extraPackages = epkgs: with epkgs; [
# === WEB AND SERVER CONFIGURATION ===
apache-mode # Syntax highlighting for Apache config files
nginx-mode # Syntax highlighting for Nginx config files
# === HARDWARE AND EMBEDDED DEVELOPMENT ===
arduino-mode # Arduino sketch development support
# === DOCUMENT PREPARATION ===
auctex # Comprehensive LaTeX editing environment
pandoc-mode # Pandoc document converter integration
# === PROGRAMMING LANGUAGE SUPPORT ===
basic-mode # BASIC programming language support
bison-mode # Bison parser generator syntax
cmake-mode # CMake build system configuration
coffee-mode # CoffeeScript programming language
csharp-mode # C# programming language
groovy-mode # Groovy/Jenkins pipeline scripting
haskell-mode # Haskell functional programming
js2-mode # Enhanced JavaScript editing mode
lua-mode # Lua scripting language
php-mode # PHP web development
python-mode # Python programming language
scala-mode # Scala programming language
# === MARKUP AND DATA FORMATS ===
csv-mode # Comma-separated values file editing
dockerfile-mode # Docker container definition files
jinja2-mode # Jinja2 template engine syntax
markdown-mode # Markdown markup language
nix-mode # Nix expression language (NixOS configs)
protobuf-mode # Protocol Buffers schema definitions
qml-mode # Qt QML user interface markup
yaml-mode # YAML configuration files
gnuplot-mode # Gnuplot script editing and plotting integration
# === SEARCH AND FILE UTILITIES ===
rg # Ripgrep searcher integration for fast text search
diredfl # Enhanced font-locking for dired mode
dired-ranger # File operations with copy/move/paste semantics
# === TEXT COMPLETION AND PRODUCTIVITY ===
company # Text completion framework
smex # Enhanced M-x command with history
# === USER INTERFACE ENHANCEMENTS ===
diminish # Hide minor modes from the mode line
smooth-scrolling # Smoother scrolling experience
rainbow-delimiters # Color-code nested parentheses/brackets
# === ENVIRONMENT AND PROJECT MANAGEMENT ===
direnv # Environment variable management per directory
projectile # Project interaction and navigation library
# === LANGUAGE SERVER PROTOCOL (LSP) ===
# Modern language support with intelligent features
eglot # Built-in LSP client (simpler alternative to lsp-mode)
lsp-mode # Comprehensive Language Server Protocol client
lsp-java # Java language server integration
lsp-metals # Scala language server (Metals) integration
eglot-java # Java support for eglot LSP client
sbt-mode # Scala Build Tool integration
dap-mode # Debug Adapter Protocol for debugging support
# === SYNTAX CHECKING ===
flycheck # On-the-fly syntax checking framework
# === VERSION CONTROL ===
git-link # Generate links to Git repository web interfaces
magit # Comprehensive Git porcelain for Emacs
# === TEXT EDITING ENHANCEMENTS ===
goto-last-change # Jump to the location of last edit
iedit # Edit multiple occurrences of text simultaneously
bm # Visual bookmarks for quick navigation
# === CODE FORMATTING AND CLEANUP ===
web-beautify # Format and beautify web code (HTML/CSS/JS)
ethan-wspace # Automatically clean up whitespace on save
# === PARENTHESES AND STRUCTURE EDITING ===
paredit # Balanced parentheses editing for Lisp-like languages
smartparens # Smart handling of pairs (parentheses, quotes, etc.)
# === SNIPPETS AND TEMPLATES ===
yasnippet # Template system for inserting code snippets
quelpa-use-package # Package management for packages not in MELPA
# === VISUAL THEMES ===
grandshell-theme # Dark theme with good contrast
leuven-theme # Light theme designed for readability
# === TREE-SITTER GRAMMARS ===
# Modern syntax highlighting and parsing using tree-sitter
treesit-grammars.with-all-grammars # All available tree-sitter language grammars
# === TREE-SITTER BASED MODES ===
# These modes use tree-sitter for better performance and accuracy
awk-ts-mode # AWK script editing with tree-sitter
dart-mode # Dart programming (Flutter development)
graphql-ts-mode # GraphQL query language with tree-sitter
jq-ts-mode # jq JSON processor with tree-sitter
markdown-ts-mode # Markdown with tree-sitter parsing
mermaid-ts-mode # Mermaid diagram syntax with tree-sitter
scala-ts-mode # Scala with tree-sitter (alternative to scala-mode)
swift-ts-mode # Swift programming with tree-sitter
];
extraConfig = builtins.readFile ./emacs/custom.el;
}; };
# System packages required by various emacs packages config = {
home.packages = with pkgs; [ programs.emacs = {
# Search and file utilities enable = true;
ripgrep # Required for rg package
]; # Optionally provide extra packages not in the configuration file.
extraPackages = epkgs: with epkgs; [
# === WEB AND SERVER CONFIGURATION ===
apache-mode # Syntax highlighting for Apache config files
nginx-mode # Syntax highlighting for Nginx config files
# === HARDWARE AND EMBEDDED DEVELOPMENT ===
arduino-mode # Arduino sketch development support
# === DOCUMENT PREPARATION ===
auctex # Comprehensive LaTeX editing environment
pandoc-mode # Pandoc document converter integration
# === PROGRAMMING LANGUAGE SUPPORT ===
basic-mode # BASIC programming language support
bison-mode # Bison parser generator syntax
cmake-mode # CMake build system configuration
coffee-mode # CoffeeScript programming language
csharp-mode # C# programming language
groovy-mode # Groovy/Jenkins pipeline scripting
go-mode # Go programming language
haskell-mode # Haskell functional programming
js2-mode # Enhanced JavaScript editing mode
lua-mode # Lua scripting language
php-mode # PHP web development
python-mode # Python programming language
scala-mode # Scala programming language
# === MARKUP AND DATA FORMATS ===
csv-mode # Comma-separated values file editing
dockerfile-mode # Docker container definition files
jinja2-mode # Jinja2 template engine syntax
markdown-mode # Markdown markup language
nix-mode # Nix expression language (NixOS configs)
protobuf-mode # Protocol Buffers schema definitions
qml-mode # Qt QML user interface markup
yaml-mode # YAML configuration files
gnuplot-mode # Gnuplot script editing and plotting integration
# === SEARCH AND FILE UTILITIES ===
rg # Ripgrep searcher integration for fast text search
diredfl # Enhanced font-locking for dired mode
dired-ranger # File operations with copy/move/paste semantics
# === TEXT COMPLETION AND PRODUCTIVITY ===
company # Text completion framework
smex # Enhanced M-x command with history
# === USER INTERFACE ENHANCEMENTS ===
diminish # Hide minor modes from the mode line
smooth-scrolling # Smoother scrolling experience
rainbow-delimiters # Color-code nested parentheses/brackets
# === ENVIRONMENT AND PROJECT MANAGEMENT ===
direnv # Environment variable management per directory
projectile # Project interaction and navigation library
# === LANGUAGE SERVER PROTOCOL (LSP) ===
# Modern language support with intelligent features
eglot # Built-in LSP client (simpler alternative to lsp-mode)
lsp-mode # Comprehensive Language Server Protocol client
lsp-java # Java language server integration
lsp-metals # Scala language server (Metals) integration
eglot-java # Java support for eglot LSP client
sbt-mode # Scala Build Tool integration
dap-mode # Debug Adapter Protocol for debugging support
# === SYNTAX CHECKING ===
flycheck # On-the-fly syntax checking framework
# === VERSION CONTROL ===
git-link # Generate links to Git repository web interfaces
magit # Comprehensive Git porcelain for Emacs
# === TEXT EDITING ENHANCEMENTS ===
goto-last-change # Jump to the location of last edit
iedit # Edit multiple occurrences of text simultaneously
bm # Visual bookmarks for quick navigation
# === CODE FORMATTING AND CLEANUP ===
web-beautify # Format and beautify web code (HTML/CSS/JS)
ethan-wspace # Automatically clean up whitespace on save
# === PARENTHESES AND STRUCTURE EDITING ===
paredit # Balanced parentheses editing for Lisp-like languages
smartparens # Smart handling of pairs (parentheses, quotes, etc.)
# === SNIPPETS AND TEMPLATES ===
yasnippet # Template system for inserting code snippets
quelpa-use-package # Package management for packages not in MELPA
# === VISUAL THEMES ===
grandshell-theme # Dark theme with good contrast
leuven-theme # Light theme designed for readability
# === TREE-SITTER GRAMMARS ===
# Modern syntax highlighting and parsing using tree-sitter
treesit-grammars.with-all-grammars # All available tree-sitter language grammars
# === TREE-SITTER BASED MODES ===
# These modes use tree-sitter for better performance and accuracy
awk-ts-mode # AWK script editing with tree-sitter
dart-mode # Dart programming (Flutter development)
graphql-ts-mode # GraphQL query language with tree-sitter
jq-ts-mode # jq JSON processor with tree-sitter
markdown-ts-mode # Markdown with tree-sitter parsing
mermaid-ts-mode # Mermaid diagram syntax with tree-sitter
scala-ts-mode # Scala with tree-sitter (alternative to scala-mode)
swift-ts-mode # Swift programming with tree-sitter
];
extraConfig = builtins.readFile ./emacs/custom.el + ''
;; Yasnippet configuration (generated by nix)
(use-package yasnippet
:init
(setq yas-snippet-dirs '(${snippetDirsLisp}))
:config
(yas-reload-all)
(yas-global-mode 1))
'';
};
# System packages required by various emacs packages
home.packages = with pkgs; [
# Search and file utilities
ripgrep # Required for rg package
];
};
} }

View File

@@ -386,14 +386,6 @@ frame if FRAME is nil, and to 1 if AMT is nil."
try-expand-list try-expand-list
try-expand-line))) try-expand-line)))
;; Yet another snippet extension for Emacs.
(use-package yasnippet
:init
(setq yas-snippet-dirs '("~/.emacs.d/snippets/"))
:config
(yas-reload-all)
(yas-global-mode 1))
;; Clean up whitespace ;; Clean up whitespace
(use-package ethan-wspace (use-package ethan-wspace
:ensure t :ensure t

View File

@@ -0,0 +1,2 @@
cc-mode
text-mode

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: A
# key: A
# binding: direct-keybinding
# --
ASSERT_EQ($0)

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: ac
# key: ac
# --
* @param[in] alloc Memory allocator to use.

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: alloc
# key: alloc
# --
const xplat::polymorphic_allocator<> alloc;

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: ator
# key: ator
# --
const xplat::polymorphic_allocator<> alloc;

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: be
# key: be
# --
$1.begin(), $1.end()

View File

@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# contributor: York Zhao <gtdplatform@gmail.com>
# name: cerr
# key: cerr
# --
`(progn (save-excursion) (goto-char (point-min)) (unless (re-search-forward
"^using\\s-+namespace std;" nil 'no-errer) "std::"))
`cerr << $0 << '\n';

View File

@@ -0,0 +1,13 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: class
# key: class
# binding: direct-keybinding
# --
class ${1:Class}
{
public:
$1()
: { }
private:
};

View File

@@ -0,0 +1,10 @@
# -*- mode: snippet -*-
# name: cmd
# key: cmd
# --
static void ${1:cmd}(base::Cmd& cmd)
{
$0
}
CMD($1, "$1");

View File

@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: constructor
# key: ct
# --
${1:Class}::$1(${2:args}) ${3: : ${4:init}}
{
$0
}

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: copy
# key: copy
# binding: direct-keybinding
# --
* Copyright (C) `(format-time-string "%Y" (current-time))` Timo Bingmann <tb@panthema.net>

View File

@@ -0,0 +1,14 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: copymove
# key: copymove
# binding: direct-keybinding
# expand-env: ((yas-indent-line 'fixed))
# --
//! default copy-constructor
${1:class}(const $1 &) = default;
//! default assignment operator
$1 & operator = (const $1 &) = default;
//! move-constructor: default
$1($1 &&) = default;
//! move-assignment operator: default
$1 & operator = ($1 &&) = default;

View File

@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# contributor: York Zhao <gtdplatform@gmail.com>
# name: cout
# key: cout
# --
`(progn (save-excursion) (goto-char (point-min)) (unless (re-search-forward
"^using\\s-+namespace std;" nil 'no-errer) "std::"))
`cout << $0 << '\n';

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: cv
# key: cv
# --
std::cout << "$1 " << $1 << std::endl;

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: d
# key: d
# --
qDebug() <<

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: debug
# key: debug
# binding: direct-keybinding
# --
static constexpr bool debug = true;

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: debugf
# key: debugf
# binding: direct-keybinding
# --
static constexpr bool debug = false;

View File

@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: doc
# key: doc
# --
/**
* @brief $1
*/

View File

@@ -0,0 +1,12 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: dog
# key: dog
# binding: direct-keybinding
# expand-env: ((yas-indent-line 'fixed))
# --
//! \\name $1
//! \\{
$0
//! \\}

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: el
# key: el
# --
<< std::endl

View File

@@ -0,0 +1,14 @@
# -*- mode: snippet -*-
# name: functor
# key: functor
# --
class ${1:Functor}
{
public:
$1($2) { }
void operator () () const {
}
private:
};

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: hi
# key: hi
# --
/*`(make-string (- 78 (current-column)) ?-)`*/

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: i
# key: i
# binding: direct-keybinding
# --
`(if (char-equal ?) (preceding-char)) "," "")` m_${1:var}($1)

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: lock
# key: lock
# binding: direct-keybinding
# --
std::unique_lock<std::mutex> lock$1(mutex$1_);

View File

@@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: mutexlock
# key: mutexlock
# binding: direct-keybinding
# --
static std::mutex mutex$1;
std::unique_lock<std::mutex> lock$1(mutex$1);

View File

@@ -0,0 +1,17 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: mysource
# key: mysource
# binding: direct-keybinding
# --
/*******************************************************************************
* $1/<file>
*
* $2
******************************************************************************/
namespace $1 {
} // namespace $1
/******************************************************************************/

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: nl
# key: nl
# --
// NOLINTNEXTLINE($1)

View File

@@ -0,0 +1,10 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: noncopy
# key: noncopy
# binding: direct-keybinding
# expand-env: ((yas-indent-line 'fixed))
# --
//! non-copyable: delete copy-constructor
${1:class}(const $1 &) = delete;
//! non-copyable: delete assignment operator
$1 & operator = (const $1 &) = delete;

View File

@@ -0,0 +1,14 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: noncopymove
# key: noncopymove
# binding: direct-keybinding
# expand-env: ((yas-indent-line 'fixed))
# --
//! non-copyable: delete copy-constructor
${1:class}(const $1 &) = delete;
//! non-copyable: delete assignment operator
$1 & operator = (const $1 &) = delete;
//! move-constructor: default
$1($1 &&) noexcept = default;
//! move-assignment operator: default
$1 & operator = ($1 &&) noexcept = default;

View File

@@ -0,0 +1,10 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: namespace
# key: ns
# binding: direct-keybinding
# --
namespace $1 {
$0
} // namespace $1

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: al
# key: al
# --
allocator_type alloc

View File

@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: operator>>
# key: op>>
# --
istream& operator>>(istream& s, const ${1:type}& ${2:c})
{
$0
}

View File

@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: operator<
# key: op<
# --
friend bool operator < (const ${1:type}& a, const $1& b)
{
return $0;
}

View File

@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: operator<<
# key: op<<
# --
friend std::ostream& operator << (std::ostream& os, const ${1:type}& ${2:x})
{
return os << $0;
}

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: os
# key: os
# --
os << " $1=" << x.$1;

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: oso
# key: oso
# --
if (${2:t}.${1:var})
os << " $1=" << $2.$1;

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: oss
# key: oss
# --
std::ostringstream oss;
oss << $0

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: pe
# key: pe
# --
v.$1 += p.$1;

View File

@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: perl
# key: perl
# --
/*[[[perl
$0
]]]*/
//[[[end]]]

View File

@@ -0,0 +1,10 @@
# -*- mode: snippet -*-
# name: q
# key: q
# --
db::Query q = cmd.db_.query << "SELECT $1"
<< into(...);
while (q.next())
{
}

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: stdrand
# key: stdrand
# binding: direct-keybinding
# --
std::default_random_engine ${1:name}(std::random_device { } ())

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: stdsleep
# key: stdsleep
# binding: direct-keybinding
# --
std::this_thread::sleep_for(std::chrono::seconds($1));

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: sv
# key: sv
# --
std::string_view

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: svlit
# key: svlit
# --
using namespace std::string_view_literals;

View File

@@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: timestamp
# key: timestamp
# --
//! Time is measured using chrono::steady_clock
static double timestamp() {
return std::chrono::duration_cast<std::chrono::duration<double> >(
std::chrono::steady_clock::now().time_since_epoch()).count();
}

View File

@@ -0,0 +1,10 @@
# -*- mode: snippet -*-
# name: try
# key: try
# a bit too intrusive now still, not always I want to do this
# --
try {
$0
} catch (${1:std::exception& e}) {
}

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: using_ator
# key: using
# --
using allocator_type = xplat::polymorphic_allocator<>;

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: ls
# key: ls
# --
common::allocate_local_shared

View File

@@ -0,0 +1,2 @@
cc-mode
text-mode

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: hr
# key: hr
# --
################################################################################

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: c
# key: c
# binding: direct-keybinding
# --
/* $1 */

View File

@@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: cc
# key: cc
# binding: direct-keybinding
# --
/** $1
*/

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: comment-spacerline
# key: ***
# binding: direct-keybinding
# --
/******************************************************************************/

View File

@@ -0,0 +1,8 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: for
# key: for
# binding: direct-keybinding
# --
for ($1) {
$0
}

View File

@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: fori
# key: fori
# --
for (${1:std::size_t} ${2:i} = ${3:0}; $2 ${4:!= size()}; ++$2) {
$0
}

View File

@@ -0,0 +1,10 @@
# -*- mode: snippet -*-
# name: guard
# key: guard
# --
#ifndef ${1:NAME}_HEADER
#define $1_HEADER
$0
#endif // $1_HEADER

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: in
# key: in
# binding: direct-keybinding
# --
#include <$0>

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: inc
# key: inc
# binding: direct-keybinding
# --
#include "$0"

View File

@@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: main
# key: main
# --
int main(${1:int argc, char *argv[]})
{
$0
return 0;
}

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: packed
# key: packed
# --
__attribute__((__packed__))$0

View File

@@ -0,0 +1,11 @@
# -*- mode: snippet -*-
# name: switch
# key: case
# --
switch (${1:ch}) {
case ${2:const}:
${3:a = b};
break;
${4:default:
${5:action}}
}

View File

@@ -0,0 +1 @@
text-mode

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: cmake_minimum_required
# key: min
# --
cmake_minimum_required(VERSION ${1:2.6})

View File

@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: foreach
# key: for
# --
foreach(${1:item} \${${2:array}})
$0
endforeach()

View File

@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: function
# key: fun
# --
function (${1:name})
$0
endfunction()

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: hr
# key: hr
# binding: direct-keybinding
# --
`(make-string (- 80 (current-column)) ?#)`

View File

@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: if
# key: if
# --
if(${1:cond})
$0
endif()

View File

@@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: ifelse
# key: if
# --
if(${1:cond})
$2
else(${3:cond})
$0
endif()

View File

@@ -0,0 +1,5 @@
# type: command
# key: inc
# name: include
# --
include ($0)

View File

@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: macro
# key: macro
# --
macro(${1:name}${2: args})
endmacro()

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: message
# key: msg
# --
message(${1:STATUS }"$0")

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: option
# key: opt
# --
option (${1:OPT} "${2:docstring}" ${3:value})

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: project
# key: proj
# --
project ($0)

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: set
# key: set
# --
set(${1:var} ${2:value})

View File

@@ -0,0 +1 @@
text-mode

View File

@@ -0,0 +1,21 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: package
# key: package
# binding: direct-keybinding
# --
#!/usr/bin/perl -w
package ${1:package};
use strict;
use warnings;
use diagnostics;
use utf8;
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw();
our @EXPORT_OK = qw();
1;

View File

@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: perl
# key: perl
# --
#!/usr/bin/env perl
use strict;
use warnings;

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: doc
# key: doc
# binding: direct-keybinding
# --
/* $1 */

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: hr
# key: hr
# --
################################################################################

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: hr
# key: hr
# --
################################################################################

View File

@@ -0,0 +1,2 @@
cc-mode
text-mode

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: hr
# key: hr
# --
/*`(make-string (- 78 (current-column)) ?*)`*/

View File

@@ -0,0 +1 @@
text-mode

View File

@@ -0,0 +1,8 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: begin
# key: begin
# binding: direct-keybinding
# --
\begin{${1:environment}}
$0
\end{$1}

View File

@@ -0,0 +1,12 @@
# -*- mode: snippet -*-
# name: cols
# key: cols
# --
\begin{columns}
\begin{column}{${1:.5}\linewidth}
column 1
\end{column}
\begin{column}{${2:.5}\linewidth}
column 2
\end{column}
\end{columns}

View File

@@ -0,0 +1,8 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: enumerate
# key: enumerate
# binding: direct-keybinding
# --
\begin{enumerate}
\item $0
\end{enumerate}

View 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}

View File

@@ -0,0 +1,10 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: frame
# key: frame
# binding: direct-keybinding
# --
% ------------------------------------------------------------------------------
\begin{frame}{${1:title}}
\end{frame}

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: ho
# key: ho
# --
% ---[ $1 ]-------------------------------------------------

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: hr
# key: hr
# binding: direct-keybinding
# --
% `(make-string (- 80 (current-column)) ?-)`

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: hrr
# key: hrr
# binding: direct-keybinding
# --
% ==============================================================================

View File

@@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: hrx
# key: hrx
# --
% %
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
% %

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: hx
# key: hx
# --
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Some files were not shown because too many files have changed in this diff Show More