Skip to content

๐Ÿ› ๏ธ Simple & Extensible Dotfile Manager That Unifies Your Terminal Operations โ›“๏ธ

License

Notifications You must be signed in to change notification settings

ivaquero/oxidizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Oxidizer

CI license code size repo size

A Simple & Extensible Dotfile Manager That Unifies Your Terminal Operations

ไธ€ไธช็ฎ€ๅ• & ๅฏๆ‰ฉๅฑ•็š„๏ผŒ็”จไบŽ็ปŸไธ€็ปˆ็ซฏๆ“ไฝœ็š„ dotfile ็ฎก็†ๅทฅๅ…ท

oxidizer

1. Get Started ไปŽ่ฟ™้‡Œๅผ€ๅง‹

For macOS / Linux (Intel)

export OXIDIZER=$HOME/oxidizer
git clone --depth=1 https://github.com/ivaquero/oxidizer.git $OXIDIZER && bash oxidizer/install.sh

Note that Homebrew is an essential dependency for Oxidizer on macOS / Linux.

  • ๅฏนไธญๅ›ฝๅคง้™†็”จๆˆท๏ผŒๅฏ่ฎพ็ฝฎ BREW_CN ๅ˜้‡ๆฅไธ‹่ฝฝๅฎ‰่ฃ… Homebrew๏ผš
export BREW_CN=1

For Windows

$env:OXIDIZER = "$HOME\oxidizer"
git clone --depth=1 https://github.com/ivaquero/oxidizer.git $env:OXIDIZER; . oxidizer\install.ps1
  • ๅฏนไธญๅ›ฝๅคง้™†็”จๆˆท๏ผŒๅฏ่ฎพ็ฝฎ SCOOP_CN ๅ˜้‡ๆฅไธ‹่ฝฝๅฎ‰่ฃ…
$env:scoop_mirror = 1

For Cmderrs, you need to remove the -Options ReadOnly from Set-Item -Path function:\prompt -Value $Prompt -Options ReadOnly in the last line of %CMDER_ROOT%\vendor\profile.ps1.

ๅฏนไบŽ Cmder ็”จๆˆท๏ผŒไฝ ้œ€่ฆๅˆ ้™ค%CMDER_ROOT%\vendor\profile.ps1็š„ๆœ€ๅŽไธ€่กŒSet-Item -Path function:\prompt -Value $Prompt -Options ReadOnlyไธญ็š„-Options ReadOnlyใ€‚

After installation, you might personalize your preference in custom.sh, check defaults.sh. Open custom.sh | custom.ps1 by following command

ๅฎ‰่ฃ…ไน‹ๅŽ๏ผŒๆ‚จๅฏไปฅๅœจcustom.shไธญไธชๆ€งๅŒ–ๆ‚จ็š„็ณป็ปŸ็Žฏๅขƒ๏ผˆ่ฏทๅ‚่€ƒdefaults.sh๏ผŒ้€š่ฟ‡ไธ€ไธ‹ๅ‘ฝไปคๆ‰“ๅผ€

edf ox

To keep up the updates, simply upox function.

ๅฏไฝฟ็”จ upox ๅ‘ฝไปคๆฅๆ›ดๆ–ฐ Oxidizer

2. Motivation ๅŠจๆœบ

Oxidizer ็š„ไธป่ฆ็›ฎๆ ‡

Oxidizer is originally designed for non-administrator users. It saves your time from repetitive and tedious setups of coding environments, and it aims to provide with following features:

  • Cross-Platform (mainly Rust toolchains)
  • Minimal Dependencies & Minimal Installation
  • Extensible Architecture
  • Unified Interface & Smooth Usage
  • Super-Fast! (loading time < 1 s)

Oxidizer ่ตทๅˆไธป่ฆไธบ้ž็ฎก็†ๅ‘˜็”จๆˆท่ฎพ่ฎก๏ผŒ็”จไบŽๅฟซ้€Ÿๆญๅปบ่ทจๅนณๅฐ็ปŸไธ€็š„ๅทฅไฝœ็Žฏๅขƒ๏ผŒ้ฟๅ…้‡ๅคๅ’Œ็น็็š„็Žฏๅขƒ้…็ฝฎๅŠณๅŠจ๏ผŒๅ…ถๅ…ทๆœ‰็‰น็‚น

  • ่ทจๅนณๅฐ๏ผˆไธป่ฆๅŸบไบŽ Rust ๅทฅๅ…ท้“พ๏ผ‰
  • ๆœ€ๅฐ‘ไพ่ต– & ๆœ€ๅฐ‘ๅฎ‰่ฃ…
  • ๅฏๆ‰ฉๅฑ•ๆžถๆž„
  • ็ปŸไธ€ๆŽฅๅฃ & ไธๆป‘ๆ“ไฝœ
  • ่ถ…็บงๅฟซ๏ผ๏ผˆ่ฝฝๅ…ฅๆ—ถ้—ด < 1 ็ง’๏ผ‰

3. Tool Chains ๅทฅๅ…ท้“พ

3.1. CLI Tools Replacement

โ˜‘๏ธ means required in the installation.

