Skip to content

ungalsoththu/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dotfiles for GitHub Codespaces

AI CLI-optimized dotfiles for productive development in GitHub Codespaces and local environments.

Quick Start

Automatic Installation (Recommended)

git clone https://github.com/UngalSoththu/dotfiles.git ~/dotfiles
cd ~/dotfiles
./install.sh

Installation with Make

git clone https://github.com/UngalSoththu/dotfiles.git ~/dotfiles
cd ~/dotfiles
make install

Reload your shell:

source ~/.bashrc   # or source ~/.zshrc

Features

AI CLI Optimizations

  • Pre-configured aliases for Claude Code and other AI CLIs
  • AI-assisted git commits with gai alias
  • Command explanation with ai_explain
  • Environment variables for AI tool caching

Shell Configurations

  • Bash - Enhanced with aliases, functions, and custom prompt
  • Zsh - Compatible with Oh My Zsh, includes completion system
  • Smart git integration (branch in prompt)
  • History improvements (larger history, ignore duplicates)
  • Codespaces detection

Development Tools

  • Git - Optimized config for Codespaces, useful aliases
  • Vim - Sensible defaults, vim-plug for plugins
  • Tmux - Productive terminal workflows

Directory Structure

dotfiles/
├── .gitignore                          # Exclude symlinks, backups, caches
├── README.md                           # This file
├── install.sh                          # Automated installation script
├── Makefile                            # Alternative make-based installation
├── shell/
│   ├── .bashrc                         # Main bash configuration
│   ├── .bash_profile                   # Bash login shell config
│   ├── .zshrc                          # Main zsh configuration
│   └── .profile                        # Generic shell profile
├── editors/
│   └── .vimrc                          # Vim configuration
├── terminal/
│   └── .tmux.conf                      # Tmux configuration
├── git/
│   ├── .gitconfig                      # Main git configuration
│   └── .gitconfig_codespaces           # Codespaces-specific overrides
├── config/
│   ├── bash/
│   │   ├── aliases.sh                  # Bash aliases (AI CLI + general)
│   │   ├── chelper.sh                  # GLM/Zhipu AI integration
│   │   ├── functions.sh                # Helper functions
│   │   ├── prompt.sh                   # Custom prompt configuration
│   │   └── paths.sh                    # PATH modifications
│   ├── zsh/
│   │   ├── aliases.zsh                 # Zsh-specific aliases
│   │   ├── chelper.zsh                 # GLM/Zhipu AI integration (zsh)
│   │   └── plugins.zsh                 # Zsh plugin configurations
│   └── git/
│       └── ignore                      # Global .gitignore templates
└── bin/
    ├── ai-cli-helper.sh                # AI CLI utility functions
    ├── chelper-setup.sh                # GLM/Zhipu AI setup script
    └── codespaces-setup.sh             # Codespaces-specific setup

Manual Setup

1. Clone Repository

git clone https://github.com/UngalSoththu/dotfiles.git ~/dotfiles
export DOTFILES_ROOT=~/dotfiles

2. Shell Configuration

Bash:

ln -s ~/dotfiles/shell/.bashrc ~/.bashrc
ln -s ~/dotfiles/shell/.bash_profile ~/.bash_profile
ln -s ~/dotfiles/shell/.profile ~/.profile
source ~/.bashrc

Zsh:

ln -s ~/dotfiles/shell/.zshrc ~/.zshrc
source ~/.zshrc

3. Git Configuration

ln -s ~/dotfiles/git/.gitconfig ~/.gitconfig
ln -s ~/dotfiles/git/.gitconfig_codespaces ~/.gitconfig_codespaces
ln -s ~/dotfiles/config/git/ignore ~/.gitignore_global

4. Vim Configuration

ln -s ~/dotfiles/editors/.vimrc ~/.vimrc

# Install vim-plug
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
  https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

# Install plugins in vim
vim +PlugInstall +qall

5. Tmux Configuration (Optional)

# Install tmux first (if not installed)
sudo apt-get install tmux   # Linux
brew install tmux           # macOS

# Link config
ln -s ~/dotfiles/terminal/.tmux.conf ~/.tmux.conf

AI CLI Usage

Claude Code Aliases

cc          # Launch Claude Code
cca "ask"   # Ask Claude a question
ccr         # Review current code
cce         # Explain current code
ccp         # Generate implementation plan
cch         # Show Claude Code help

AI Helper Functions

ai_explain cmd...    # Explain a shell command
gai                 # AI-assisted git commit
ai_detect           # Detect available AI CLI tools
ai_best             # Show the best available AI tool

Examples

# Explain a command
ai_explain "find . -name '*.js' | xargs grep 'TODO'"

# AI-assisted commit
git add .
gai

# Ask Claude a question
cca "How do I create a REST API in Python?"

# Review current file
ccr

GLM/Zhipu AI Integration

This dotfiles repository includes integration with Zhipu AI GLM models through the @z_ai/coding-helper package. This allows you to use GLM models as an alternative backend for Claude Code.

Installation

