Thank you for your interest in contributing to Vim Toggle! This document provides guidelines for contributing to this Obsidian plugin.
- Node.js (version 14 or higher)
- Bun (package manager)
- TypeScript knowledge
- Basic understanding of Obsidian plugin development
- Nix (optional, but recommended for consistent development environment)
This project includes a flake.nix that provides a complete development environment with all necessary tools and dependencies.
-
Fork and Clone
git clone https://github.com/your-username/vim-toggle.git cd vim-toggle -
Enter Development Shell
nix develop
This automatically provides:
- Bun package manager
- TypeScript language server
- Formatters (Alejandra for Nix, Biome for TypeScript/JavaScript)
- Linters (oxlint, statix, deadnix)
- Development scripts
-
Available Scripts in Nix Shell
dx: Edit the flake.nix file
-
Format Code
nix fmt
-
Fork and Clone
git clone https://github.com/your-username/vim-toggle.git cd vim-toggle -
Install Dependencies
bun install
-
Development Build
bun run dev
-
Production Build
bun run build
- Use TypeScript for all new code
- Follow the existing code formatting and style
- Use descriptive variable and function names
- Add JSDoc comments for public methods and interfaces
- Maintain consistent indentation (tabs)
If using the Nix development environment, code formatting is handled automatically:
nix fmt # Formats all code (Nix, TypeScript, JavaScript)If not using Nix, ensure consistent formatting manually or set up the formatters specified in flake.nix:
- Biome for TypeScript/JavaScript
- Alejandra for Nix files
vim-toggle/
├── main.ts # Main plugin code
├── manifest.json # Plugin manifest
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── esbuild.config.mjs # Build configuration
└── docs/ # Documentation assets
-
Create a Feature Branch
git checkout -b feature/your-feature-name
-
Make Your Changes
- Follow the existing code patterns
- Test your changes thoroughly
- Update documentation if needed
-
Build and Test
# With Nix (recommended) nix develop # Enter development shell if not already bun run build # Manual setup bun run build
-
Commit Your Changes
git add . git commit -m "feat: add your feature description"
-
Before Submitting
- Ensure your code builds successfully
- Test the plugin in Obsidian
- Update documentation if necessary
- Follow the commit message format
-
Commit Message Format Use conventional commits:
feat:for new featuresfix:for bug fixesdocs:for documentation changesrefactor:for code refactoringtest:for test additionschore:for maintenance tasks
-
Submit Pull Request
- Provide a clear description of changes
- Reference any related issues
- Include screenshots for UI changes
- Ensure all checks pass
- Use explicit type annotations where helpful
- Leverage Obsidian's type definitions
- Handle errors appropriately
- Use async/await for asynchronous operations
- Follow Obsidian plugin best practices
- Use the plugin lifecycle methods appropriately
- Handle settings persistence correctly
- Provide user feedback for actions
- Ensure mobile compatibility when possible
/**
* Description of what this function does
*/
async functionName(parameter: Type): Promise<ReturnType> {
try {
// Implementation
return result;
} catch (error) {
console.error('Error in functionName:', error);
// Handle error appropriately
}
}-
Install in Obsidian
- Copy built files to
.obsidian/plugins/vim-toggle/ - Enable the plugin in Obsidian settings
- Test all commands and settings
- Copy built files to
-
Test Scenarios
- Toggle vim mode on/off
- Test with canvas files
- Verify settings persistence
- Test notifications
- Check mobile compatibility (if applicable)
- Command functionality
- Settings tab behavior
- Canvas file handling
- Notification system
- Mobile vs desktop differences
Include:
- Obsidian version
- Plugin version
- Operating system
- Steps to reproduce
- Expected vs actual behavior
- Console errors (if any)
Include:
- Clear description of the feature
- Use case or problem it solves
- Possible implementation approach
- Any relevant examples
- Be respectful and constructive
- Focus on the code and ideas, not the person
- Help create a welcoming environment
- Follow GitHub's community guidelines
- Check existing issues and discussions
- Review the Obsidian plugin development documentation
- Ask questions in GitHub discussions
- Join the Obsidian community forums
- VimToggle: Main plugin class handling commands and lifecycle
- VimToggleSettings: Interface defining plugin settings
- VimToggleSettingsTab: Settings UI implementation
toggleVimMode(): Toggles vim stateturnOnVimMode()/turnOffVimMode(): Explicit state changesgetVimMode(): Retrieves current vim state
notification: Show toggle notificationsdebug: Enable debug loggingcanvasVim: Auto-disable vim in canvas files
By contributing to Vim Toggle, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to Vim Toggle! Your efforts help make this plugin better for the entire Obsidian community.