A comprehensive Vim setup optimized for back-end development, featuring modern plugins, efficient workflows, and a well-organized development environment with special focus on PHP development.
- Code Completion: YouCompleteMe for intelligent autocompletion
- Syntax Checking: Syntastic and ALE for real-time error detection
- File Navigation: NERDTree with Git integration
- Fuzzy Finding: FZF for lightning-fast file and content search
- Git Integration: GitGutter for real-time diff visualization
- PHPactor: Advanced PHP language server with intelligent code completion
- PHP Code Sniffer: PSR-12 and custom coding standards enforcement
- PHPStan: Static analysis for error detection and code quality
- PHP CS Fixer: Automatic code formatting and style fixing
- Custom Configuration: Pre-configured PHPactor settings for optimal workflow
- PHP: Full PHP development with PHPactor, PHPStan, and code quality tools
- Go: Complete Go development environment with vim-go
- Rust: Rust language support with rust.vim
- TypeScript: TypeScript/JavaScript support with yats.vim
- General: EditorConfig for consistent coding standards
- Status Bar: Airline with themes for enhanced status information
- Debugging: Vdebug for remote debugging capabilities
- Tag Navigation: Tagbar for code structure overview
- Auto-tagging: Automatic tag generation for various languages
- GitHub Copilot: AI-powered code suggestions
- Tmux Configuration: Seamless tmux integration with vim-like navigation
- Custom Scripts: Utility scripts for enhanced workflow
- Bash Integration: Optimized shell configuration
- Vim 8.0+ or Neovim
- vim-plug plugin manager
- Git
- Composer (for PHP tools)
- PHP 7.4+ (for PHP development)
-
Clone the repository:
git clone https://github.com/yourusername/vimrc.git ~/.vimrc-repo
-
Install the configuration:
# Backup existing config (optional) mv ~/.vimrc ~/.vimrc.backup # Install new configuration ln -s ~/.vimrc-repo/.vimrc ~/.vimrc ln -s ~/.vimrc-repo/.tmux.conf ~/.tmux.conf # Source the bashrc instead of replacing it echo "source ~/.vimrc-repo/.bashrc" >> ~/.bashrc
-
Install plugins:
:PlugInstall
-
Install custom scripts:
cp ~/.vimrc-repo/bin/* ~/bin/ chmod +x ~/bin/*
-
Install PHP tools via Composer:
# Create composer_stuff directory mkdir -p ~/bin/composer_stuff cd ~/bin/composer_stuff # Install PHP development tools composer require --dev \ squizlabs/php_codesniffer \ phpstan/phpstan \ friendsofphp/php-cs-fixer
-
Create symlinks for easy access:
# Create symlinks to ~/bin for all PHP tools for binary in $(find ~/bin/composer_stuff/vendor/bin -type f -printf "%f\n"); do ln -s ~/bin/composer_stuff/vendor/bin/${binary} ~/bin/${binary} done
-
Install PHPactor configuration:
# Create PHPactor config directory mkdir -p ~/.config/phpactor # Copy configuration (update paths in phpactor.json for your system) cp ~/.vimrc-repo/.config/phpactor/phpactor.json ~/.config/phpactor/
-
Set up PHPStan configuration:
# Choose one of the PHPStan configuration options below
π PHPStan Configuration Options:
Option A: Use base configuration with inheritance (recommended)
# Copy base config to your project cp ~/.vimrc-repo/config_templates/phpstan-base.neon ~/your-project/ # Create your project config that inherits from base cat > ~/your-project/phpstan.neon << 'EOF' includes: - phpstan-base.neon parameters: level: 6 paths: - src - tests EOF
Option B: Use framework-specific configuration
# For Laravel projects cp ~/.vimrc-repo/config_templates/phpstan-laravel.neon ~/your-project/phpstan.neon
Option C: Create a minimal configuration from scratch
# Create a simple phpstan.neon file cat > ~/your-project/phpstan.neon << 'EOF' parameters: level: 6 paths: - src - tests excludePaths: - vendor/* EOF
File | Purpose |
---|---|
.vimrc |
Main Vim configuration with plugins and settings |
.tmux.conf |
Tmux configuration with vim-like navigation |
.bashrc |
Bash configuration with development aliases |
.editorconfig |
Consistent coding standards across editors |
.config/phpactor/phpactor.json |
PHPactor language server configuration |
config_templates/ |
Template configurations for various tools |
| config_templates/phpstan-base.neon
| Base PHPStan configuration for inheritance |
| config_templates/phpstan-laravel.neon
| Laravel-specific PHPStan configuration |
| bin/
| Custom utility scripts |
<Ctrl-a>
: Tmux prefix (instead of<Ctrl-b>
)<Alt+hjkl>
: Navigate between tmux panes<Ctrl-p>
: FZF file finder<Ctrl-g>
: FZF grep search
<F8>
: Toggle tagbar<Ctrl-n>
: Toggle NERDTree<Leader>gd
: Go to definition (YouCompleteMe)<Leader>gr
: Go to references (YouCompleteMe)
<Leader>u
: Transform class<Leader>m
: Generate method<Leader>n
: Navigate to class<Leader>i
: Import class<Leader>c
: Complete constructor
This configuration is designed to be a solid foundation. You can easily customize it by:
- Adding plugins: Edit the
call plug#begin()
section in.vimrc
- Modifying keybindings: Update the mapping sections
- Adjusting settings: Modify the
set
commands to match your preferences - PHPactor configuration: Edit
~/.config/phpactor/phpactor.json
for PHP-specific settings - PHPStan configuration: Choose from multiple configuration options (see PHPStan Configuration Options above)
vimrc/
βββ .vimrc # Main Vim configuration
βββ .tmux.conf # Tmux configuration
βββ .bashrc # Bash configuration
βββ .editorconfig # Editor standards
βββ .config/
β βββ phpactor/
β βββ phpactor.json # PHPactor language server config
βββ config_templates/
β βββ phpstan-base.neon # Base configuration for inheritance
β βββ phpstan-laravel.neon # Laravel-specific configuration
βββ bin/ # Custom utility scripts
β βββ brave # Brave browser launcher
β βββ kcalc # Calculator shortcut
β βββ mate-screenshot # Screenshot tool
β βββ tmux-vim # Vim + tmux wrapper
βββ README.md # This file
This setup provides a complete PHP development environment:
- PHPStan: Static analysis with configurable levels (1-9)
- PHP Code Sniffer: PSR-12 and custom coding standards
- PHP CS Fixer: Automatic code formatting and style fixing
- Intelligent Completion: Context-aware code suggestions
- Go to Definition: Navigate to class/method definitions
- Refactoring: Transform classes, generate methods, import classes
- Error Detection: Real-time syntax and logic error highlighting
- PHPactor: Configured for optimal PHP development workflow
- PHPStan: Multiple configuration options with inheritance support
- Tools Integration: All PHP tools accessible via
~/bin/
symlinks
This setup provides a flexible PHPStan configuration system:
π How Inheritance Works:
- Base Configuration (
phpstan-base.neon
): Common settings for all PHP projects - Framework Configs (
phpstan-laravel.neon
): Framework-specific settings that inherit from base - Project Configs: Your actual
phpstan.neon
can inherit from either base or framework configs
π Configuration Behavior:
- Simple values (level, memoryLimit): Later values override earlier ones
- Arrays (ignoreErrors, excludePaths): Values are merged, not replaced
- Nested objects: Deep merge combines all properties
π― Usage Examples:
# Simple project using base config
includes:
- phpstan-base.neon
parameters:
level: 6
paths: [src, tests]
# Laravel project using framework config
includes:
- phpstan-laravel.neon
parameters:
level: 7 # Override Laravel's default level
This project is licensed under the MIT License - see the LICENSE file for details.
- vim-plug for plugin management
- PHPactor for advanced PHP language server
- All the amazing Vim plugin authors
- The Vim community for inspiration and support
Note: This configuration is optimized for back-end development workflows with special emphasis on PHP development. While it works well for other use cases, it's specifically tailored for server-side development, database work, and API development.