Skip to content

fernanluyano/dev-environment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dev Environment

A curated development environment setup for macOS, featuring modern terminal tools, tmux, and Neovim.

⚠️ Disclaimer: This is a personal development setup. You're welcome to use, clone, or fork it, but please review all configurations before applying them to your system. These are tailored to specific workflows and may change at any time.

📋 Table of Contents

Prerequisites

  • macOS (most configurations work on Linux but are not actively tested)
  • Basic terminal knowledge
  • Administrator access for Homebrew installation

🛠 Core Tools

Package Manager & Terminal

Homebrew - The missing package manager for macOS

iTerm2 - Enhanced terminal emulator

brew install --cask iterm2

💡 Close your current terminal and use iTerm2 from now on.

Oh My Zsh - Zsh configuration framework

Essential Utilities

wget - Network downloader

brew install wget

fzf - Fuzzy finder for command-line

brew install fzf

ripgrep - Fast recursive search tool

brew install ripgrep

Git - Version control

brew install git

GitHub CLI - GitHub from the terminal

brew install gh
gh auth login  # Follow the prompts to authenticate

Development Tools

SDKMan - SDK version manager (Java, Scala, etc.)

brew install sdkman-cli

Add this to your zshrc_private file if you installed SDKMan

export SDKMAN_DIR=$(brew --prefix sdkman-cli)/libexec
[[ -s "${SDKMAN_DIR}/bin/sdkman-init.sh" ]] && source "${SDKMAN_DIR}/bin/sdkman-init.sh"

Example SDK installations:

# Java
sdk install java 17.0.17-zulu

# Scala
sdk install scala 2.12.20
sdk install scalacli

Terminal Enhancement (Optional)

These tools enhance the visual appearance of your terminal but are not required for functionality.

Nerd Fonts - Fonts with icons and glyphs

brew install --cask font-jetbrains-mono-nerd-font
# Or browse all fonts:
brew search nerd-font

⚙️ Configure iTerm2 to use the Nerd Font:
iTerm2 → Settings → Profiles → Text → Font → JetBrains Mono Nerd Font

Oh My Posh - Prompt theme engine

brew install oh-my-posh

Zoxide - Smarter cd command

brew install zoxide

Productivity Tools (Optional)

Tmux - Terminal multiplexer

brew install tmux

Neovim - Modern Vim-based text editor

brew install neovim

⚠️ Important Neovim Setup:

After installing Neovim and creating the symlink to the config:

  1. Open Neovim for the first time: nvim
  2. Let it install all plugins and dependencies (this may take a few minutes)
  3. You may see errors on first launch - this is normal
  4. Close and reopen Neovim once installation completes

Configuration is highly personal: The included Neovim config contains plugins and settings for multiple programming languages and tools. It's not guaranteed everything will work out of the box since Neovim configurations are very personal and environment-dependent.

Recommended: Review the plugin files in nvim/ and remove any language-specific plugins you don't need. The config includes setups for various languages - figure out on your own what doesn't work or what you don't need, and remove those plugin files accordingly.

JetBrains IDEs (Optional - for GUI IDE experience)

If you prefer a full-featured IDE over terminal-based editors, JetBrains products offer Vim emulation.

Install a JetBrains IDE:

IdeaVim Plugin - Vim emulation inside JetBrains IDEs

  1. Open your JetBrains IDE (e.g., IntelliJ IDEA)
  2. Go to Settings/Preferences → Plugins
  3. Search for "IdeaVim" and click Install
  4. Restart the IDE

Which-Key Plugin - Display available keybindings

  1. In Settings/Preferences → Plugins
  2. Search for "Which-Key" and click Install
  3. Restart the IDE

Configure IdeaVim: You have two options to configure IdeaVim:

  1. Symlink (Recommended): Create a symlink to keep the config in sync with the repository

    ln -s ~/dev-environment/ideavimrc ~/.ideavimrc
  2. Copy: Manually copy the .ideavimrc configuration from this repository into the ideavim file generated by IntelliJ