3.2. GUI Tools Replacement

WezTerm is more recommended because it has a built-in multiplexer.

3.3. Otherful Rust Tools

  • onefetch: Command-line Git information tool
  • ouch: Painless compression and decompression tool
  • kondo: A tool to clean dependencies and build artefacts from your projects

3.4. Summary of Plugins

Oxidizer is designed to be extensible, you can personalize plugin_load in config.json to load the plugins by your need.

Of course, you are allowed to write your own plugins, see Writing A Plugin for details.

The plugins are hosted in oxplugins as well as oxplugins-powershell.

ๆ’ไปถไฝไบŽ oxplugins ๅ’Œ oxplugins-powershell

To load a plugin, simply add its abbreviation into the OX_PLUGINS array of ~/oxidizer/config.json, like

{
    "plugin_load": [
        "cli_espanso",
        "cli_jupyter",
        "cli_ollama",
        "cli_vscode",
        "lang_julia",
        "lang_ruby",
        "lang_rust",
        "pkg_conda",
        "pkg_npm",
        "pkg_tlmgr"
    ]
}
Filename Category Support
os_macos OS Shortcuts macOS
os_debians OS Shortcuts Debian-Based Systems
os_redhat OS Shortcuts RedHat-Based Systems
os_windows OS Shortcuts Windows (include winget)
pkg_brew Package Manager Homebrew (macOS & Linux)
pkg_scoop Package Manager Scoop (Windows)
pkg_conda Package Manager Conda (Multi-Languages)
pkg_npm Package Manager NPM + PNPM (JavaScript)
pkg_pixi Package Manager Pixi (Multi-Languages)
pkg_tlmgr Package Manager tlmgr (TeXLive)
cli_bitwarden App CLI Bitwarden
cli_espanso App CLI Espanso
cli_jupyter App CLI Jupyter (notebook, lab, book)
cli_ollama App CLI Ollama
cli_vscode App CLI VSCode
lang_julia Language Julia
lang_ruby Language Ruby (include gem)
lang_rust Language Rust (include cargo, rustup)
utils_files System Utils File Operation
utils_formats System Utils Formats Conversion
utils_networks.sh System Utils Network Configuration
xtra_notes Extra Utils Notes Apps (Obsidian & Logseq)

4. File Management ๆ–‡ไปถ็ฎก็†

design

  • rff
    • refresh file by source
  • edf
    • edit file by $EDITOR (default: VSCode)
  • brf
    • file: browse by bat / cat
    • folder: browse by lsd / ls
  • ipf (import file, alias: rdf)
    • reduce file: overwrite configuration file by backup (customized) file
  • epf (export file, alias: oxf)
    • oxidize file: backup configuration file to backup folder
  • iif (initialize file, alias: clzf)
    • catalyze file: overwrite configuration file by Oxidizer defaults
  • ppgf
    • propagate file: backup Oxidizer defaults to backup folder

For example, if you want to edit ~/.zshrc, you can type edf zs.

When you epf zs (export file), ~/.zshrc will be copied and save in folder backup folder

As mentioned in Get Started, you can open custom.json simply by edf jox.

In the custom.json, edit the oxides map to predefine the specific backup path, where oxide_folder is the backup root path relative to $HOME. Note that the key should be set as bk + [key in OX_ELEMENT].

{
 "oxide_folder": "Documents",
 "oxides": {
        "bkox": "shell/custom.sh",
        "bkoxw": "shell/custom.ps1",
        "bkoxj": "shell/custom.json",
        "bkb": "unix/Brewfile",
        "bkvi": "shell/.vimrc",
        "bkss": "shell/starship.toml",
        "bkg": "../notes/.gitconfig",
        "bkzs": "shell/.zshrc",
        "bkbs": "shell/.bash_profile"
    }
}

The table below lists the information of specific configuration files:

_ denotes a folder, and you can check these abbreviations closely by brf [Plugin Abbr.] | edf [Plugin Abbr.].

Oxidizer uses ouch to deal with compression and decompression, and provides with 3 shortcuts

  • zpf: compress file
  • zpfr: decompress file
  • zpfls: list items in the compressed file

6. Package Management ๅŒ…็ฎก็†

Oxidizer aims to provide a unified interface for all package manager-related commands to reduce typing and memory burden of command-liners.

Suffix Action brew b scoop s conda c npm n cargo cg rustup rs julia jl pixi px gem rb tlmgr tl
*h help โœ… โœ… โœ… โœ… โœ… โœ… โœ… โœ… โœ…
*cf config โœ… โœ… โœ… โœ…
*is install โœ… โœ… โœ… โœ… โœ… โœ… โœ… โœ… โœ… โœ…
*us uninstall โœ… โœ… โœ… โœ… โœ… โœ… โœ… โœ… โœ… โœ…
*up update โœ… โœ… โœ… โœ… โœ… โœ… โœ… โœ… โœ… โœ…
*ups update self โœ… โœ… โœ…
*ls list โœ… โœ… โœ… โœ… โœ… โœ… โœ… โœ… โœ… โœ…
*lv leaves โœ… โœ… โœ… โœ… โœ… โœ… โœ…
*sc search โœ… โœ… โœ… โœ… โœ… โœ… โœ…
*cl clean โœ… โœ… โœ… โœ… โœ… โœ… โœ… โœ…
*if info โœ… โœ… โœ… โœ… โœ… โœ…
*st status โœ… โœ… โœ… โœ…
*ck check โœ… โœ… โœ… โœ… โœ… โœ… โœ… โœ…
*pn pin โœ… โœ… โœ…
*upn unpin โœ… โœ… โœ…
*dp depends โœ… โœ… โœ… โœ… โœ… โœ…
*dpr needs โœ… โœ…
*xa add repo โœ… โœ… โœ…
*xrm remove repo โœ… โœ… โœ…
*xls list repo โœ…

