Navigation
Cmd/Ctrl + P - Quick file open
Cmd/Ctrl + Shift + P - Command palette
Cmd/Ctrl + G - Go to line
Code Manipulation
Alt + Up/Down - Move line up/down
Shift + Alt + Up/Down - Duplicate line
Cmd/Ctrl + / - Toggle comment
Search & Replace
Cmd/Ctrl + F - Find in file
Cmd/Ctrl + Shift + F - Find in project
Cmd/Ctrl + H - Replace
🛠️ Essential VS Code Extensions
Must-Have Extensions
- GitLens - Supercharge Git capabilities
- Prettier - Code formatter
- ESLint - JavaScript linting
- Live Server - Local development server
- Bracket Pair Colorizer - Visual bracket matching
- Auto Rename Tag - Automatically rename paired HTML tags
- Path Intellisense - Autocomplete filenames
- Thunder Client - API testing (Postman alternative)
Language-Specific Extensions
# Install via command line
code --install-extension ms-python.python
code --install-extension bradlc.vscode-tailwindcss
code --install-extension formulahendry.auto-rename-tag
code --install-extension ms-vscode.vscode-typescript-next
🔍 Advanced Search Techniques
VS Code Search Features
# Search with regex
/function\s+\w+\(/
# Search in specific file types
*.js, *.ts, *.jsx
# Exclude files/folders
!node_modules, !dist, !*.min.js
# Case sensitive search
Use "Match Case" button or Aa icon
# Whole word search
Use "Match Whole Word" button or Ab icon
Terminal Search Commands
# Find files by name
find . -name "*.js" -type f
# Search content in files (grep)
grep -r "function" --include="*.js" .
# Search with line numbers
grep -rn "TODO" --include="*.js" .
# Search and exclude directories
grep -r "API_KEY" --exclude-dir=node_modules .
# Use ripgrep (rg) for faster searches
rg "function" --type js
🚀 Command Line Productivity
Essential Aliases
# Add to your .bashrc or .zshrc
alias ll='ls -la'
alias la='ls -la'
alias ..='cd ..'
alias ...='cd ../..'
alias gs='git status'
alias ga='git add'
alias gc='git commit'
alias gp='git push'
alias gl='git log --oneline'
alias gd='git diff'
alias gco='git checkout'
alias gb='git branch'
# Development shortcuts
alias nrs='npm run start'
alias nrd='npm run dev'
alias nrb='npm run build'
alias nrt='npm run test'
# Quick navigation
alias projects='cd ~/Documents/projects'
alias downloads='cd ~/Downloads'
Useful Functions
# Create and navigate to directory
mkcd() {
mkdir -p "$1" && cd "$1"
}
# Extract various archive formats
extract() {
if [ -f $1 ]; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# Find and kill process by name
killprocess() {
ps aux | grep $1 | grep -v grep | awk '{print $2}' | xargs kill -9
}
🔧 Git Productivity Tips
Powerful Git Aliases
# Add to ~/.gitconfig
[alias]
# Status and logs
st = status -s
lg = log --oneline --graph --decorate --all
last = log -1 HEAD --stat
# Commits
cm = commit -m
ca = commit -am
amend = commit --amend --no-edit
# Branches
co = checkout
cob = checkout -b
br = branch
brd = branch -d
# Diff and show
df = diff
dc = diff --cached
dt = difftool
# Stash
sl = stash list
sa = stash apply
ss = stash save
# Reset
unstage = reset HEAD --
undo = reset --soft HEAD~1
# Remote
pu = push -u origin HEAD
pf = push --force-with-lease
Git Workflow Shortcuts
# Quick commit with automatic message
git add . && git commit -m "$(date): Quick save"
# Interactive rebase for last 3 commits
git rebase -i HEAD~3
# Stash with descriptive message
git stash push -m "Work in progress on feature X"
# Create and switch to new branch from current
git checkout -b feature/new-feature
# Pull with rebase to maintain clean history
git pull --rebase origin main
# Show commits not yet pushed
git log origin/main..HEAD
# Clean up merged branches
git branch --merged | grep -v "\*\|main\|master" | xargs -n 1 git branch -d
📦 Package Management Tricks
NPM/Yarn Shortcuts
# NPM shortcuts
npm i # npm install
npm i -D # npm install --save-dev
npm i -g # npm install --global
npm un # npm uninstall
npm ls # npm list
npm outdated # Check for outdated packages
npm audit fix # Fix security vulnerabilities
# Check package info
npm info package-name
npm view package-name versions --json
# Run scripts with npm-run-all
npm i -g npm-run-all
npm-run-all build test # Run in sequence
npm-run-all --parallel dev:* # Run in parallel
# Yarn shortcuts
yarn add package-name
yarn add -D package-name # Dev dependency
yarn remove package-name
yarn upgrade # Update all packages
yarn why package-name # Explain why package is installed
Package.json Scripts
{
"scripts": {
"dev": "concurrently \"npm run dev:server\" \"npm run dev:client\"",
"dev:server": "nodemon server/index.js",
"dev:client": "react-scripts start",
"build": "npm run build:client && npm run build:server",
"build:client": "react-scripts build",
"build:server": "babel server -d dist",
"test": "npm run test:client && npm run test:server",
"test:client": "react-scripts test --watchAll=false",
"test:server": "jest server/",
"lint": "eslint src/ server/",
"lint:fix": "eslint src/ server/ --fix",
"clean": "rm -rf build dist node_modules && npm install",
"deploy": "npm run build && npm run deploy:staging",
"deploy:staging": "rsync -avz build/ user@staging-server:/var/www/app/",
"backup": "pg_dump production_db > backup_$(date +%Y%m%d).sql"
}
}
🐛 Debugging Efficiency
Console.log Alternatives
// Better debugging output
console.table(arrayOfObjects);
console.group('API Calls');
console.log('Fetching user data...');
console.log('Response:', data);
console.groupEnd();
// Conditional logging
console.assert(user.age > 0, 'User age should be positive');
// Timing operations
console.time('API Call');
await fetchData();
console.timeEnd('API Call');
// Stack trace
console.trace('Trace point');
// Custom styling
console.log('%c Success! ', 'background: green; color: white; padding: 2px 5px; border-radius: 2px');
console.log('%c Error! ', 'background: red; color: white; padding: 2px 5px; border-radius: 2px');
Advanced Debugging Techniques
// Debugger statements for breakpoints
function complexFunction(data) {
debugger; // Browser will pause here
const processed = data.map(item => {
if (item.suspicious) {
debugger; // Conditional breakpoint
}
return processItem(item);
});
return processed;
}
// Performance monitoring
const start = performance.now();
// ... your code ...
const end = performance.now();
console.log(`Execution time: ${end - start}ms`);
// Memory usage monitoring
console.log('Memory usage:', performance.memory);
// Debug utility function
const debug = (label, data) => {
if (process.env.NODE_ENV === 'development') {
console.group(`🐛 ${label}`);
console.log('Data:', data);
console.log('Type:', typeof data);
console.log('Timestamp:', new Date().toISOString());
console.groupEnd();
}
};
⚙️ Environment Setup Tips
Dotfiles Management
# Create a dotfiles repository
mkdir ~/dotfiles
cd ~/dotfiles
# Move existing dotfiles
mv ~/.bashrc ~/dotfiles/bashrc
mv ~/.gitconfig ~/dotfiles/gitconfig
mv ~/.vscode/settings.json ~/dotfiles/vscode-settings.json
# Create symlinks
ln -sf ~/dotfiles/bashrc ~/.bashrc
ln -sf ~/dotfiles/gitconfig ~/.gitconfig
ln -sf ~/dotfiles/vscode-settings.json ~/.vscode/settings.json
# Setup script for new machines
#!/bin/bash
# setup.sh
git clone https://github.com/yourusername/dotfiles.git ~/dotfiles
cd ~/dotfiles
chmod +x setup.sh
# Create symlinks
for file in bashrc gitconfig vimrc; do
ln -sf ~/dotfiles/$file ~/.$file
done
echo "Dotfiles setup complete!"
Development Environment Variables
# .env file for development
NODE_ENV=development
API_URL=http://localhost:3001
DATABASE_URL=postgresql://localhost:5432/myapp_dev
REDIS_URL=redis://localhost:6379
LOG_LEVEL=debug
# Environment-specific scripts
# package.json
{
"scripts": {
"dev": "NODE_ENV=development nodemon app.js",
"prod": "NODE_ENV=production node app.js",
"test": "NODE_ENV=test jest",
"start:local": "env-cmd -f .env.local npm run dev",
"start:staging": "env-cmd -f .env.staging npm run dev"
}
}
🔄 Automation Scripts
Project Setup Automation
#!/bin/bash
# create-project.sh
PROJECT_NAME=$1
if [ -z "$PROJECT_NAME" ]; then
echo "Usage: ./create-project.sh project-name"
exit 1
fi
echo "Creating project: $PROJECT_NAME"
# Create project directory
mkdir $PROJECT_NAME
cd $PROJECT_NAME
# Initialize git
git init
echo "node_modules/
.env
.DS_Store
dist/
build/" > .gitignore
# Create basic structure
mkdir src tests docs
touch src/index.js tests/index.test.js README.md
# Initialize npm
npm init -y
# Install common dependencies
npm install --save-dev prettier eslint jest nodemon
# Create basic scripts
cat > package.json << EOF
{
"name": "$PROJECT_NAME",
"version": "1.0.0",
"scripts": {
"start": "node src/index.js",
"dev": "nodemon src/index.js",
"test": "jest",
"lint": "eslint src/",
"format": "prettier --write src/"
}
}
EOF
echo "Project $PROJECT_NAME created successfully!"
echo "Next steps:"
echo " cd $PROJECT_NAME"
echo " npm run dev"
Daily Development Tasks
#!/bin/bash
# daily-tasks.sh - Run at start of workday
echo "🚀 Starting daily development tasks..."
# Update all git repositories
find ~/projects -name ".git" -type d -exec sh -c 'cd "{}" && cd .. && pwd && git pull' \;
# Clean up Docker
docker system prune -f
# Update global npm packages
npm update -g
# Check system resources
echo "💾 Disk usage:"
df -h | head -5
echo "🧠 Memory usage:"
free -h
echo "🔄 Running processes:"
ps aux | head -10
# Start common services
echo "🐳 Starting Docker services..."
docker-compose -f ~/docker-compose.yml up -d
echo "✅ Daily tasks completed!"
📱 Browser Developer Tools
Chrome DevTools Shortcuts
Inspector
F12 - Open DevTools
Cmd/Ctrl + Shift + C - Inspect element
Cmd/Ctrl + Shift + I - Toggle DevTools
Console
Cmd/Ctrl + Shift + J - Open Console
Ctrl + L - Clear console
Shift + Enter - Multi-line input
Network
Cmd/Ctrl + E - Clear network log
Cmd/Ctrl + R - Reload page
Cmd/Ctrl + Shift + R - Hard reload
Sources
Cmd/Ctrl + O - Open file
Cmd/Ctrl + Shift + O - Go to symbol
F8 - Resume execution
Console Utilities
// DevTools console utilities
$0 // Last selected element
$1 // Previously selected element
$_ // Result of last expression
// Query selectors
$('selector') // document.querySelector
$$('selector') // document.querySelectorAll
// Inspect element
inspect(element)
// Copy to clipboard
copy(object)
// Monitor function calls
monitor(functionName)
unmonitor(functionName)
// Performance monitoring
console.profile('My Profile')
// ... code to profile ...
console.profileEnd('My Profile')
🎯 Conclusion
These productivity tips and tricks can significantly improve your development workflow. The key is to gradually incorporate them into your daily routine rather than trying to learn everything at once.
Start with the shortcuts and tools that address your current pain points, then expand from there. Remember: the goal is to spend more time solving problems and less time fighting with your tools.