💡 Note: Using a symlink allows your IdeaVim config to stay updated when you pull changes from the repository.

AI Coding Assistant

Claude Code - Anthropic's AI coding assistant for the terminal

brew install claude-code

Yazi - Blazing fast terminal file manager

brew install yazi

Symlink the config files:

# Create config directory if it doesn't exist
mkdir -p ~/.config/yazi

# Create symlinks for each config file
ln -s ~/dev-environment/yazi/yazi.toml ~/.config/yazi/yazi.toml
ln -s ~/dev-environment/yazi/keymap.toml ~/.config/yazi/keymap.toml
ln -s ~/dev-environment/yazi/theme.toml ~/.config/yazi/theme.toml
ln -s ~/dev-environment/yazi/flavors ~/.config/yazi/flavors

💡 Note: Using symlinks keeps your Yazi config in sync when you pull changes from the repository.

📦 Installation

1. Clone the Repository

git clone git@github.com:fernanluyano/dev-environment.git ~/dev-environment

💡 Tip: If you want to customize this for your own use, consider forking the repository first or clone and remove the .git directory.

2. Backup Existing Configurations

Always backup your current configurations before proceeding:

# Create backup directory
mkdir -p ~/.config_backup

# Backup existing files
[ -f ~/.zshrc ] && cp ~/.zshrc ~/.config_backup/zshrc.backup
[ -f ~/.tmux.conf ] && cp ~/.tmux.conf ~/.config_backup/tmux.conf.backup
[ -d ~/.config/nvim ] && cp -r ~/.config/nvim ~/.config_backup/nvim.backup

3. Create Symlinks

# Remove existing files (they're backed up!)
rm -f ~/.zshrc
rm -f ~/.tmux.conf
rm -rf ~/.config/nvim

# Create symlinks
ln -s ~/dev-environment/.zshrc ~/.zshrc
ln -s ~/dev-environment/.tmux.conf ~/.tmux.conf
ln -s ~/dev-environment/nvim ~/.config/nvim

4. Apply Configurations

# Reload zsh
source ~/.zshrc

# Reload tmux (if already running)
tmux source ~/.tmux.conf

⚙️ Configuration

Repository Structure

dev-environment/
├── .zshrc           # Zsh configuration
├── .tmux.conf       # Tmux configuration
├── nvim/            # Neovim configuration
├── ideavimrc       # IdeaVim configuration (symlink or copy)
└── README.md        # This file

Defensive Loading

The .zshrc configuration is designed to be defensive and won't fail if tools are missing. Instead, it will:

  • Display warnings for missing optional tools
  • Fall back to sensible defaults (e.g., vim if nvim is not installed)
  • Continue loading even if some tools aren't available

This allows you to install tools gradually without breaking your shell.

Customization

Each configuration file can be customized to your preferences:

  • .zshrc - Shell aliases, functions, and environment variables
  • .tmux.conf - Tmux keybindings and appearance
  • nvim/ - Neovim plugins and settings
  • .ideavimrc - Vim keybindings for JetBrains IDEs

🔒 Private Configuration

The .zshrc automatically sources ~/.zshrc_private for sensitive or machine-specific settings that shouldn't be version controlled.

Setup Private Config

touch ~/.zshrc_private
chmod 600 ~/.zshrc_private  # Restrict permissions

What to Put in Private Config

  • API keys and authentication tokens
  • Work or company-specific configurations
  • Personal aliases and shortcuts
  • Machine-specific settings
  • Private environment variables

Example ~/.zshrc_private

 # Add custom/private configs