Some package managers also have functionality of project management

Suffix Action brew b scoop s conda c npm n cargo cg rustup rs julia jl pixi px gem rb
*ii init โœ… โœ… โœ… โœ…
*cr create โœ… โœ… โœ… โœ…
*b build โœ… โœ… โœ…
*r run โœ… โœ… โœ… โœ… โœ… โœ…
*ed edit โœ…
*ct cat โœ… โœ… โœ…
*ln link โœ…
*ts test โœ… โœ… โœ… โœ…
*au audit โœ… โœ…
*fx fix โœ… โœ… โœ…
*pb publish โœ… โœ…

Some of the package managers shortcuts are included in corresponding system plugins.

  • ox-os-macos: auto-loaded, contains alias and functions for mas
  • ox-os-debians: auto-loaded, contains alias and functions for apt
  • ox-os-windows: auto-loaded, contains alias and functions for winget and wsl
Suffix Action mas m apt a winget w wsl wl
*h help โœ… โœ… โœ… โœ…
*is install โœ… โœ… โœ… โœ…
*us uninstall โœ… โœ… โœ… โœ…
*up update โœ… โœ… โœ… โœ…
*ups update self โœ… โœ… โœ…
*ls list โœ… โœ… โœ…
*lv leaves
*sc search โœ… โœ…
*cl clean โœ… โœ… โœ…
*if info โœ… โœ… โœ…
*st status โœ…
*ck check โœ…
*dp depends โœ…
*xa add repo โœ… โœ…
*xrm remove repo โœ… โœ…
*xls list repo โœ… โœ…

6.1. Homebrew

  • bis: brew install
  • bris: brew reinstall

suffix c is a flag to specify brew commands only work on casks

  • bisc: brew install --cask

  • brisc: brew reinstall --cask

  • bupc: brew upgrade --cask

  • brp [cask]: replace brew cache file by pre-downloaded file

6.2. Conda

Note that some shortcuts of the ox-conda plugin is based on the package conda-tree that you need to install

conda install -c conda-forge conda-tree

Besides the shortcuts mentioned above in Package Management, the conda plugin also provides with Conda environment management shortcuts which start with ce

  • ceat: activate environment
    • $1 length = 0: activate base env
    • $1 length = 1 | 2: activate predefined env OX_CONDA_ENV
    • $1 length > 2: activate new env

OX_CONDA_ENV can be personalized in custom.sh

For example, assume your environment's name is hello, you can set

# macOS / Linux
OX_CONDA_ENV[h]="hello"
# Windows
$Global:OX_CONDA_ENV.h = "hello"

then, you will be able to manipulate the environment by

# create environment
cecr h
# remove environment
cerm h
# update all packages in the specific environment
cup h
# list all packages in the specific environment
cls h
  • cerat: reactivate environment, works live ceat
  • ceq: quit environment (q is for kill/quit)
  • cecr: create
  • cerm: remove environment, works live ceat but won't remove base env
  • cels: environment list
  • cedf: compare packages between conda environments
  • cern: renames an existing environment
  • cesd: change environment's conda-forge subdir
    • i: for osx-64 | linux-64 | win-64
    • a: for osx-arm64 | linux-aarch64 | win-arm64
    • p: for ppc64le
    • s: for linux-s390x
  • ceep: export environment

5. Software Information Management

back_* and up_* work for brew, scoop, conda, vscode (only for windows), julia, tlmgr, npm. clean_* works for brew and conda.

  • back_*
    • file: export package/extension info into $OX_BACKUP folder
  • up_*
    • file: install packages/extensions by predefined files in $OX_BACKUP
  • clean_*
    • file: clean package/extension info by predefined files in $OX_BACKUP folder

7. Project Management ๅทฅ็จ‹็ฎก็†

7.1. Git

  • gclhs: delete commit history

for aliases, check .gitconfig in defaults folder by edf oxg

8. Further Reading

9. Credits ่‡ด่ฐข

10. License ่ฎธๅฏ

This work is released under the GPL-v3 license.

่ฟ™ไธช้กน็›ฎๅœจ GPL-v3 ่ฎธๅฏไธ‹ๅ‘ๅธƒ

About

๐Ÿ› ๏ธ Simple & Extensible Dotfile Manager That Unifies Your Terminal Operations โ›“๏ธ

Topics

Resources

License

Stars

Watchers

Forks