Install with the dotfiles installer:

cd ~/dotfiles
./install.sh --with-chelper

Or manually:

# Install the package
npm install -g @z_ai/coding-helper

# Or use the setup script
~/dotfiles/bin/chelper-setup.sh

Authentication

Get your API key from https://open.bigmodel.cn/

# Set your API key
export Z_AI_API_KEY='your-api-key-here'

# Authenticate with GLM
chelper auth glm_coding_plan_global $Z_AI_API_KEY

# Reload Claude to use GLM backend
chelper auth reload claude

Chelper Commands

glm_init          # Initialize GLM authentication
glm_status        # Show current GLM status
glm_use           # Switch to GLM backend
claude_use        # Switch back to Claude backend
glm-auth          # Quick auth command
glm-reload        # Reload Claude configuration

Quick Setup

# One-time setup
npm install -g @z_ai/coding-helper
export Z_AI_API_KEY='your-api-key-here'
glm_init

# Now use Claude Code with GLM backend
cc

Environment Variables

  • Z_AI_API_KEY - Your Zhipu AI API key
  • CHELPER_CONFIG_DIR - Chelper config directory (default: ~/.chelper)

Git Aliases

gst     # git status
ga      # git add
gaa     # git add -A
gd      # git diff
gds     # git diff --staged
gco     # git checkout
gcb     # git checkout -b
gcm     # git commit -m
gp      # git push
gl      # git log --oneline --graph --decorate

Shell Features

Custom Prompt

  • Git branch and status display
  • Codespaces indicator [CS]
  • Color-coded user/host/path
  • Python virtualenv display

Useful Functions

mkcd <dir>      # Create directory and enter it
extract <file>  # Extract any archive
backup <file>   # Backup a file
ff <name>       # Find files by name
fd <name>       # Find directories by name
psgrep <name>   # Search processes

Vim Configuration

The vim configuration includes:

  • Sensible defaults (line numbers, syntax highlighting)
  • vim-plug plugin manager
  • Pre-configured plugins (fugitive, airline, ale, etc.)
  • Leader key set to ,

Key Mappings

<leader>w    # Save
<leader>q    # Quit
<leader>ev   # Edit .vimrc
<leader>sv   # Reload .vimrc
<leader>n    # Toggle relative line numbers
Ctrl-p       # Fuzzy file search

Tmux Configuration

The tmux configuration includes:

  • Prefix key: Ctrl-a (instead of default Ctrl-b)
  • Vim-like pane navigation (h, j, k, l)
  • Split panes with | (horizontal) and - (vertical)
  • Status bar with session info

Key Bindings

Ctrl-a |      # Split horizontally
Ctrl-a -      # Split vertically
Ctrl-a h/j/k/l # Navigate panes
Ctrl-a c      # New window
Ctrl-a n/p    # Next/previous window
Ctrl-a r      # Reload config

Customization

Adding Your Own Aliases

Edit config/bash/aliases.sh to add personal aliases:

# Your custom aliases
alias myproject='cd ~/projects/myproject'
alias deploy='./scripts/deploy.sh'

Modifying the Prompt

Edit config/bash/prompt.sh to customize the shell prompt.

Adding Vim Plugins

  1. Add plugin to editors/.vimrc in the vim-plug section:
Plug 'username/repo'
  1. Run vim +PlugInstall +qall

Installation Options

Interactive Mode (Default)

./install.sh

Non-Interactive Mode

./install.sh -y

Dry Run (Preview Changes)

./install.sh --dry-run

Skip Optional Components

./install.sh --skip-vim-plugins --skip-tmux

Environment-Specific Setup

GitHub Codespaces

The dotfiles automatically detect Codespaces and:

  • Set [CS] indicator in prompt
  • Configure git credential helper
  • Add Codespaces-specific aliases

WSL (Windows Subsystem for Linux)

Detected automatically for WSL-specific optimizations.

macOS

Detected automatically for macOS-specific paths and tools.

Maintenance

Updating

cd ~/dotfiles
git pull

Or use make:

cd ~/dotfiles
make update

Backing Up Current Configs

The install script automatically backs up existing configs to ~/.dotfiles-backup/.

Manual backup:

make backup

Removing Dotfiles

make clean

Requirements

  • OS: Linux, macOS, or WSL
  • Shell: Bash 4+ or Zsh 5+
  • Git: Version 2.0+
  • Vim: Version 8+ (with +python3 recommended)
  • Optional: tmux, node, python, docker

Optional Dependencies

For full functionality, consider installing:

# CLI tools
sudo apt-get install tmux tree hurl jq fzf

# Python tools
pip install black flake8 pylint

# Node tools
npm install -g @anthropic-ai/claude-code

# Zsh plugins (optional)
git clone https://github.com/zsh-users/zsh-syntax-highlighting ~/.zsh/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions

License

MIT License - feel free to use and modify for your own needs.

Contributing

Contributions welcome! Feel free to submit issues or pull requests.

Credits

Inspired by various dotfiles repositories and the developer community.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors