Thank you for your interest in contributing to TMC.vim! This document provides guidelines and instructions for contributing.
- Vim 8.2+ or Neovim 0.5+
- Git
- Python 3.x (for vint linter)
- Basic knowledge of VimScript
-
Fork the repository on GitHub
-
Clone your fork:
git clone https://github.com/YOUR_USERNAME/tmc.vim.git cd tmc.vim -
Install development dependencies:
# Install Vader.vim for testing git clone https://github.com/junegunn/vader.vim.git ~/.vim/plugged/vader.vim # Install vint for linting pip install vim-vint
-
Create a branch for your changes:
git checkout -b feature/my-new-feature
- Use 2 spaces for indentation
- Add
abortkeyword to all functions - Use descriptive variable names (prefix with
l:for local,g:for global,s:for script-local,a:for arguments) - Add comments for complex logic
- Keep functions focused and small
- Use meaningful function names with the
tmc#module#functionpattern
" Good
function! tmc#util#echo_error(msg) abort
echohl ErrorMsg
echom a:msg
echohl None
endfunction
" Bad
function! err(m)
echom a:m
endfunctionRun all tests with Vader.vim:
# Using Vim
vim -Nu NONE -c "set runtimepath+=.,~/.vim/plugged/vader.vim" \
-c "runtime plugin/tmc.vim" \
-c "Vader! test/**/*.vader"
# Using Neovim
nvim --headless -u NONE \
-c "set runtimepath+=.,~/.vim/plugged/vader.vim" \
-c "runtime plugin/tmc.vim" \
-c "Vader! test/**/*.vader"vint autoload/ plugin/- Place unit tests in
test/unit/ - Place integration tests in
test/integration/ - Use descriptive test names
- Include both positive and negative test cases
- Test both Vim and Neovim when relevant
Example test structure:
Execute (Test description):
" Setup
let expected = 'value'
" Execute
let result = tmc#some#function()
" Assert
AssertEqual expected, result
-
Update your branch with the latest changes from main:
git fetch upstream git rebase upstream/main
-
Run tests and ensure they pass:
vim -Nu NONE -c "set runtimepath+=.,~/.vim/plugged/vader.vim" \ -c "Vader! test/**/*.vader"
-
Run linter and fix any issues:
vint autoload/ plugin/
-
Commit your changes with clear messages:
git commit -m "Add feature X"Commit message guidelines:
- Use present tense ("Add feature" not "Added feature")
- First line should be 50 characters or less
- Reference issues and PRs liberally
-
Push to your fork:
git push origin feature/my-new-feature
-
Create a Pull Request on GitHub
- Provide a clear description of the changes
- Reference any related issues
- Include test coverage for new features
- Update documentation if needed
- Ensure CI passes
- Be responsive to feedback
tmc.vim/
├── autoload/
│ ├── tmc.vim # Backward compatibility layer
│ └── tmc/
│ ├── util.vim # Utility functions (messaging)
│ ├── core.vim # Core compatibility shims
│ ├── project.vim # Project/exercise management
│ ├── course.vim # Course management
│ ├── exercise.vim # Exercise management
│ ├── cli.vim # CLI integration
│ ├── auth.vim # Authentication
│ ├── ui.vim # UI components
│ ├── submit.vim # Exercise submission
│ ├── run_tests.vim # Test execution
│ ├── download.vim # Exercise download
│ ├── paste.vim # Paste functionality
│ └── spinner.vim # Loading spinner
├── plugin/
│ └── tmc.vim # Plugin entry point, commands
├── doc/
│ └── tmc.txt # Help documentation
├── test/
│ ├── helpers.vim # Test utilities
│ ├── unit/ # Unit tests
│ └── integration/ # Integration tests
└── syntax/
└── tmcresult.vim # Syntax highlighting
- util.vim: Common utilities (error/info messages)
- project.vim: Finding exercise roots, parsing IDs, managing projects directory
- course.vim: Course listing and management
- exercise.vim: Exercise listing and ID extraction
- core.vim: Backward compatibility shims (delegates to new modules)
- Check the existing issues
- Try to reproduce with minimal configuration
- Check the
:TmcStatusand:TmcProjectsDiroutputs
Use the bug report template and include:
- Vim/Neovim version (
:version) - Operating system
- Plugin version/commit
- Steps to reproduce
- Expected vs actual behavior
- Relevant logs or error messages
We welcome feature requests! Please:
- Check existing issues first
- Clearly describe the feature and its use case
- Explain why it would be useful to most users
- Consider if it can be implemented as a separate plugin
- Open a discussion
- Check the documentation
- Read the README
By contributing, you agree that your contributions will be licensed under the GPLv3 License.
- Be respectful and considerate
- Welcome newcomers and help them learn
- Focus on constructive feedback
- Assume good faith
Thank you for contributing to TMC.vim! 🎉