clear
 BANNER=$(cat << "EOF"
    ███████╗██╗   ██╗███████╗████████╗███████╗███╗   ███╗
    ██╔════╝╚██╗ ██╔╝██╔════╝╚══██╔══╝██╔════╝████╗ ████║
    ███████╗ ╚████╔╝ ███████╗   ██║   █████╗  ██╔████╔██║
    ╚════██║  ╚██╔╝  ╚════██║   ██║   ██╔══╝  ██║╚██╔╝██║
    ███████║   ██║   ███████║   ██║   ███████╗██║ ╚═╝ ██║
    ╚══════╝   ╚═╝   ╚══════╝   ╚═╝   ╚══════╝╚═╝     ╚═╝
EOF
)
echo "\033[1;32m"
echo "$BANNER"
echo "\033[0;32m"
echo "    ════════════════════════════════════════════════════"
echo "\033[1;32m              ░▒▓ READY TO CODE ▓▒░\033[0m"
echo ""

# Cache configuration
CACHE_FILE="$HOME/.zsh_versions_cache"
CACHE_DURATION=3600  # 1 hour in seconds

# Function to get file modification time
get_file_age() {
    if [ -f "$1" ]; then
        if [[ "$OSTYPE" == "darwin"* ]]; then
            # macOS
            echo $(($(date +%s) - $(stat -f %m "$1")))
        else
            # Linux
            echo $(($(date +%s) - $(stat -c %Y "$1")))
        fi
    else
        # DNE, return a large number
        echo 999999
    fi
}

# Function to generate and cache versions
generate_versions() {
    JAVA_VER=$(java -version 2>&1 | head -n 1 | awk -F '"' '{print $2}')
    if [ -z "$JAVA_VER" ]; then JAVA_VER="NONE"; fi

    SCALA_VER=$(scala -version 2>&1 | grep 'Scala version' | awk '{print $4}')
    if [ -z "$SCALA_VER" ]; then SCALA_VER="NONE"; fi

    SCALA_CLI_VER=$(scala-cli -version 2>/dev/null | grep 'Scala CLI version' | awk '{print $4}')
    if [ -z "$SCALA_CLI_VER" ]; then SCALA_CLI_VER="NONE"; fi

    AMMONITE_VER=$(amm -v 2>/dev/null | awk -F', ' '{print $2}')
    if [ -z "$AMMONITE_VER" ]; then AMMONITE_VER="NONE"; fi

    GO_VER=$(go version 2>/dev/null | awk '{print $3}' | sed 's/go//')
    if [ -z "$GO_VER" ]; then GO_VER="NONE"; fi

    PYTHON_VER=$(python3 --version 2>/dev/null | awk '{print $2}')
    if [ -z "$PYTHON_VER" ]; then PYTHON_VER="NONE"; fi

    RUST_VER=$(rustc --version 2>/dev/null | awk '{print $2}')
    if [ -z "$RUST_VER" ]; then RUST_VER="NONE"; fi

    MAVEN_VER=$(mvn --version 2>/dev/null | head -n 1 | awk '{print $3}')
    if [ -z "$MAVEN_VER" ]; then MAVEN_VER="NONE"; fi

    GRADLE_VER=$(gradle --version 2>/dev/null | grep 'Gradle' | awk '{print $2}')
    if [ -z "$GRADLE_VER" ]; then GRADLE_VER="NONE"; fi

    SBT_VER=$(sbt --version 2>&1 | grep 'sbt script version' | awk '{print $4}')
    if [ -z "$SBT_VER" ]; then SBT_VER="NONE"; fi

    SDK_VER=$(sdk version 2>/dev/null | grep 'script:' | awk '{print $2}')
    if [ -z "$SDK_VER" ]; then SDK_VER="NONE"; fi

    DATABRICKS_VER=$(databricks --version 2>/dev/null | awk '{print $3}')
    if [ -z "$DATABRICKS_VER" ]; then DATABRICKS_VER="NONE"; fi

    # Save to cache file
    cat > "$CACHE_FILE" <<EOF
JAVA_VER="$JAVA_VER"
SCALA_VER="$SCALA_VER"
SCALA_CLI_VER="$SCALA_CLI_VER"
AMMONITE_VER="$AMMONITE_VER"
GO_VER="$GO_VER"
PYTHON_VER="$PYTHON_VER"
RUST_VER="$RUST_VER"
MAVEN_VER="$MAVEN_VER"
GRADLE_VER="$GRADLE_VER"
SBT_VER="$SBT_VER"
SDK_VER="$SDK_VER"
DATABRICKS_VER="$DATABRICKS_VER"
EOF
}

