# vimmaster **Repository Path**: mirrors_trending/vimmaster ## Basic Information - **Project Name**: vimmaster - **Description**: VIM Master: in-browser game that teaches core Vim motions and editing commands through short, focused levels. No installs requiredโ€”just open `index.html` and start practicing. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-08-30 - **Last Updated**: 2026-01-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # VIM Master VIM Master -- in-browser game that teaches core Vim motions and editing commands through short, focused levels. ## Try the Online Demo [![Demo Online](https://img.shields.io/badge/demo-online-brightgreen?logo=github&style=for-the-badge)](https://renzorlive.github.io/vimmaster/) > ๐Ÿ’ก **Tip:** For the best experience, use a desktop/laptop (full keyboard support). ## Screenshot ![VIM Master Screenshot](images/vm.gif) ## Features - **Normal/Insert modes** with an on-screen status bar - **Command log** showing your keystrokes - **16 Progressive Levels** that validate your action outcomes (not just keystrokes) - **Complete Vim Support**: `h j k l`, `w b e`, `gg G`, `0 $`, `x`, `dd`, `dw`, `yy`, `p`, `i`, `a`, `o/O`, `cw`, `D`, `r`, ex-commands `:q`, `:wq` - **Numeric counts** for motions/operators (e.g., `3w`, `2dd`, `5x`, `5G`) - **Undo/redo support** (`u`, `Ctrl+r`) - **Vim-style search**: `/` and `?`, with `n`/`N` navigation and match highlighting - **Challenge Mode**: Fast-paced timed challenges to test your Vim skills - **Cheat Mode**: Interactive command reference with instant practice sessions - **Progress Management**: Auto-save, export/import codes, and progress tracking - **Badge System**: Earn visual badges as you learn (Beginner, Search Master) - **Profile Page**: Beautiful showcase of achievements with social media sharing - **Canvas-Based Achievement Cards**: Generate downloadable and shareable images - **Modular Architecture**: Clean, maintainable codebase for easy development ## Recent UI/UX Improvements - **Streamlined Layout**: ASCII logo at top, title under text editor, buttons above instructions - **Compact Achievements**: Achievements container positioned before instructions for better flow - **Collapsible Progress Management**: Click to expand/collapse progress information, reducing UI clutter - **Responsive Design**: Optimized layout for better focus on gameplay elements - **Auto-Focus Editor**: Editor automatically focuses when lessons start for seamless UX - **Challenge Points Integration**: Challenge points now properly tracked and displayed in progress summary - **Enhanced Cheat Mode**: All cheat mode lessons now work with proper auto-focus and completion tracking ## Latest Bug Fixes & Improvements - **Fixed "undefined challenge points"**: Challenge points now properly display in progress summary - **Enhanced Cheat Mode**: All practice lessons now auto-focus and validate completion correctly - **Improved Challenge Mode**: Better validation and scoring system for challenge tasks - **Auto-Focus UX**: Editor automatically focuses when starting lessons for better user experience - **Progress System**: Robust error handling and fallback values for all progress data ## Progress Management System VIM Master features a comprehensive client-side progress tracking system that works entirely in your browser: ### **Features** - **Auto-save**: Progress automatically saved every 5 seconds and after earning badges - **Export/Import Codes**: Generate compact Base64-encoded progress codes for backup and sharing - **Local Storage**: Progress persists between browser sessions - **Progress Summary**: Real-time display of current level, badges earned, and commands practiced - **Clear Progress**: Reset all progress with a single click ### **How It Works** 1. **Export Progress**: Click "Export Progress" to generate a shareable code 2. **Import Progress**: Paste a code and click "Import Progress" to restore your game state 3. **Progress Codes**: Compact, shareable strings containing all your achievements and progress 4. **Privacy First**: All data stays on your device - no accounts or backend required ### **Progress Data Tracked** - Current level and challenge mode status - Earned badges (Beginner, Search Master, etc.) - Commands practiced during gameplay - Challenge points earned from challenge mode - Timestamp of last save ## Profile Page & Social Sharing Showcase your VIM mastery journey with a beautiful profile page and share achievements on social media. ### **Profile Page Features** - **Beautiful Achievement Cards**: Eye-catching cards for each earned badge - **Progress Overview**: Visual representation of your learning journey with circular progress indicators - **ASCII Logo Integration**: The iconic VIM Master logo prominently displayed - **Social Media Integration**: Share achievements on Twitter, Facebook, and other platforms - **Progress Code Management**: Copy and share your progress codes easily - **GitHub Integration**: Links to view source code and contribute to the project ### **Canvas-Based Achievement Cards** - **Dynamic Image Generation**: Create custom achievement cards using HTML5 Canvas - **Downloadable Images**: Save achievement cards as PNG files for sharing - **Social Media Ready**: Optimized dimensions and styling for social platforms - **Custom Branding**: Features the VIM Master ASCII logo and your progress data - **Professional Design**: Beautiful blue/purple gradients with yellow/orange ASCII logo accents ### **Social Sharing Capabilities** - **Twitter Integration**: Share achievements with the developer community - **Facebook Sharing**: Let friends know about your VIM skills - **Mobile Native Sharing**: Uses device's native sharing on mobile devices - **Custom Share Messages**: Automatically generates engaging content for social media - **Progress Code Sharing**: Share your progress codes for backup and collaboration ### **Accessing the Profile Page** - Click the "๐Ÿ‘ค View Profile" button in the main game controls - Use the "๐Ÿ‘ค Profile" link in the progress management section - Navigate directly to `profile.html` ## Levels 1. How to Exit (Ex Commands): type `:q` or `:wq` then Enter 2. Basic Movement: `h j k l` 3. Word Movement: `w b e` 4. Line Jumps: `gg G` 5. Insert Mode: `a` + typing + `Esc` 6. Delete Basics: `dd`, `dw`, `x` 7. Yank & Put: `yy`, `p` 8. Line Bounds: `0`, `$` 9. Append & Open Lines: `a`, `o`, `O` 10. Change Word: `cw` (then type, `Esc`) 11. Delete to End & Replace: `D`, `r` 12. Counts: use `3w` to move multiple words 13. Undo/Redo: `dd`, then `u`, then `Ctrl+r` 14. Search Forward: `/target` then Enter; use `n` 15. Search Backward: `?alpha` then Enter; use `N` 16. Search Navigation: reach the 3rd occurrence with `n` ### Finish Celebration After completing the final level, a centered full-screen celebration overlay appears with a confetti animation and a Play Again button. Press Enter or click Play Again to restart at level 1. ### Badges Earn badges as you progress: - Beginner Badge (๐ŸŸข): complete the early movement lessons. - Search Master Badge (๐Ÿ”Ž): successfully use search commands (`/`, `?`, `n`, `N`). Badges display in a bar under the title, and a toast appears when you earn one. ## Controls - Navigation: `h` left, `j` down, `k` up, `l` right - Words: `w` next, `b` back, `e` end - Lines: `0` start, `$` end, `gg` first line, `G` last line (or `nG` to go to line n) - Insert: `i` insert at cursor, `a` append after cursor, `o` new line below, `O` new line above - Delete: `x` delete character, `dd` delete line, `dw` delete word, `D` delete to end of line - Change: `cw` change word (deletes word and enters Insert) - Replace: `r` then any printable character (supports symbols like `! @ # < > &`) - Counts: prefix a number before commands (e.g., `3w`, `2dd`, `5x`, `5G`) - Undo/Redo: `u` undo, `Ctrl+r` redo - Exit Insert mode: `Esc` or `Ctrl-[` - Search: `/text` forward, `?text` backward; `n` next, `N` previous - Cheat Mode: toggle with `Ctrl+/` (or button) ### Search Edge Cases - Empty search query does nothing. - No matches: status shows `0/0`; `n`/`N` do nothing. - Wrapping: `n`/`N` wrap around the buffer when reaching the ends. ## Challenge Mode The Challenge Mode is a fast-paced game designed to test and improve your Vim command recall under time pressure. Users are presented with a series of command tasks to complete as quickly and accurately as possible. Each correctly executed command scores points, while speed and precision determine the final score. This mode offers an engaging way to sharpen your Vim skills by combining rapid-fire challenges with real-time feedback, making learning Vim commands both fun and effective. ### **Challenge Types** - **Speed Navigation**: Navigate through text quickly using movement commands - **Quick Deletion**: Master deletion commands with time pressure - **Advanced Moves**: Combine multiple commands for complex operations ### **Scoring System** - **Base Points**: Earn points for each completed task - **Time Bonus**: Faster completion earns bonus points - **Accuracy Bonus**: Perfect execution provides additional rewards - **Progress Tracking**: Challenge points are saved and displayed in your progress summary Try to beat your highest score and see how quickly you can master essential Vim commands! ## Cheat Mode Open the built-in, interactive cheat sheet to explore and practice commands on demand. - Toggle: `Ctrl+/` or click the โ€œCheat Modeโ€ button - Search/filter by name or description - Commands grouped by category (Movement, Editing, Search, Other) - Each entry shows keys, a short description, and an example - Click any command to launch a mini-practice; youโ€™ll return to the cheat sheet after completing it - Practiced commands are highlighted in the list ## How Validation Works - Each level defines a target cursor location, target text, or target content layout. - Validation is resilient to trailing spaces and blank lines where appropriate. - You progress when the outcome matches the target; keystroke sequences themselves arenโ€™t strictly enforced. ## Run Locally - No build step. Just clone and open the file: ```bash # Clone repository git clone https://github.com/renzorlive/vimmaster.git cd vimmaster # Switch to advanced-testing branch for latest features git checkout advanced-testing # Open directly in a browser (double-click on Windows) start index.html # Windows # or open index.html # macOS # or xdg-open index.html # Linux ``` If your browser restricts local file access, serve it with any static server, for example: ```bash npx serve . # then visit the printed URL ``` ## Tech Stack - **Plain HTML/CSS/JavaScript** - No frameworks required - **Tailwind CSS** - Utility-first CSS framework via CDN - **ES6 Modules** - Modern JavaScript with import/export - **Local Storage API** - Client-side data persistence - **Canvas API** - Dynamic image generation for sharing - **Web Share API** - Native social media sharing - **No dependencies** - Lightweight and fast ## About the Refactored Version The VIM Master game has undergone a major refactor moving from a single-file codebase to a clean, modular architecture based on ES6 modules for improved maintainability, performance, and developer experience. The refactored version: - Updated UI & UX, kept functionality and lessons - Fixes numerous bugs and improves Challenge and Cheat modes - Improves code organization for easier feature development and testing - Enables faster iteration and collaboration among developers You can explore the refactored version on the `advanced-testing` branch or [Demo deployed on Netlify](https://vimmaster.netlify.app/) and provide feedback. We recommend trying the refactored codebase for the best experience and future updates. For full details, see the [advanced-testing branch README](https://github.com/renzorlive/vimmaster/blob/advanced-testing/README.md) or project documentation. ![Refactor SS](images/vmrf.png) --- ๐Ÿ™ **Thank you to everyone who has starred the GitHub repository and supported this project!** Your encouragement and enthusiasm keep the Vim Master journey going strong. *This update also comes with a new modular codebase for faster improvements and smoother gameplay. Big things are coming! ๐Ÿš€* ## Profile Page & Social Sharing Showcase your VIM mastery journey with a beautiful profile page and share achievements on social media. ### Profile Page Features - **Beautiful Achievement Cards**: Eye-catching cards for each earned badge - **Progress Overview**: Visual representation of your learning journey - **Social Media Integration**: Share achievements on Twitter, Facebook, and other platforms - **Progress Code Management**: Copy and share your progress codes easily - **GitHub Integration**: Links to view source code and contribute to the project ### Social Sharing Capabilities - **Twitter Integration**: Share achievements with the developer community - **Facebook Sharing**: Let friends know about your VIM skills - **Mobile Native Sharing**: Uses device's native sharing on mobile devices - **Custom Share Messages**: Automatically generates engaging content for social media - **Progress Code Sharing**: Share your progress codes for backup and collaboration ### Accessing the Profile Page - Click the "๐Ÿ‘ค View Profile" button in the main game controls - Use the "๐Ÿ‘ค Profile" link in the progress management section - Navigate directly to `profile.html` ## Contributing Issues and PRs are welcome! - **Main Game**: `index.html` contains the game interface - **Profile Page**: `profile.html` showcases achievements and social sharing - **JavaScript Modules**: All game logic is organized in the `js/` directory - **Styling**: `css/main.css` contains custom animations and responsive design - **Keep code readable** and avoid adding heavy dependencies - **Favor small, focused levels** that teach a single concept well ## License MIT ## Acknowledgements - Inspired by Vimโ€™s modal editing and motion/operator design. - ASCII logo included in the page for flair - Built with modern web technologies for the best user experience ## Architecture VIM Master uses a modular architecture for maintainability and performance: ### **Core Modules** - `game-state.js` - Central game state management - `levels.js` - Level definitions and progression - `challenges.js` - Challenge mode implementation - `vim-commands.js` - Vim command execution and tracking - `ui-components.js` - Reusable UI components - `event-handlers.js` - Game event handling and logic - `progress-system.js` - Progress tracking and persistence - `sharing-system.js` - Social sharing and Canvas generation - `profile-page.js` - Profile page functionality - `cheat-mode.js` - Interactive cheat sheet - `main.js` - Application entry point and initialization ### **Data Flow** - Game state is centralized in `game-state.js` - Progress automatically saves to localStorage - Profile page reads from both game state and localStorage - All modules communicate through well-defined interfaces ## Refactoring & Technical Improvements The VIM Master Game has been successfully refactored from a single 2000-line HTML file into a clean, modular JavaScript architecture while preserving the exact same UI, functionality, and lesson content. This refactoring includes numerous bug fixes and improvements to ensure a smooth gaming experience. ### **Project Structure** ``` vimmaster/ โ”œโ”€โ”€ index.html # Main entry point (minimal HTML) โ”œโ”€โ”€ css/ โ”‚ โ””โ”€โ”€ main.css # All extracted styles โ”œโ”€โ”€ js/ โ”‚ โ”œโ”€โ”€ main.js # Main entry point and initialization โ”‚ โ”œโ”€โ”€ game-state.js # Game state management โ”‚ โ”œโ”€โ”€ levels.js # Level definitions and data โ”‚ โ”œโ”€โ”€ challenges.js # Challenge mode logic โ”‚ โ”œโ”€โ”€ vim-commands.js # Vim command handling โ”‚ โ”œโ”€โ”€ ui-components.js # UI rendering and components โ”‚ โ”œโ”€โ”€ cheat-mode.js # Cheat panel functionality โ”‚ โ”œโ”€โ”€ event-handlers.js # Event handling and game logic โ”‚ โ”œโ”€โ”€ progress-system.js # Progress tracking and persistence โ”‚ โ”œโ”€โ”€ sharing-system.js # Social sharing and Canvas generation โ”‚ โ””โ”€โ”€ profile-page.js # Profile page functionality โ””โ”€โ”€ images/ โ””โ”€โ”€ favicon.ico ``` ### **Module Breakdown** #### **1. `index.html` - Main Entry Point** - **Purpose**: Minimal HTML structure that loads all JavaScript modules - **Content**: Preserves exact original UI structure, ASCII logo, and layout - **Changes**: - Extracted all CSS to `css/main.css` - Extracted all JavaScript to modular ES6 modules - Added `` - **Updated**: Changed `