diff --git a/.github/workflows/test-install.yml b/.github/workflows/test-install.yml new file mode 100644 index 0000000..d50d412 --- /dev/null +++ b/.github/workflows/test-install.yml @@ -0,0 +1,50 @@ +name: Test Install + +on: + push: + branches: [master, main] + pull_request: + branches: [master, main] + +jobs: + ubuntu: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install dotfiles + run: CI=true LOCAL_INSTALL=1 MISE_HTTP_TIMEOUT=120 bash install.sh + - name: Verify mise + run: | + eval "$(~/.local/bin/mise activate bash)" + mise current ruby + mise current node + - name: Verify symlinks + run: | + test -L ~/.aliases + test -L ~/.zshrc + test -L ~/.vimrc + test -L ~/.tmux.conf + test -L ~/.gitconfig + - name: Verify vim-plug + run: test -f ~/.vim/autoload/plug.vim + + macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - name: Install dotfiles + run: CI=true LOCAL_INSTALL=1 MISE_HTTP_TIMEOUT=120 bash install.sh + - name: Verify mise + run: | + eval "$(~/.local/bin/mise activate bash)" + mise current ruby + mise current node + - name: Verify symlinks + run: | + test -L ~/.aliases + test -L ~/.zshrc + test -L ~/.vimrc + test -L ~/.tmux.conf + test -L ~/.gitconfig + - name: Verify vim-plug + run: test -f ~/.vim/autoload/plug.vim diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..3210329 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,52 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Overview + +This is **Campus Code Dotfiles (cc_dotfiles)** — a shared dotfiles distribution for zsh, vim, tmux, and git, targeting macOS and Ubuntu. + +## Installation + +```bash +# Remote install (clones to ~/.cc_dotfiles, then runs rake install) +bash -c "$(curl -fSs https://raw.githubusercontent.com/campuscode/cc_dotfiles/master/install.sh)" + +# Local install (from a cloned repo) +LOCAL_INSTALL=1 bash install.sh +``` + +The `install.sh` installs system dependencies, sets up mise (Ruby/Node.js), then copies the repo to `~/.cc_dotfiles` and runs `rake install`. The Rake task symlinks config files into `~/` (prefixed with `.`), installs fonts, vim-plug plugins, zsh-syntax-highlighting, tmux-battery plugin, and changes the default shell to zsh. + +## Testing + +Tests run in isolated VMs to avoid affecting the host machine: +- **macOS**: Vagrant + UTM plugin with Ubuntu 24.04 Desktop (`vagrant up --provider=utm`) +- **Linux**: Multipass with Ubuntu 24.04 (`./tests/test_linux.sh`) + +See [tests/README.md](tests/README.md) for detailed setup instructions. + +## Architecture + +**install.sh** is the entry point — installs system packages, mise, Ruby, and Node.js, then copies the repo and runs `rake install`. + +**Rakefile** is the installer — symlinks files, runs `mac.sh` or `ubuntu.sh` for platform-specific prerequisites, and sets up plugins. + +**mac.sh / ubuntu.sh** install platform-specific dependencies (Homebrew packages on macOS, Docker/tmux/Gogh on Ubuntu). + +**Customization layer**: Every config file sources a `.local` counterpart if present. Users put personal overrides in `.local` files rather than modifying the repo. + +**Key conventions**: +- Vim leader key is `` +- Tmux prefix is `C-a` (not the default `C-b`) +- Zsh uses vi mode with `jj` bound to escape +- Default colorscheme is gruvbox (dark background) +- Vim plugin manager is [vim-plug](https://github.com/junegunn/vim-plug) (`~/.vim/plugins.vim`) +- Vim settings are auto-loaded from `vim/settings/*.vim` +- Zsh functions are auto-loaded from `zsh/functions/*` +- Zsh theme is `peepcode` (`zsh/themes/peepcode.theme`) +- Ruby and Node.js managed by [mise](https://mise.jdx.dev) + +**Shell aliases** (`aliases`): git shortcuts (`gs`=status, `gco`=checkout, `gp`=push, `gpsh`=push current branch), docker compose aliases (`dc`, `dcr`, `dcup`), and Rails/Ruby aliases (`rc`, `rs`, `rdm`). + +**Git config** (`git/gitconfig`): patience diff algorithm, vimdiff as merge tool, rerere enabled, push default is `simple`. Local overrides via `~/.gitconfig.local`. diff --git a/README.md b/README.md index 4853898..629b026 100644 --- a/README.md +++ b/README.md @@ -1,58 +1,72 @@ -CAMPUS CODE Dotfiles -==================== +# Campus Code Dotfiles ![](https://i.imgur.com/XogkB7V.png) -## Source of inspiration +A shared dotfiles distribution for **zsh**, **vim**, **tmux**, and **git**, targeting macOS and Ubuntu. -Our dotfiles are based on following amazing dotfiles: +Inspired by [Skwp Dotfiles](https://github.com/skwp/dotfiles) and [ThoughtBot Dotfiles](https://github.com/thoughtbot/dotfiles). -[Skwp Dotfiles](http://github.com/skwp/dotfiles) +## What's included -[ThoughtBot Dotfiles](http://github.com/thoughtbot/dotfiles) +- **Zsh** with vi mode, custom theme (peepcode), syntax highlighting, and extensive aliases +- **Vim** with vim-plug, gruvbox colorscheme, ALE linting, NERDTree, CtrlP, and tmux integration +- **Tmux** with `C-a` prefix, vim-aware pane navigation, battery status, and vi copy mode +- **Git** with aliases, patience diff, vimdiff merge tool, and rerere enabled +- **mise** for Ruby and Node.js version management +- **Docker** and Docker Compose via [OrbStack](https://orbstack.dev) (macOS) or Docker CE (Linux, optional) -## Requirements - -* Zsh -* [Ag](https://github.com/ggreer/the_silver_searcher) -* [ITerm 2 (Mac)](https://www.iterm2.com/index.html) -* MVim (Mac) or GVim (Linux) -* [Gruvbox](https://github.com/morhetz/gruvbox) -* Tmux - -## Pre-Requirements +## Pre-requisites - curl -Ubuntu +On Ubuntu, if not already installed: -- `sudo apt-get install -y curl` +```bash +sudo apt-get install -y curl +``` ## Install -Run follow command: - +```bash +bash -c "$(curl -fSs https://raw.githubusercontent.com/campuscode/cc_dotfiles/master/install.sh)" ``` -sh -c "`curl -fSs https://raw.githubusercontent.com/campuscode/cc_dotfiles/master/install.sh`" + +You will be prompted for your password to change the default shell to zsh. + +For local development installs (from a cloned repo): + +```bash +LOCAL_INSTALL=1 bash install.sh ``` -Type your password to change your default shell to `zsh` +## Customization -## Docs +Every config file sources a `.local` counterpart if present. Place your personal overrides in these files rather than modifying the repo directly: + +| File | Purpose | +|---|---| +| `~/.aliases.local` | Custom shell aliases | +| `~/.zshrc.local` | Zsh configuration overrides | +| `~/.zshenv.local` | Environment variables | +| `~/.vimrc.local` | Vim settings and colorscheme | +| `~/.plugins.vim.local` | Additional vim plugins | +| `~/.tmux.conf.local` | Tmux configuration overrides | +| `~/.gitconfig.local` | Git user name, email, and overrides | +| `~/.secrets` | API keys and tokens (not tracked by git) | -[Vim Key Mapping](Vim.md) +## Key conventions -[Tmux Key Mapping](Tmux.md) +- **Vim leader**: `` +- **Tmux prefix**: `C-a` +- **Zsh vi mode**: `jj` to escape +- **Colorscheme**: gruvbox (dark) + +## Docs -#### It's easy to make your customization +- [Vim Key Mapping](Vim.md) +- [Tmux Key Mapping](Tmux.md) +- [Testing](tests/README.md) -Place your customization in the following files: +## Options -* .aliases.local -* .secrets -* .zshrc.local -* .vimrc.local -* .zshenv.local -* .plugin.vim.local -* .tmux.conf.local -* .gitconfig.local +- `SKIP_DOCKER=1` — skip Docker installation on Linux diff --git a/Rakefile b/Rakefile index 41ad9d5..7f6e4f1 100644 --- a/Rakefile +++ b/Rakefile @@ -39,6 +39,7 @@ def install_vim_plugins end def change_shell + return if ENV['CI'] puts "You will change your default shell to zsh" run_command %{ chsh -s $(which zsh) } end @@ -109,9 +110,6 @@ end def linux_message puts '' puts "- Change your terminal window to Run command as login shell and RESTART" - puts '' - puts "- You can find more information about this on \r -https://github.com/rvm/ubuntu_rvm" end def installation_message @@ -121,7 +119,7 @@ def installation_message puts 'Thank you!' puts '' puts '' - linux_message if linux? + puts "- Run 'mise install ruby node' to install latest versions" if linux? puts '=======================================================================' end diff --git a/Tmux.md b/Tmux.md index 0baa10d..73456ab 100644 --- a/Tmux.md +++ b/Tmux.md @@ -1,21 +1,76 @@ -## Tmux +# Tmux Key Mappings -### Prefix +Prefix key is `C-a` (Ctrl+a). - - Ctrl-a +## Sessions -### Navigation +| Key | Action | +|---|---| +| `C-a d` | Detach from current session | +| `C-a C-a` | Switch to last active window | - - Vim navigation style with Ctrl-h j k l +## Windows -### Splits +| Key | Action | +|---|---| +| `C-a c` | Create new window (in current directory) | +| `C-a r` | Reload tmux configuration | - - Ctrl-a v opens a vertical split - - Ctrl-a s opens a horizontal split - - Ctrl-z toggles zoom out/in on the current split +## Panes -## Global +### Creating panes - - Ctrl-d detaches current split - - Ctrl-e synchronizes all splits - - Ctrl-E turn off splits synchronization +| Key | Action | +|---|---| +| `C-a v` | Vertical split (side by side) | +| `C-a s` | Horizontal split (top and bottom) | + +### Navigating panes + +Pane navigation is shared with vim — works seamlessly across vim splits and tmux panes. + +| Key | Action | +|---|---| +| `C-h` | Move to left pane | +| `C-j` | Move to pane below | +| `C-k` | Move to pane above | +| `C-l` | Move to right pane | + +### Resizing panes + +| Key | Action | +|---|---| +| `Shift-Left/Right` | Resize horizontally (small step) | +| `Shift-Up/Down` | Resize vertically (small step) | +| `C-Left/Right` | Resize horizontally (large step) | +| `C-Up/Down` | Resize vertically (large step) | +| `C-z` | Toggle zoom on current pane | + +## Synchronization + +Send the same input to all panes in a window — useful for running the same command on multiple servers. + +| Key | Action | +|---|---| +| `C-a e` | Enable pane synchronization | +| `C-a E` | Disable pane synchronization | + +## Copy Mode + +Enter copy mode with `C-a C-[`. Uses vi keybindings. + +| Key | Action | +|---|---| +| `v` | Begin selection | +| `C-v` | Toggle rectangle selection | +| `y` | Copy selection to clipboard | +| `Enter` | Copy selection to clipboard | + +## Status Bar + +The status bar shows: +- Current session name and user (left) +- Window list (center) +- Battery status, hostname, and date/time (right) + +Windows are automatically renamed to the current directory. diff --git a/Vagrantfile b/Vagrantfile index d888fc5..0574a29 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,11 +1,18 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -Vagrant.configure(2) do |config| - config.vm.box = "ubuntu/focal64" +Vagrant.configure("2") do |config| + config.vm.box = "bento/ubuntu-24.04" - config.vm.synced_folder ".", "/vagrant", id: "vagrant-root" - config.vm.synced_folder "~/workspace", "/workspace", id: "vagrant-repos" + config.vm.provider :utm do |utm| + utm.name = "cc-dotfiles" + utm.memory = 4096 + utm.cpus = 2 + utm.directory_share_mode = "virtFS" + utm.notes = "Campus Code Dotfiles testing VM" + end - config.vm.network :private_network, ip: "192.168.10.10" + config.vm.synced_folder ".", "/vagrant" + + config.vm.provision "shell", inline: "apt-get update && apt-get install -y curl" end diff --git a/Vim.md b/Vim.md index 6c0af61..d2304dd 100644 --- a/Vim.md +++ b/Vim.md @@ -1,31 +1,89 @@ -## Vim Key Mappings - -- Rspec + Tmux + Rubocop - - \rs - Run rspec - - \ra - Run rspec spec (all files) - - \rn - Run rspec spec (nearest spec) - - \rl - Run last spec - - \ru - Run full rubocop - -- Ctrl-P Fuzzy Finder - - \t or \p - - \b search only on buffer - -- NERDTree - - Ctrl+\\ open and close NERDTree - -- Vim-tmux-runner - - When open vim, it asks you which pane to attach - -- Ag - - K - search current word - -- Global - - vv - opens vertical split - - ss - opens horizontal split - - // - clear current search highlight - - Shift-t - Opens a new tab - - gt - Go to next tab - - Tab - In insert mode, start completion - - \vr - reload vim configuration - - \hl - toggle search highlighting on/off +# Vim Key Mappings + +Leader key is ``. + +## Navigation + +| Key | Action | +|---|---| +| `` | Switch between the last two files | +| `C-h` `C-j` `C-k` `C-l` | Navigate between vim/tmux panes seamlessly | +| `vv` | Open vertical split | +| `ss` | Open horizontal split | +| `-` | Zoom current pane (maximize) | +| `=` | Re-balance all panes | + +## File Explorer (NERDTree) + +| Key | Action | +|---|---| +| `C-\` | Toggle NERDTree / reveal current file | + +## Fuzzy Finder (CtrlP) + +| Key | Action | +|---|---| +| `t` | Open CtrlP file finder | +| `b` | Search open buffers | +| `m` | Search most recently used files | + +## Search + +| Key | Action | +|---|---| +| `K` | Search current word with Ag (Silver Searcher) | +| `//` | Clear current search highlight | +| `hl` | Toggle search highlighting on/off | + +## RSpec (via tmux runner) + +| Key | Action | +|---|---| +| `rs` | Run current spec file | +| `rn` | Run nearest spec | +| `rl` | Run last spec | +| `ra` | Run all specs | + +## Code Quality (via tmux runner) + +| Key | Action | +|---|---| +| `ru` | Run Rubocop on project | +| `rfu` | Run Rubocop on current file | +| `fl` | Run Flog on current file | + +## ERB Templates + +| Key | Mode | Action | +|---|---|---| +| `C-k` | Insert | Insert `<%= %>` tag | +| `C-j` | Insert | Insert `<% %>` tag | + +## Clipboard + +| Key | Action | +|---|---| +| `y` + motion | Copy to system clipboard (e.g., `yw` copies a word) | +| `p` | Paste from system clipboard | + +## Tabs + +| Key | Action | +|---|---| +| `Shift-t` | Open new tab | +| `Shift-Tab` | Go to next tab | + +## Completion + +| Key | Mode | Action | +|---|---|---| +| `Tab` | Insert | Autocomplete (or insert tab at beginning of line) | +| `Shift-Tab` | Insert | Next completion | + +## Other + +| Key | Action | +|---|---| +| `vr` | Reload vim configuration | +| `ct` | Generate ctags for the project | +| `gs` | Open Git status (fugitive) | diff --git a/aliases b/aliases index 6344fc8..67d85f8 100644 --- a/aliases +++ b/aliases @@ -41,9 +41,7 @@ alias arl="source $HOME/.aliases.local" alias aliass='alias | grep' # vim using -mvim --version > /dev/null 2>&1 -MACVIM_INSTALLED=$? -if [ $MACVIM_INSTALLED -eq 0 ]; then +if command -v mvim > /dev/null 2>&1; then alias vim="mvim -v" fi @@ -72,7 +70,7 @@ alias gsl='git stash list' alias gsh='git show' alias gshw='git show' alias gshow='git show' -alias gi='vim .gitignore' +alias gie='vim .gitignore' alias gc='git c' alias gcm='git cm' alias gca='git ca' @@ -110,7 +108,7 @@ alias gp='git push' alias gpX='git push --delete' #push current branch alias gpsh='git push -u origin `git rev-parse --abbrev-ref HEAD`' -alias gpom="git push origin master" +alias gpom='git push origin $(git symbolic-ref --short HEAD)' alias gnb='git nb' # new branch aka checkout -b alias grs='git reset' alias grsh='git reset --hard' @@ -123,8 +121,8 @@ alias gbg='git bisect good' alias gbb='git bisect bad' alias gcl="git clone" -# docker-compose -alias dc="docker-compose" +# docker compose +alias dc="docker compose" alias dcr="dc run --rm --service-ports" alias dcR="dc run --rm" # no service ports alias dcrwb="dcr web bash" @@ -154,15 +152,15 @@ alias ka9='killall -9' alias k9='kill -9' # Gem install -alias gi='gem install --no-ri --no-rdoc' +alias gi='gem install --no-document' -alias rdm='rake db:migrate' -alias rdr='rake db:rollback' -alias rdmr='rake db:migrate:redo' -alias rrs='rake routes' +alias rdm='rails db:migrate' +alias rdr='rails db:rollback' +alias rdmr='rails db:migrate:redo' +alias rrs='rails routes' # Rspec -alias rs='rspec spec' +alias rs='rspec' # Rails alias rc='rails c' @@ -174,7 +172,7 @@ then alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app' alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app' # Homebrew - alias brewu='brew update && brew upgrade && brew cleanup && brew prune && brew doctor' + alias brewu='brew update && brew upgrade && brew cleanup && brew doctor' alias mykey="cat $HOME/.ssh/id_rsa.pub | pbcopy" fi diff --git a/git/gitconfig b/git/gitconfig index e2a70ed..01f2272 100644 --- a/git/gitconfig +++ b/git/gitconfig @@ -16,7 +16,7 @@ chunkyadd = add --patch # stage commits chunk by chunk # via http://blog.apiaxle.com/post/handy-git-tips-to-stop-you-getting-fired/ - snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}" + snapshot = !git stash push -m "snapshot: $(date)" && git stash apply "stash@{0}" snapshots = !git stash list --grep snapshot #via http://stackoverflow.com/questions/5188320/how-can-i-get-a-list-of-git-branches-ordered-by-most-recent-commit @@ -89,7 +89,7 @@ [mergetool] prompt = false [mergetool "vimdiff"] - cmd="vim -c 'Gdiff' $MERGED" # use fugitive.vim for 3-way merge + cmd="vim -c 'Gdiffsplit' $MERGED" # use fugitive.vim for 3-way merge keepbackup=false [merge] summary = true @@ -104,7 +104,7 @@ [push] # 'git push' will push the current branch to its tracking branch # the usual default is to push all branches - default = upstream + default = simple [core] autocrlf = false editor = vim diff --git a/install.sh b/install.sh index d9662df..c71b40a 100755 --- a/install.sh +++ b/install.sh @@ -1,76 +1,74 @@ -#!/bin/sh +#!/bin/bash +set -eu -if [ ! -d "$HOME/.cc_dotfiles" ] -then - echo "Installing Campus Code Dotfiles" - echo "We'll install:" - echo " - tmux" - echo " - silver searcher" - echo " - zsh" - echo " - rvm" - echo " - nodejs" +if [ -d "$HOME/.cc_dotfiles" ]; then + echo "You already have Campus Code Dotfiles installed." + exit 0 +fi + +echo "Installing Campus Code Dotfiles" +echo "We'll install:" +echo " - tmux" +echo " - silver searcher" +echo " - zsh" +echo " - mise (Ruby, Node.js)" + +case "$(uname -s)" in + Linux) + echo " - vim (vim-gtk3)" + + sudo apt-get update + sudo apt-get install -y software-properties-common dconf-cli uuid-runtime - case "$(uname -s)" in - Linux) - echo " - vim (vim-gnome)" - echo " - Docker" - echo " - docker-compose" - NODE_VERSION=12 + sudo apt-get install -y rsync \ + silversearcher-ag \ + git \ + xclip \ + build-essential \ + zsh \ + vim-gtk3 \ + libevent-dev \ + ncurses-dev \ + bison \ + pkg-config \ + libssl-dev \ + libreadline-dev \ + zlib1g-dev \ + libyaml-dev \ + libffi-dev - sudo apt-get update - sudo apt-get install -y software-properties-common gnupg2 dconf-cli uuid-runtime - curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - - curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import - - curl -sSL https://get.rvm.io | bash -s stable --ruby - curl -sL https://deb.nodesource.com/setup_${NODE_VERSION}.x | sudo -E bash - - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list + curl https://mise.run | sh + eval "$(~/.local/bin/mise activate bash)" + mise settings ruby.compile=false + mise use --global ruby + mise use --global node + ;; + Darwin) + bash "$(dirname "$0")/mac.sh" + eval "$(/opt/homebrew/bin/brew shellenv 2>/dev/null || /usr/local/bin/brew shellenv)" - sudo apt-get install -y silversearcher-ag \ - git \ - xclip \ - build-essential \ - zsh \ - dconf-cli \ - vim-gtk3 \ - nodejs \ - yarn \ - ruby \ - libevent-dev \ - ncurses-dev \ - bison \ - pkg-config - ;; - Darwin ) - echo " - vim (macvim)" - echo " - google-chrome (mac)" - echo " - iterm2 (mac)" - echo " - atom (mac)" - gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB - curl -sSL https://get.rvm.io | bash -s stable --ruby - sudo usermod -a -G rvm `whoami` - ;; - CYGWIN* | MSYS*) - echo 'You are using a Windows machine which is not recommended to use with our' \ - ' dotfiles.' - echo 'You can clone our repository and try install it manually.' - return - ;; - *) - echo 'Operational system not recognized, aborting installation' - return - ;; - esac - if [ -z "$LOCAL_INSTALL" ] - then - echo "FROM REMOTE SOURCE" - git clone --depth=10 https://github.com/campuscode/cc_dotfiles.git "$HOME/.cc_dotfiles" - else - echo "LOCAL SOURCE" - cp -r . "$HOME/.cc_dotfiles" - fi - cd "$HOME/.cc_dotfiles" - rake install + curl https://mise.run | sh + eval "$(~/.local/bin/mise activate bash)" + mise settings ruby.compile=false + mise use --global ruby + mise use --global node + ;; + *) + echo "Operational system not supported, aborting installation" + exit 1 + ;; +esac + +if [ -z "${LOCAL_INSTALL:-}" ]; then + echo "Installing from remote source" + git clone --depth=10 https://github.com/campuscode/cc_dotfiles.git "$HOME/.cc_dotfiles" else - echo "You already have Campus Code Dotfiles installed." + echo "Installing from local source" + rsync -a --no-perms --exclude='.vagrant' --exclude='.git' --exclude='tags' --exclude='vim/autoload' --exclude='vim/bundle' --exclude='vim/backups' . "$HOME/.cc_dotfiles" + curl -fLo "$HOME/.cc_dotfiles/vim/autoload/plug.vim" --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim fi + +cd "$HOME/.cc_dotfiles" +rake install + diff --git a/irb/escaped_colors.rb b/irb/escaped_colors.rb deleted file mode 100644 index e1ba28d..0000000 --- a/irb/escaped_colors.rb +++ /dev/null @@ -1,68 +0,0 @@ -TERM_TOKEN_COLORS = { - :attribute_name => "\e[33m", - :attribute_value => "\e[31m", - :binary => "\e[1;35m", - :char => { - :self => "\e[36m", :delimiter => "\e[34m" - }, - :class => "\e[1;35m", - :class_variable => "\e[36m", - :color => "\e[32m", - :comment => "\e[37m", - :complex => "\e[34m", - :constant => "\e[34m\e[4m", - :decoration => "\e[35m", - :definition => "\e[1;32m", - :directive => "\e[32m\e[4m", - :doc => "\e[46m", - :doctype => "\e[1;30m", - :doc_string => "\e[31m\e[4m", - :entity => "\e[33m", - :error => "\e[1;33m\e[41m", - :exception => "\e[1;31m", - :float => "\e[1;35m", - :function => "\e[1;34m", - :global_variable => "\e[42m", - :hex => "\e[1;36m", - :include => "\e[33m", - :integer => "\e[1;34m", - :key => "\e[35m", - :label => "\e[1;15m", - :local_variable => "\e[33m", - :octal => "\e[1;35m", - :operator_name => "\e[1;29m", - :predefined_constant => "\e[1;36m", - :predefined_type => "\e[1;30m", - :predefined => "\e[4m\e[1;34m", - :preprocessor => "\e[36m", - :pseudo_class => "\e[34m", - :regexp => { - :self => "\e[31m", - :content => "\e[31m", - :delimiter => "\e[1;29m", - :modifier => "\e[35m", - :function => "\e[1;29m" - }, - :reserved => "\e[1;31m", - :shell => { - :self => "\e[42m", - :content => "\e[1;29m", - :delimiter => "\e[37m", - }, - :string => { - :self => "\e[36m", - :modifier => "\e[1;32m", - :escape => "\e[1;36m", - :delimiter => "\e[1;32m", - }, - :symbol => "\e[1;31m", - :tag => "\e[34m", - :type => "\e[1;34m", - :value => "\e[36m", - :variable => "\e[34m", - - :insert => "\e[42m", - :delete => "\e[41m", - :change => "\e[44m", - :head => "\e[45m" -} diff --git a/irb/pryrc b/irb/pryrc index dfecc17..520320b 100644 --- a/irb/pryrc +++ b/irb/pryrc @@ -7,14 +7,26 @@ Pry.commands.alias_command 's', 'step' rescue nil Pry.commands.alias_command 'n', 'next' rescue nil # === CUSTOM PROMPT === -# This prompt shows the ruby version (useful for RVM) -Pry.prompt = [proc { |obj, nest_level, _| "#{RUBY_VERSION} (#{obj}):#{nest_level} > " }, proc { |obj, nest_level, _| "#{RUBY_VERSION} (#{obj}):#{nest_level} * " }] +# This prompt shows the ruby version (useful for mise) +if Pry::Prompt.respond_to?(:new) + Pry.config.prompt = Pry::Prompt.new( + 'cc', + 'Campus Code prompt', + [ + proc { |obj, nest_level, _| "#{RUBY_VERSION} (#{obj}):#{nest_level} > " }, + proc { |obj, nest_level, _| "#{RUBY_VERSION} (#{obj}):#{nest_level} * " } + ] + ) +else + Pry.prompt = [ + proc { |obj, nest_level, _| "#{RUBY_VERSION} (#{obj}):#{nest_level} > " }, + proc { |obj, nest_level, _| "#{RUBY_VERSION} (#{obj}):#{nest_level} * " } + ] +end # === Listing config === -# Better colors - by default the headings for methods are too +# Better colors - by default the headings for methods are too # similar to method name colors leading to a "soup" -# These colors are optimized for use with Solarized scheme -# for your terminal Pry.config.ls.separator = "\n" # new lines between methods Pry.config.ls.heading_color = :magenta Pry.config.ls.public_method_color = :green @@ -22,44 +34,20 @@ Pry.config.ls.protected_method_color = :yellow Pry.config.ls.private_method_color = :bright_black # == PLUGINS === -# awesome_print gem: great syntax colorized printing +# amazing_print gem: great syntax colorized printing (formerly awesome_print) begin - require 'awesome_print' - # The following line enables awesome_print for all pry output, - # and it also enables paging - Pry.config.print = proc {|output, value| Pry::Helpers::BaseHelpers.stagger_output("=> #{value.ai}", output)} - AwesomePrint.defaults = { - :indent => 2, - :sort_keys => true, - :color => { - :args => :greenish, - :array => :pale, - :bigdecimal => :blue, - :class => :yellow, - :date => :greenish, - :falseclass => :red, - :fixnum => :blue, - :float => :blue, - :hash => :pale, - :keyword => :cyan, - :method => :purpleish, - :nilclass => :red, - :string => :yellowish, - :struct => :pale, - :symbol => :cyanish, - :time => :greenish, - :trueclass => :green, - :variable => :cyanish - } - } - # If you want awesome_print without automatic pagination, use the line below - # Pry.config.print = proc { |output, value| output.puts value.ai } -rescue LoadError => err - puts "gem install awesome_print # <-- highly recommended" + require 'amazing_print' + AmazingPrint.pry! +rescue LoadError + begin + require 'awesome_print' + AwesomePrint.pry! + rescue LoadError + # no pretty printer available + end end # === CUSTOM COMMANDS === -# from: https://gist.github.com/1297510 default_command_set = Pry::CommandSet.new do command "copy", "Copy argument to the clip-board" do |str| IO.popen('pbcopy', 'w') { |f| f << str.to_s } @@ -92,9 +80,7 @@ end Pry.config.commands.import default_command_set - # === CONVENIENCE METHODS === -# Stolen from https://gist.github.com/807492 # Use Array.toy or Hash.toy to get an array or hash to play with class Array def self.toy(n=10, &block) @@ -108,30 +94,4 @@ class Hash end end -# === COLOR CUSTOMIZATION === -# Everything below this line is for customizing colors, you have to use the ugly -# color codes, but such is life. -CodeRay.scan("example", :ruby).term # just to load necessary files -# Token colors pulled from: https://github.com/rubychan/coderay/blob/master/lib/coderay/encoders/terminal.rb - -$LOAD_PATH << File.dirname(File.realpath(__FILE__)) - -# In CodeRay >= 1.1.0 token colors are defined as pre-escaped ANSI codes -if Gem::Version.new(CodeRay::VERSION) >= Gem::Version.new('1.1.0') - require "escaped_colors" -else - require "unescaped_colors" -end - -module CodeRay - module Encoders - class Terminal < Encoder - # override old colors - TERM_TOKEN_COLORS.each_pair do |key, value| - TOKEN_COLORS[key] = value - end - end - end -end - # vim: set ft=ruby : diff --git a/irb/unescaped_colors.rb b/irb/unescaped_colors.rb deleted file mode 100644 index 6580fc5..0000000 --- a/irb/unescaped_colors.rb +++ /dev/null @@ -1,68 +0,0 @@ -TERM_TOKEN_COLORS = { - :attribute_name => '33', - :attribute_value => '31', - :binary => '1;35', - :char => { - :self => '36', :delimiter => '34' - }, - :class => '1;35', - :class_variable => '36', - :color => '32', - :comment => '37', - :complex => '34', - :constant => ['34', '4'], - :decoration => '35', - :definition => '1;32', - :directive => ['32', '4'], - :doc => '46', - :doctype => '1;30', - :doc_string => ['31', '4'], - :entity => '33', - :error => ['1;33', '41'], - :exception => '1;31', - :float => '1;35', - :function => '1;34', - :global_variable => '42', - :hex => '1;36', - :include => '33', - :integer => '1;34', - :key => '35', - :label => '1;15', - :local_variable => '33', - :octal => '1;35', - :operator_name => '1;29', - :predefined_constant => '1;36', - :predefined_type => '1;30', - :predefined => ['4', '1;34'], - :preprocessor => '36', - :pseudo_class => '34', - :regexp => { - :self => '31', - :content => '31', - :delimiter => '1;29', - :modifier => '35', - :function => '1;29' - }, - :reserved => '1;31', - :shell => { - :self => '42', - :content => '1;29', - :delimiter => '37', - }, - :string => { - :self => '36', - :modifier => '1;32', - :escape => '1;36', - :delimiter => '1;32', - }, - :symbol => '1;31', - :tag => '34', - :type => '1;34', - :value => '36', - :variable => '34', - - :insert => '42', - :delete => '41', - :change => '44', - :head => '45' -} diff --git a/mac.sh b/mac.sh index 2f36aff..62a100e 100755 --- a/mac.sh +++ b/mac.sh @@ -1,9 +1,10 @@ -#!/bin/sh +#!/bin/bash +set -eu -ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -brew install zsh ctags git hub tmux reattach-to-user-namespace the_silver_searcher -brew install macvim --custom-icons --override-system-vim --with-lua --with-luajit -brew cask install atom -brew cask install google-chrome -brew cask install iterm2 +if ! command -v brew > /dev/null 2>&1; then + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + eval "$(/opt/homebrew/bin/brew shellenv 2>/dev/null || /usr/local/bin/brew shellenv)" +fi +brew install openssl@3 libyaml readline zsh ctags git gh tmux the_silver_searcher macvim +brew install --cask visual-studio-code google-chrome iterm2 orbstack diff --git a/templates/copy_mode_mac.conf.tmp b/templates/copy_mode_mac.conf.tmp index 88f598f..513258f 100644 --- a/templates/copy_mode_mac.conf.tmp +++ b/templates/copy_mode_mac.conf.tmp @@ -1,11 +1,9 @@ -# Patch for OS X pbpaste and pbcopy under tmux. -set-option -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL" # Setup 'v' to begin selection as in Vim bind-key -T copy-mode-vi v send-keys -X begin-selection -bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" +bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy" bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle -# # Update default binding of `Enter` to also use copy-pipe +# Update default binding of `Enter` to also use copy-pipe unbind-key -T copy-mode-vi Enter -bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" +bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy" # vi: set ft=tmux : diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..861fd98 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,83 @@ +# Testing cc_dotfiles + +Test the dotfiles installation in an isolated VM before deploying to your machine. + +## macOS (Vagrant + UTM) + +Uses [Vagrant](https://www.vagrantup.com) with the [vagrant_utm](https://github.com/naveenrajm7/vagrant_utm) plugin +to run an Ubuntu Desktop VM via UTM. Provides a graphical interface for visually verifying +terminal colors, fonts, vim, tmux, etc. + +### Setup (one-time) + +1. Install UTM and Vagrant: + +```bash +brew install --cask utm +brew install --cask vagrant +``` + +2. Install the UTM provider plugin: + +```bash +vagrant plugin install vagrant_utm +``` + +### Usage + +```bash +vagrant up --provider=utm # create VM, install dotfiles +vagrant ssh # access the VM via terminal +vagrant halt # stop the VM +vagrant destroy -f # destroy the VM +vagrant up --provision # re-provision existing VM +``` + +After the first `vagrant up --provider=utm`, subsequent commands (`vagrant ssh`, `vagrant halt`, etc) +don't need the `--provider` flag. + +To open the graphical desktop, use the UTM app — the VM will appear as `cc-dotfiles`. + +The project directory is synced to `/vagrant` inside the VM. +Edits on the host are immediately visible in the VM. + +### Verifying the installation + +Inside the VM, verify: +- Open a new terminal — it should be running zsh with the peepcode theme +- Run `vim` — should open with gruvbox colorscheme and all plugins loaded +- Run `tmux` — prefix should be `C-a`, status bar should be styled +- Run `mise current` — should show Ruby and Node.js versions +- Run `git config --list` — should include the cc_dotfiles git aliases + +### Starting over + +```bash +vagrant destroy -f && vagrant up --provider=utm +``` + +## Linux/Ubuntu (Multipass) + +Uses [Multipass](https://multipass.run) to run a headless Ubuntu VM with the project +directory mounted. Good for quick terminal-only testing. + +### Setup (one-time) + +```bash +sudo snap install multipass +``` + +### Usage + +```bash +./tests/test_linux.sh # create VM and install dotfiles +./tests/test_linux.sh teardown # destroy the VM +multipass shell cc-dotfiles # access the VM +``` + +The project is mounted at `/home/ubuntu/cc_dotfiles` inside the VM. +Edits on the host are immediately visible in the VM. + +## Options + +- `SKIP_DOCKER=1` — skip Docker installation (set in the VM before running install.sh) diff --git a/tests/test_linux.sh b/tests/test_linux.sh new file mode 100755 index 0000000..a88c93e --- /dev/null +++ b/tests/test_linux.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Test cc_dotfiles installation on Linux/Ubuntu using Multipass +# +# Requires: Multipass (https://multipass.run) +# sudo snap install multipass +# +# Usage: +# ./tests/test_linux.sh # create VM and install dotfiles +# ./tests/test_linux.sh teardown # destroy the VM +# multipass shell cc-dotfiles # access the VM + +set -eu + +VM_NAME="cc-dotfiles" +PROJECT_DIR="$(cd "$(dirname "$0")/.." && pwd)" + +teardown() { + multipass delete "$VM_NAME" --purge + echo "VM '$VM_NAME' destroyed." +} + +if [ "${1:-}" = "teardown" ]; then + teardown + exit 0 +fi + +# Recreate VM from scratch +if multipass list | grep -q "$VM_NAME"; then + teardown +fi + +multipass launch 24.04 --name "$VM_NAME" --mount "$PROJECT_DIR":/home/ubuntu/cc_dotfiles + +# Install curl (only prerequisite not in base image) +multipass exec "$VM_NAME" -- sudo apt-get update +multipass exec "$VM_NAME" -- sudo apt-get install -y curl + +# Install dotfiles using the mounted project directory +multipass exec "$VM_NAME" -- bash -c 'cd ~/cc_dotfiles && LOCAL_INSTALL=1 bash install.sh' + +echo "" +echo "Done! Access the VM with: multipass shell $VM_NAME" +echo "Project mounted at: /home/ubuntu/cc_dotfiles" diff --git a/ubuntu.sh b/ubuntu.sh index 624a790..f15cf1b 100755 --- a/ubuntu.sh +++ b/ubuntu.sh @@ -1,41 +1,51 @@ #!/bin/bash install_tmux() { - TMUX_VERSION="3.1b" + TMUX_VERSION="${TMUX_VERSION:-3.6a}" TMUX_SOURCE_FILE="tmux-${TMUX_VERSION}.tar.gz" TMUX_SOURCE_FOLDER="tmux-${TMUX_VERSION}" echo "Installing tmux ${TMUX_VERSION}" - wget https://github.com/tmux/tmux/releases/download/${TMUX_VERSION}/${TMUX_SOURCE_FILE} - tar -xf ${TMUX_SOURCE_FILE} - pushd $TMUX_SOURCE_FOLDER + curl -LO "https://github.com/tmux/tmux/releases/download/${TMUX_VERSION}/${TMUX_SOURCE_FILE}" + tar -xf "${TMUX_SOURCE_FILE}" + pushd "$TMUX_SOURCE_FOLDER" ./configure make sudo make install popd - rm -rf $TMUX_SOURCE_FOLDER - rm $TMUX_SOURCE_FILE + rm -rf "$TMUX_SOURCE_FOLDER" + rm "$TMUX_SOURCE_FILE" } install_gnome_terminal_colors() { - if [[ -z "${TERMINAL}" ]]; then - TERMINAL=gnome-terminal bash -c "$(wget -qO- https://git.io/vQgMr)" + if [[ -z "${TERMINAL}" ]]; then + TERMINAL=gnome-terminal bash -c "$(curl -sSLo- https://raw.githubusercontent.com/Mayccoll/Gogh/master/gogh.sh)" else - bash -c "$(wget -qO- https://git.io/vQgMr)" + bash -c "$(curl -sSLo- https://raw.githubusercontent.com/Mayccoll/Gogh/master/gogh.sh)" fi } install_docker() { - DOCKER_COMPOSE_VERSION="${DOCKER_COMPOSE_VERSION:-1.29.2}" - sudo apt-get install -y docker.io - sudo curl -L "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose - sudo chmod +x /usr/local/bin/docker-compose - sudo adduser $(users) docker + sudo install -m 0755 -d /etc/apt/keyrings + sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc + sudo chmod a+r /etc/apt/keyrings/docker.asc + + echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + + sudo apt-get update + sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin + sudo usermod -aG docker "$(whoami)" } -install_tmux > /dev/null 2>&1 -install_gnome_terminal_colors -install_docker +install_tmux + +if [ -z "${CI:-}" ]; then + install_gnome_terminal_colors +fi + +if [ "${SKIP_DOCKER:-}" != "1" ]; then + install_docker +fi -sudo apt-get remove -y ruby sudo apt-get autoremove -y diff --git a/vim/plugins.vim b/vim/plugins.vim index fdd9815..1b585ff 100644 --- a/vim/plugins.vim +++ b/vim/plugins.vim @@ -8,10 +8,10 @@ call plug#begin('~/.vim/bundle') Plug 'christoomey/vim-tmux-navigator' Plug 'lifepillar/vim-solarized8' Plug 'gruvbox-community/gruvbox' " default colorscheme -Plug 'scrooloose/nerdtree' " file explorer +Plug 'preservim/nerdtree' " file explorer Plug 'ctrlpvim/ctrlp.vim' " fuzzy finder Plug 'pbrisbin/vim-mkdir' " create folder if it doesn't exist -Plug 'scrooloose/syntastic' " syntax checking +Plug 'dense-analysis/ale' " async linting Plug 'thoughtbot/vim-rspec' Plug 'tpope/vim-endwise' Plug 'tpope/vim-fugitive' @@ -20,7 +20,7 @@ Plug 'tpope/vim-rails' Plug 'keith/rspec.vim' Plug 'tpope/vim-surround' Plug 'vim-ruby/vim-ruby' -Plug 'vim-scripts/tComment' +Plug 'tomtom/tcomment_vim' Plug 'chrisbra/color_highlight' Plug 'tmux-plugins/vim-tmux' Plug 'vim-airline/vim-airline' " Pretty status bar diff --git a/vim/settings/key_mappings.vim b/vim/settings/key_mappings.vim index d6292e0..f1716b0 100644 --- a/vim/settings/key_mappings.vim +++ b/vim/settings/key_mappings.vim @@ -43,7 +43,6 @@ noremap hl :set hlsearch! hlsearch? " CtrlP nnoremap t :CtrlP -nnoremap p :CtrlP nnoremap b :CtrlPBuffer nnoremap m :CtrlPMRU diff --git a/vimrc b/vimrc index 40c8f69..77848a6 100644 --- a/vimrc +++ b/vimrc @@ -108,12 +108,6 @@ let g:Tlist_Ctags_Cmd="ctags --exclude='*.js'" " Treat
  • and

    tags like the block tags they are let g:html_indent_tags = 'li\|p' -" configure syntastic syntax checking to check on open as well as save -let g:syntastic_check_on_open=1 -let g:syntastic_html_tidy_ignore_errors=[" proprietary attribute \"ng-"] -let g:syntastic_eruby_ruby_quiet_messages = - \ {"regex": "possibly useless use of a variable in void context"} - " automatically rebalance windows on vim resize autocmd VimResized * :wincmd = diff --git a/zsh/completion/_boot2docker b/zsh/completion/_boot2docker deleted file mode 100644 index 8f1a9c5..0000000 --- a/zsh/completion/_boot2docker +++ /dev/null @@ -1,87 +0,0 @@ -#compdef boot2docker -# ------------------------------------------------------------------------------ -# Description -# ----------- -# -# Completion script for boot2docker (https://github.com/boot2docker/boot2docker-cli). -# -# ------------------------------------------------------------------------------ -# Authors -# ------- -# -# * hhatto (https://github.com/hhatto) -# -# ------------------------------------------------------------------------------ - - -_boot2docker() { - local context state line - - _arguments -C \ - --basevmdk'[Path to VMDK to use as base for persistent partition]:vmdk:' \ - --dhcp'[enable VirtualBox host-only network DHCP. default=true]' \ - --dhcpip'[VirtualBox host-only network DHCP server address. default=192.168.59.99]' \ - '(-s --disksize)'{-s,--disksize}'[boot2docker disk image size (in MB). default=20000.]:disksize:' \ - --dockerport'[host Docker port (forward to port 2375 in VM).]:PORT:' \ - --hostip'[VirtualBox host-only network IP address.]:IP:' \ - --iso'[path to boot2docker ISO image.]:FILE:_files' \ - --lowerip'[VirtualBox host-only network DHCP lower bound.]:IP:' \ - '(-m --memory)'{-m,--memory}'[virtual machine memory size (in MB). default=2048]' \ - --netmask'[VirtualBox host-only network mask.]' \ - --serial'[try serial console to get IP address (experimental) default=false]' \ - --serialfile'[path to the serial socket/pipe.]:FILE:_files' \ - --ssh'[path to SSH client utility. default="ssh"]:SSH:' \ - --ssh-keygen'[path to ssh-keygen utility. default="ssh-keygen"]:KEYGEN:' \ - --sshkey'[path to SSH key to use.]:FILE:_files' \ - --sshport'[host SSH port (forward to port 22 in VM). default=2022]:PORT:' \ - --upperip'[VirtualBox host-only network DHCP upper bound. default=192.168.59.254]:IP:' \ - --vbm'[path to VirtualBox management utility. default="VBoxManage"]' \ - '(-v --verbose)'{-v,--verbose}'[display verbose command invocations. default=false]' \ - --vm'[virtual machine name. default="boot2docker-vm"]' \ - '*::boot2docker commands:_boot2docker_command' -} - -(( $+functions[_boot2docker_command] )) || -_boot2docker_command() { - local _boot2docker_cmds - - _boot2docker_cmds=( - 'init:Create a new boot2docker VM.' \ - 'up:Start VM from any states.' \ - 'start:Start VM from any states.' \ - 'boot:Start VM from any states.' \ - 'ssh:Login to VM via SSH.' \ - 'save:Suspend VM and save state to disk.' \ - 'suspend:Suspend VM and save state to disk.' \ - "down:Gracefully shutdown the VM." \ - "stop:Gracefully shutdown the VM." \ - "halt:Gracefully shutdown the VM." \ - "restart:Gracefully reboot the VM." \ - "poweroff:Forcefully power off the VM (might corrupt disk image)." \ - "reset:Forcefully power cycle the VM (might corrupt disk image)." \ - "delete:Delete boot2docker VM and its disk image." \ - "destroy:Delete boot2docker VM and its disk image." \ - "config:Show selected profile file settings." \ - "cfg:Show selected profile file settings." \ - "info:Display detailed information of VM." \ - "ip:Display the IP address of the VM's Host-only network." \ - "status:Display current state of VM." \ - "download:Download boot2docker ISO image." \ - "upgrade:Upgrade the boot2docker ISO image (if vm is running it will be stopped and started)." \ - "version:Display version information." - ) - - if (( CURRENT == 1 )); then - _describe -t commands 'boot2docker subcommand' _boot2docker_cmds - fi -} - -_boot2docker "$@" - -# Local Variables: -# mode: Shell-Script -# sh-indentation: 2 -# indent-tabs-mode: nil -# sh-basic-offset: 2 -# End: -# vim: ft=zsh sw=2 ts=2 et diff --git a/zsh/completion/_bower b/zsh/completion/_bower deleted file mode 100644 index 303b976..0000000 --- a/zsh/completion/_bower +++ /dev/null @@ -1,147 +0,0 @@ -#compdef bower -# ------------------------------------------------------------------------------ -# Description -# ----------- -# -# Completion script for Bower (http://bower.io). -# -# ------------------------------------------------------------------------------ -# Authors -# ------- -# -# * Joe Lencioni (https://github.com/lencioni) -# -# ------------------------------------------------------------------------------ - - -local curcontext="$curcontext" state line _packages _opts ret=1 - -_arguments -C -A "-v" -A "--version" \ - '(- 1 *)'{-v,--version}'[display version information]' \ - '1: :->cmds' \ - '*:: :->args' && ret=0 - -case $state in - cmds) - _values "bower command" \ - "cache[Manage bower cache]" \ - "help[Display help information about Bower]" \ - "home[Opens a package homepage into your favorite browser]" \ - "info[Info of a particular package]" \ - "init[Interactively create a bower.json file]" \ - "install[Install a package locally]" \ - "link[Symlink a package folder]" \ - "list[List local packages - and possible updates]" \ - "login[Authenticate with GitHub and store credentials]" \ - "lookup[Look up a package URL by name]" \ - "prune[Removes local extraneous packages]" \ - "register[Register a package]" \ - "search[Search for a package by name]" \ - "update[Update a local package]" \ - "uninstall[Remove a local package]" \ - "unregister[Remove a package from the registry]" \ - "version[Bump a package version]" - _arguments \ - '(--force)--force[Makes various commands more forceful]' \ - '(--json)--json[Output consumable JSON]' \ - '(--log-level)--log-level[What level of logs to report]' \ - '(--offline)--offline[Do not hit the network]' \ - '(--quiet)--quiet[Only output important information]' \ - '(--silent)--silent[Do not output anything, besides errors]' \ - '(--verbose)--verbose[Makes output more verbose]' \ - '(--allow-root)--allow-root[Allows running commands as root]' \ - '(--version)--version[Output Bower version]' \ - '(--no-color)--no-color[Disable colors]' - ret=0 - ;; - args) - case $line[1] in - help) - _values 'commands' \ - 'cache' \ - 'home' \ - 'info' \ - 'init' \ - 'install' \ - 'link' \ - 'list' \ - 'login' \ - 'lookup' \ - 'prune' \ - 'register' \ - 'search' \ - 'update' \ - 'uninstall' \ - 'unregister' \ - 'version' - ret=0 - ;; - (home|info|init|link|lookup|prune|register|search|unregister) - _arguments \ - '(--help)--help[Show help message]' - ret=0 - ;; - install) - _arguments \ - '(--force-latest)--force-latest[Force latest version on conflict]' \ - '(--help)--help[Show help message]' \ - '(--production)--production[Do not install project devDependencies]' \ - '(--save)--save[Save installed packages into the project''s bower.json dependencies]' \ - '(--save-dev)--save-dev[Save installed packages into the project''s bower.json devDependencies]' - ret=0 - ;; - list) - _arguments \ - '(--help)--help[Show help message]' \ - '(--paths)--paths[Generate a simple JSON source mapping]' \ - '(--relative)--relative[Make paths relative to the directory config property, which defaults to bower_components]' - ret=0 - ;; - login) - _arguments \ - '(--help)--help[Show help message]' \ - '(-t --token)'{-t,--token}'[Pass GitHub auth token (will not prompt for username/password)]' - ret=0 - ;; - uninstall) - _arguments \ - '(--help)--help[Show help message]' \ - '(--save)--save[Save installed packages into th projects''s bower.json dependencies]' \ - '(--save-dev)--save-dev[Save installed packages into th projects''s bower.json devDependencies]' - ret=0 - ;; - update) - _arguments \ - '(--force-latest)--force-latest[Force latest version on conflict]' \ - '(--help)--help[Show help message]' \ - '(--production)--production[Do not install project devDependencies]' - ret=0 - ;; - version) - _arguments \ - '(--message)--message[Custom git commit and tag message]' - ret=0 - ;; - exec) - _normal && ret=0 - ;; - *) - _opts=( $(bower help $line[1] | sed -e '/^ \[-/!d; s/^ \[\(-[^=]*\)=.*/\1/') ) - _opts+=( $(bower help $line[1] | sed -e '/^ -/!d; s/^ \(-.\), \[\(-[^=]*\)=.*/\1 \2/') ) - if [[ $_opts != "" ]]; then - _values 'options' $_opts && ret=0 - fi - ;; - esac - ;; -esac - -return ret - -# Local Variables: -# mode: Shell-Script -# sh-indentation: 2 -# indent-tabs-mode: nil -# sh-basic-offset: 2 -# End: -# vim: ft=zsh sw=2 ts=2 et diff --git a/zsh/completion/_docker-compose b/zsh/completion/_docker-compose deleted file mode 100644 index b333f4d..0000000 --- a/zsh/completion/_docker-compose +++ /dev/null @@ -1,197 +0,0 @@ -#compdef docker-compose -# ------------------------------------------------------------------------------ -# Description -# ----------- -# -# Completion script for Docker Compose (http://docs.docker.com/compose/). -# Adapted from boot2docker completion by hhatto (https://github.com/hhatto) -# and docker completion by @aeonazaan and @bobmaerten. -# -# ------------------------------------------------------------------------------ -# Authors -# ------- -# -# * ilkka (https://github.com/ilkka) -# -# ------------------------------------------------------------------------------ - -# helper function for getting *.yml (compose) files -__yml_files_in_current_dir() { - _values 'YAML files' *.yml -} - -# helper function for completing services in current project -__services() { - declare -a services_cmd - services_cmd=($(sed -n -E 's/^([^[:space:]][^:]*):/\1/p' docker-compose.yml | tr \\n ' ')) - _describe 'services' services_cmd -} - -# subcommands -local -a _docker_compose_cmds - -_docker_compose_cmds=( - 'build:Build or rebuild services' \ - 'help:Get help on a command' \ - 'kill:Kill containers' \ - 'logs:View output from containers' \ - 'port:Print the public port for a port binding' \ - 'ps:List containers' \ - 'pull:Pulls service images' \ - 'rm:Remove stopped containers' \ - 'run:Run a one-off command' \ - 'scale:Set number of containers for a service' \ - 'start:Start services' \ - 'stop:Stop services' \ - 'restart:Restart services' \ - 'up:Create and start containers' -) - -# subcommand completion functions -__build() { - _arguments \ - '--no-cache[Do not use cache when building image]' - __services -} - -__help() { - _values 'Get help for subcommand' \ - 'build' \ - 'help' \ - 'kill' \ - 'logs' \ - 'port' \ - 'ps' \ - 'pull' \ - 'rm' \ - 'run' \ - 'scale' \ - 'start' \ - 'stop' \ - 'restart' \ - 'up' -} - -__kill() { - _arguments \ - '-s[Signal to send instead of SIGKILL]' - __services -} - -__logs() { - _arguments \ - '--no-color[Monochrome output]' - __services -} - -__port() { - _arguments \ - '--protocol:protocol:(tcp udp)' \ - '--index[Index of container]:index' - __services -} - -__ps() { - _arguments \ - '-q[Only display IDs]' - __services -} - -__pull() { - _arguments \ - '--allow-insecure-ssl[Allow insecure connections to the docker registry]' - __services -} - -__rm() { - _arguments \ - "--force[Don't ask for confirmation]" \ - '-v[Remove volumes]' - __services -} - -__run() { - _arguments \ - '--allow-insecure-ssl[Allow insecure connections to the docker registry]' \ - '-d[Detached mode: Run container in the background, print new container name.]' \ - '--entrypoint[Override the entrypoint of the image.]:command:()' \ - '-e[Set an environment variable.]:key=val:()' \ - "--no-deps[Don't start linked services.]" \ - '--rm[Remove container after run. Ignored in detached mode.]' \ - "--service-ports[Run command with the service's ports enabled and mapped to the host.]" \ - '-T[Disable pseudo-tty allocation.]' - __services -} - -__scale() { - __services -} - -__start() { - __services -} - -__stop() { - __services -} - -__restart() { - __services -} - -__up() { - _arguments \ - '--allow-insecure-ssl[Allow insecure connections to the docker registry]' \ - '-d[Detached mode: Run containers in the background, print new container names.]' \ - '--no-color[Produce monochrome output.]' \ - "--no-deps[Don't start linked services.]" \ - "--no-recreate[If containers already exist, don't recreate them.]" \ - "--no-build[Don't build an image, even if it's missing]" - __services -} - -# common args -_arguments \ - '--verbose[Show more output]' \ - '--version[Print version and exit]' \ - '--file[Specify an alternate compose file]:__yml_files_in_current_dir' \ - '--project-name[Specify an alternate project name]:args' \ - '*:: :->command' - -# start machines! -if (( CURRENT == 1 )); then - _describe -t commands 'docker-compose command' _docker_compose_cmds -fi - -local -a _command_args -case "$words[1]" in - build) - __build ;; - help) - __help ;; - kill) - __kill ;; - logs) - __logs ;; - port) - __port ;; - ps) - __ps ;; - pull) - __pull ;; - rm) - __rm ;; - run) - __run ;; - scale) - __scale ;; - start) - __start ;; - stop) - __stop ;; - restart) - __restart ;; - up) - __up ;; -esac - diff --git a/zsh/completion/_docker-machine b/zsh/completion/_docker-machine deleted file mode 100644 index cf1cfbe..0000000 --- a/zsh/completion/_docker-machine +++ /dev/null @@ -1,294 +0,0 @@ -#compdef docker-machine -# ------------------------------------------------------------------------------ -# Description -# ----------- -# -# Completion script for Docker Machine (http://docs.docker.com/machine/). -# Adapted from boot2docker completion by hhatto (https://github.com/hhatto) -# and docker completion by @aeonazaan and @bobmaerten. -# -# ------------------------------------------------------------------------------ -# Authors -# ------- -# -# * ilkka (https://github.com/ilkka) -# -# ------------------------------------------------------------------------------ - -# helper function for completing available machines -__machines() { - declare -a machines_cmd - machines_cmd=($(docker-machine ls|tail +2|awk '{print $1":"$3"("$4")"}')) - _describe 'machines' machines_cmd -} - -# subcommands -local -a _docker_machine_cmds - -_docker_machine_cmds=( - 'active:Get or set the active machine' \ - 'create:Create a machine' \ - 'config:Print the connection config for machine' \ - 'inspect:Inspect information about a machine' \ - 'ip:Get the IP address of a machine' \ - 'kill:Kill a machine' \ - 'ls:List machines' \ - 'restart:Restart a machine' \ - 'rm:Remove a machine' \ - 'env:Display the commands to set up the environment for the Docker client' \ - 'ssh:Log into or run a command on a machine with SSH' \ - 'start:Start a machine' \ - 'stop:Stop a machine' \ - 'upgrade:Upgrade a machine to the latest version of Docker' \ - 'url:Get the URL of a machine' \ - 'help:Shows a list of commands or help for one command' -) - -# subcommand completion functions -__active() { - __machines -} - -__help() { - _values 'Get help for subcommand' \ - 'active' \ - 'create' \ - 'config' \ - 'inspect' \ - 'ip' \ - 'kill' \ - 'ls' \ - 'restart' \ - 'rm' \ - 'env' \ - 'ssh' \ - 'start' \ - 'stop' \ - 'upgrade' \ - 'url' \ - 'help' -} - -__create() { - _arguments \ - '--amazonec2-access-key:AWS Access Key:()' \ - '--amazonec2-ami:AWS machine image:()' \ - '--amazonec2-instance-type:AWS instance type:()' \ - '--amazonec2-region:AWS region:()' \ - '--amazonec2-root-size:AWS root disk size (in GB):()' \ - '--amazonec2-secret-key:AWS Secret Key:()' \ - '--amazonec2-security-group:AWS VPC security group:()' \ - '--amazonec2-session-token:AWS Session Token:()' \ - '--amazonec2-subnet-id:AWS VPC subnet id:()' \ - '--amazonec2-vpc-id:AWS VPC id:()' \ - '--amazonec2-zone:AWS zone for instance (i.e. a,b,c,d,e):()' \ - '--azure-docker-port:Azure Docker port:()' \ - '--azure-image:Azure image name. Default is Ubuntu 14.04 LTS x64:()' \ - '--azure-location:Azure location:()' \ - '--azure-password:Azure user password:()' \ - '--azure-publish-settings-file:Azure publish settings file:()' \ - '--azure-size:Azure size:()' \ - '--azure-ssh-port:Azure SSH port:()' \ - '--azure-subscription-cert:Azure subscription cert:()' \ - '--azure-subscription-id:Azure subscription ID:()' \ - '--azure-username:Azure username:()' \ - '--digitalocean-access-token:Digital Ocean access token:()' \ - '--digitalocean-image:Digital Ocean Image:()' \ - '--digitalocean-region:Digital Ocean region:()' \ - '--digitalocean-size:Digital Ocean size:()' \ - '--google-disk-size:GCE Instance Disk Size (in GB):()' \ - '--google-machine-type:GCE Machine Type:()' \ - '--google-project:GCE Project:()' \ - '--google-scopes:GCE Scopes (comma-separated if multiple scopes):()' \ - '--google-username:GCE User Name:()' \ - '--google-zone:GCE Zone:()' \ - '--openstack-auth-url:OpenStack authentication URL:()' \ - '--openstack-endpoint-type:OpenStack endpoint type (adminURL, internalURL or publicURL):()' \ - '--openstack-flavor-id:OpenStack flavor id to use for the instance:()' \ - '--openstack-flavor-name:OpenStack flavor name to use for the instance:()' \ - '--openstack-floatingip-pool:OpenStack floating IP pool to get an IP from to assign to the instance:()' \ - '--openstack-image-id:OpenStack image id to use for the instance:()' \ - '--openstack-image-name:OpenStack image name to use for the instance:()' \ - '--openstack-net-id:OpenStack image name to use for the instance:()' \ - '--openstack-net-name:OpenStack network name the machine will be connected on:()' \ - '--openstack-password:OpenStack password:()' \ - '--openstack-region:OpenStack region name:()' \ - '--openstack-sec-groups:OpenStack comma separated security groups for the machine:()' \ - '--openstack-ssh-port:OpenStack SSH port:()' \ - '--openstack-ssh-user:OpenStack SSH user:()' \ - '--openstack-tenant-id:OpenStack tenant id:()' \ - '--openstack-tenant-name:OpenStack tenant name:()' \ - '--openstack-username:OpenStack username:()' \ - '--rackspace-api-key:Rackspace API key:()' \ - '--rackspace-docker-install:Set if docker have to be installed on the machine:()' \ - '--rackspace-endpoint-type:Rackspace endpoint type (adminURL, internalURL or the default publicURL):()' \ - '--rackspace-flavor-id:Rackspace flavor ID. Default: General Purpose 1GB:()' \ - '--rackspace-image-id:Rackspace image ID. Default: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM):()' \ - '--rackspace-region:Rackspace region name:()' \ - '--rackspace-ssh-port:SSH port for the newly booted machine. Set to 22 by default:()' \ - '--rackspace-ssh-user:SSH user for the newly booted machine. Set to root by default:()' \ - '--rackspace-username:Rackspace account username:()' \ - '--softlayer-api-endpoint:softlayer api endpoint to use:()' \ - '--softlayer-api-key:softlayer user API key:()' \ - "--softlayer-cpu:number of CPUs for the machine:()" \ - '--softlayer-disk-size:Disk size for machine, a value of 0 uses the default size on softlayer:()' \ - '--softlayer-domain:domain name for machine:()' \ - '--softlayer-hostname:hostname for the machine:()' \ - '--softlayer-hourly-billing:set hourly billing for machine - on by default:()' \ - '--softlayer-image:OS image for machine:()' \ - '--softlayer-local-disk:use machine local disk instead of softlayer SAN:()' \ - '--softlayer-memory:Memory in MB for machine:()' \ - '--softlayer-private-net-only:Use only private networking:()' \ - '--softlayer-region:softlayer region for machine:()' \ - '--softlayer-user:softlayer user account name:()' \ - '--url:URL of host when no driver is selected:()' \ - '--virtualbox-boot2docker-url:The URL of the boot2docker image. Defaults to the latest available version:()' \ - '--virtualbox-disk-size:Size of disk for host in MB:()' \ - '--virtualbox-memory:Size of memory for host in MB:()' \ - '--vmwarefusion-boot2docker-url:Fusion URL for boot2docker image:()' \ - '--vmwarefusion-disk-size:Fusion size of disk for host VM (in MB):()' \ - '--vmwarefusion-memory-size:Fusion size of memory for host VM (in MB):()' \ - '--vmwarevcloudair-catalog:vCloud Air Catalog (default is Public Catalog):()' \ - '--vmwarevcloudair-catalogitem:vCloud Air Catalog Item (default is Ubuntu Precise):()' \ - '--vmwarevcloudair-computeid:vCloud Air Compute ID (if using Dedicated Cloud):()' \ - '--vmwarevcloudair-cpu-count:vCloud Air VM Cpu Count (default 1):()' \ - '--vmwarevcloudair-docker-port:vCloud Air Docker port:()' \ - '--vmwarevcloudair-edgegateway:vCloud Air Org Edge Gateway (Default is ):()' \ - '--vmwarevcloudair-memory-size:vCloud Air VM Memory Size in MB (default 2048):()' \ - '--vmwarevcloudair-orgvdcnetwork:vCloud Air Org VDC Network (Default is -default-routed):()' \ - '--vmwarevcloudair-password:vCloud Air password:()' \ - '--vmwarevcloudair-provision:vCloud Air Install Docker binaries (default is true):()' \ - '--vmwarevcloudair-publicip:vCloud Air Org Public IP to use:()' \ - '--vmwarevcloudair-ssh-port:vCloud Air SSH port:()' \ - '--vmwarevcloudair-username:vCloud Air username:()' \ - '--vmwarevcloudair-vdcid:vCloud Air VDC ID:()' \ - '--vmwarevsphere-boot2docker-url:vSphere URL for boot2docker image:()' \ - '--vmwarevsphere-compute-ip:vSphere compute host IP where the docker VM will be instantiated:()' \ - '--vmwarevsphere-cpu-count:vSphere CPU number for docker VM:()' \ - '--vmwarevsphere-datacenter:vSphere datacenter for docker VM:()' \ - '--vmwarevsphere-datastore:vSphere datastore for docker VM:()' \ - '--vmwarevsphere-disk-size:vSphere size of disk for docker VM (in MB):()' \ - '--vmwarevsphere-memory-size:vSphere size of memory for docker VM (in MB):()' \ - '--vmwarevsphere-network:vSphere network where the docker VM will be attached:()' \ - '--vmwarevsphere-password:vSphere password:()' \ - '--vmwarevsphere-pool:vSphere resource pool for docker VM:()' \ - '--vmwarevsphere-username:vSphere username:()' \ - '--vmwarevsphere-vcenter:vSphere IP/hostname for vCenter:()' \ - '--driver:Driver to create machine with.:(amazonec2 azure digitalocean google none openstack rackspace softlayer virtualbox vmwarefusion vmwarevcloudair vmwarevsphere)' \ - '--swarm:Configure Machine with Swarm:()' \ - '--swarm-master:Configure Machine to be a Swarm master:()' \ - '--swarm-discovery:Discovery service to use with Swarm:()' \ - '--swarm-host:ip/socket to listen on for Swarm master:()' \ - '--swarm-addr:addr to advertise for Swarm (default: detect and use the machine IP):()' -} - -__config() { - _arguments \ - '--swarm[Display the Swarm config instead of the Docker daemon]' - __machines -} - -__inspect() { - __machines -} - -__ip() { - __machines -} - -__env() { - _arguments \ - '--unset[Unset variables instead of setting them]' \ - '--swarm[Display the Swarm config instead of the Docker daemon]' - __machines -} - -__kill() { - __machines -} - -__ls() { - _arguments \ - '--quiet[Enable quiet mode]' -} - -__restart() { - __machines -} - -__start() { - __machines -} - -__stop() { - __machines -} - -__rm() { - __machines -} - -__ssh() { - __machines -} - -__upgrade() { - __machines -} - -__url() { - __machines -} - -# common args -_arguments \ - '--debug[Enable debug mode]' \ - '--storage-path[Configures storage path]:_files' \ - '--tls-ca-cert[CA to verify remotes against]:_files' \ - '--tls-ca-key[Private key to generate certificates]:_files' \ - '--tls-client-cert[Client cert to use for TLS]:_files' \ - '--tls-client-key[Private key used in client TLS auth]:_files' \ - '--help[show help]' \ - '--version[print the version]' \ - '*:: :->command' - -# start machines! -if (( CURRENT == 1 )); then - _describe -t commands 'docker-machine command' _docker_machine_cmds -fi - -local -a _command_args -case "$words[1]" in - active) - __active ;; - create) - __create ;; - config) - __config ;; - inspect) - __inspect ;; - ip) - __ip ;; - kill) - __kill ;; - ls) - __ls ;; - restart) - __restart ;; - rm) - __rm ;; - env) - __env ;; - ssh) - __ssh ;; - start) - __start ;; - stop) - __stop ;; - upgrade) - __upgrade ;; - url) - __url ;; - help) - __help ;; -esac diff --git a/zsh/completion/_rvm b/zsh/completion/_rvm deleted file mode 100644 index 2a600e7..0000000 --- a/zsh/completion/_rvm +++ /dev/null @@ -1,127 +0,0 @@ -#compdef rvm -# ------------------------------------------------------------------------------ -# Description -# ----------- -# -# Completion script for rvm (https://rvm.beginrescueend.com/). -# -# Source: https://github.com/wayneeseguin/rvm/blob/master/scripts/zsh/Completion/_rvm -# -# ------------------------------------------------------------------------------ -# Authors -# ------- -# -# * Bruno Michel (https://github.com/nono) -# -# ------------------------------------------------------------------------------ - -local curcontext="$curcontext" state line cmds ret=1 - -_arguments -C \ - '(- 1 *)'{-v,--version}'[display version information]' \ - '(-l --level)'{-l,--level}'+[patch level to use with rvm use / install]:number' \ - '--bin[path for binaries to be placed (~/.rvm/bin/)]:path:_files' \ - '--source[src directory to use (~/.rvm/src/)]:path:_files' \ - '--archives[directory for downloaded files (~/.rvm/archives/)]:path:_files' \ - '-S[Specify a script file to attempt to load and run (rubydo)]:file:_files' \ - '-e[Execute code from the command line]:code' \ - '-G[root gem path to use]:path:_files' \ - '--gems[Used to set the gems_flag, use with remove to remove gems]' \ - '--archive[Used to set the archive_flag, use with remove to remove archive]' \ - '--patch[With MRI Rubies you may specify one or more full paths to patches]:paths:->patches' \ - '(-C --configure)'{-C,--configure}'=[custom configure options]' \ - '--nice[process niceness (for slow computers, default 0)]:number' \ - '--ree-options[Options passed directly to ree ./installer on the command line]:options' \ - '--head[with update, updates rvm to git head version]' \ - '--rubygems[with update, updates rubygems for selected ruby]' \ - '--default[with ruby select, sets a default ruby for new shells]' \ - '--debug[Toggle debug mode on for very verbose output]' \ - '--trace[Toggle trace mode on to see EVERYTHING rvm is doing]' \ - '--force[Force install, even given ruby is already install]' \ - '--summary[Used with rubydo to print out a summary of the commands run]' \ - '--latest[with gemset --dump skips version strings for latest gem]' \ - '--gems[with uninstall/remove removes gems with the interpreter]' \ - '--docs[with install, attempt to generate ri after installation]' \ - '--reconfigure[Force ./configure on install even if Makefile already exists]' \ - '1: :->cmds' \ - '*: :->args' && ret=0 - -case $state in - - patches) - compset -P '*,' - compset -S ',*' - _files -q -S , - ;; - - cmds) - - cmds=( ${(f)"$(_call_program commands rvm help 2> /dev/null | __rvm_sed -e '/^== Action/,/^== Implementation/!d; / :: /!d; s/^[ *]*\([^ ]*\) *:: *\(.*\)/\1:\2/')"} ) - cmds+=( $(rvm list strings) ) - _describe -t commands 'rvm command' cmds && ret=0 - ;; - - args) - - case $line[1] in - - (use|uninstall|remove|list) - - if (( CURRENT == 3 )); then - # See if we’ve made it to the ‘@’; eg, 1.9.2@ - if ! __rvm_grep '@' <<< "${line[CURRENT-1]}" >/dev/null ; then - _values -S , 'rubies' \ - $(rvm list strings | __rvm_sed -e 's/ruby-\([^) ]*\)-\([^) ]*\)/ruby-\1-\2 \1-\2 \1/g') \ - default system $(rvm alias list names) && ret=0 - else - # Construct a full version string for each of the gemsets. - # Eg, 1.9.2@min 1.9.2@rail3 … - _values -S , 'gemsets' \ - $(rvm ${line[CURRENT-1]%%@*} gemset list | __rvm_awk '/^[ -_[:alnum:]]+$/ {print "'${line[CURRENT-1]%%@*}'@"$1}') - fi - fi - ;; - - (install|fetch) - - _values -S , 'rubies' $(rvm list known_strings) && ret=0 - ;; - - gemset) - - if (( CURRENT == 3 )); then - _values 'gemset_commands' $(rvm gemset help | __rvm_sed -e '/create/!d; s/^.*[{]\(.*\)[}].*$/\1/; s/,/ /g') - else - #_values -S , 'gemsets' $(rvm gemset list | __rvm_grep -v gemset 2>/dev/null) - _values -S , 'gemsets' $(rvm gemset list | __rvm_grep -Ev '(gemset|info)' 2>/dev/null | __rvm_awk '/^[ -_[:alnum:]]+$/ {print '$1'}') - fi - ret=0 - ;; - - package) - - if (( CURRENT == 3 )); then - _values 'package_commands' $(rvm package | __rvm_sed -e '/Usage/!d; s/^.*[{]\(.*\)[}] [{].*$/\1/; s/,/ /g') - else - _values 'packages' $(rvm package | __rvm_sed -e '/Usage/!d; s/^.*[}] [{]\(.*\)[}].*$/\1/; s/,/ /g') - fi - ret=0 - ;; - - *) - (( ret )) && _message 'no more arguments' - ;; - - esac - ;; -esac - -return ret - -# Local Variables: -# mode: Shell-Script -# sh-indentation: 2 -# indent-tabs-mode: nil -# sh-basic-offset: 2 -# End: -# vim: ft=zsh sw=2 ts=2 et diff --git a/zsh/themes/peepcode.theme b/zsh/themes/peepcode.theme index 94ae421..0479452 100644 --- a/zsh/themes/peepcode.theme +++ b/zsh/themes/peepcode.theme @@ -52,6 +52,9 @@ PROMPT=' %~ ${smiley} %{$reset_color%}' -RPROMPT='%{$fg[white]%} $(~/.rvm/bin/rvm-prompt)$(git_prompt)%{$reset_color%}' +mise_ruby() { command -v mise > /dev/null && mise current ruby 2>/dev/null | sed 's/^/ruby-/'; } +mise_node() { command -v mise > /dev/null && mise current node 2>/dev/null | sed 's/^/node-/'; } + +RPROMPT='%{$fg[white]%} $(mise_ruby) $(mise_node)$(git_prompt)%{$reset_color%}' # vi: set ft=zsh : diff --git a/zshenv b/zshenv index e149831..d498b85 100644 --- a/zshenv +++ b/zshenv @@ -8,7 +8,7 @@ export CC_GOOD_COMMAND="☻" export CC_BAD_COMMAND="☻" # ensure dotfiles bin directory is loaded first -export PATH="$HOME/.bin:/usr/local/sbin:$PATH" +export PATH="$HOME/.local/bin:$HOME/.bin:/usr/local/sbin:$PATH" # Local config [[ -f ~/.zshenv.local ]] && source ~/.zshenv.local diff --git a/zshrc b/zshrc index 81fd3d0..f86502e 100644 --- a/zshrc +++ b/zshrc @@ -22,8 +22,8 @@ export CLICOLOR=1 # history settings setopt hist_ignore_all_dups inc_append_history HISTFILE=~/.zhistory -HISTSIZE=4096 -SAVEHIST=4096 +HISTSIZE=50000 +SAVEHIST=50000 # awesome cd movements from zshkit setopt autocd autopushd pushdminus pushdsilent pushdtohome cdablevars @@ -56,8 +56,10 @@ set -o nobeep # no annoying beeps [[ -f ~/.aliases ]] && source ~/.aliases # Zsh syntax highlight -source ~/.zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -TERM=screen-256color +[[ -f ~/.zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]] && source ~/.zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +if [[ "$(uname)" == "Linux" ]]; then + TERM=screen-256color +fi # Local config [[ -f ~/.zshrc.local ]] && source ~/.zshrc.local @@ -70,8 +72,5 @@ source ~/.zsh/themes/peepcode.theme setopt interactivecomments -# Load RVM into a shell session *as a function* -[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" - -# Add RVM to PATH for scripting. Make sure this is the last PATH variable change. -export PATH="$PATH:$HOME/.rvm/bin" +# Load mise (Ruby, Node.js version manager) +[[ -f ~/.local/bin/mise ]] && eval "$(~/.local/bin/mise activate zsh)"