# Check cache and load versions
CACHE_AGE=$(get_file_age "$CACHE_FILE")

if [ $CACHE_AGE -lt $CACHE_DURATION ]; then
    # Cache is fresh, load from file
    source "$CACHE_FILE"
else
    # Cache is stale or doesn't exist, regenerate
    generate_versions
fi

# Display system info
echo "\033[0;32m    [SYSTEM ONLINE]"
echo "    > USER:             $(whoami)"
echo "    > TIME:             $(date '+%H:%M:%S')"
echo ""
echo "    [CORE LANGUAGES]"
echo "    > JAVA:             ${JAVA_VER}"
echo "    > SCALA:            ${SCALA_VER}"
echo "    > GO:               ${GO_VER}"
echo "    > PYTHON:           ${PYTHON_VER}"
echo "    > RUST:             ${RUST_VER}"
echo ""
echo "    [LANGUAGE TOOLING]"
echo "    > SCALA-CLI:        ${SCALA_CLI_VER}"
echo "    > AMMONITE:         ${AMMONITE_VER}"
echo "    > MAVEN:            ${MAVEN_VER}"
echo "    > GRADLE:           ${GRADLE_VER}"
echo "    > SBT:              ${SBT_VER}"
echo ""
echo "    [TOOLS]"
echo "    > SDKMAN:           ${SDK_VER}"
echo "    > DATABRICKS (CLI): ${DATABRICKS_VER}"
echo ""

# Optional: Add a command to manually refresh the cache
refresh_versions() {
    echo "Refreshing version cache..."
    generate_versions
    source "$CACHE_FILE"
    echo "Cache refreshed!"
}

export TMUX_LOCATION="Orlando, FL"

# Custom aliases

DEV_ENV="~/dev/github/dev-environment"

alias goto_dev_environment="cd $DEV_ENV"
alias edit_dev_environment="vim $DEV_ENV"
alias edit_zsh_private="vim ~/.zshrc_private"

export OHMYPOSH_THEME="$HOME/atomic.omp.json"

🚀 Usage

Updating

To update your environment with the latest changes:

cd ~/dev-environment
git pull
source ~/.zshrc

🔧 Troubleshooting

Fonts not displaying correctly

Problem: Icons or characters appear as boxes or question marks.

Solution:

  1. Ensure Nerd Font is installed: brew list --cask font-jetbrains-mono-nerd-font
  2. Configure iTerm2: Settings → Profiles → Text → Font → JetBrains Mono Nerd Font
  3. Restart iTerm2

Zsh configuration not loading

Problem: Custom aliases or functions aren't available.

Solution:

# Check if symlink is correct
ls -la ~/.zshrc

# Manually reload
source ~/.zshrc

# Check for syntax errors
zsh -n ~/.zshrc

Tmux prefix key not working

Problem: Tmux keybindings don't respond.

Solution:

# Reload tmux config
tmux source ~/.tmux.conf

# Check if tmux is using the config
tmux show-options -g

SDKMan command not found

Problem: sdk command doesn't work after installation.

Solution:

# Source the SDKMan init script
source "$HOME/.sdkman/bin/sdkman-init.sh"

# Add to .zshrc_private if not already present
echo 'source "$HOME/.sdkman/bin/sdkman-init.sh"' >> ~/.zshrc_private

🤝 Contributing

This is a personal configuration, but suggestions are welcome!

📝 License

MIT License - See LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors