Skip to content

Instantly share code, notes, and snippets.

@jarrodldavis
Last active December 31, 2021 10:00
Show Gist options
  • Save jarrodldavis/928c90036273a557848f4c73d5d4e701 to your computer and use it in GitHub Desktop.
Save jarrodldavis/928c90036273a557848f4c73d5d4e701 to your computer and use it in GitHub Desktop.

Revisions

  1. jarrodldavis revised this gist Jun 16, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vscode-devcontainer.sh
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@ ln -sf /opt/diff-so-fancy/diff-so-fancy /usr/local/bin
    cp ~/.dotfiles/zshrc ~/.zshrc
    cp ~/.dotfiles/zprofile ~/.zprofile
    cp ~/.dotfiles/starship.toml ~/.starship.toml
    sed -i "s/export EDITOR='vim'/export EDITOR='code --wait'/"
    sed -i "s/export EDITOR='vim'/export EDITOR='code --wait'/" ~/.zshrc

    # Set EDITOR to Visual Studio Code

  2. jarrodldavis revised this gist Jun 16, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vscode-devcontainer.sh
    Original file line number Diff line number Diff line change
    @@ -43,6 +43,7 @@ ln -sf /opt/diff-so-fancy/diff-so-fancy /usr/local/bin
    cp ~/.dotfiles/zshrc ~/.zshrc
    cp ~/.dotfiles/zprofile ~/.zprofile
    cp ~/.dotfiles/starship.toml ~/.starship.toml
    sed -i "s/export EDITOR='vim'/export EDITOR='code --wait'/"

    # Set EDITOR to Visual Studio Code

  3. jarrodldavis revised this gist Jun 16, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vscode-devcontainer.sh
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,7 @@ curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh
    rm /tmp/common-setup.sh

    ## Install Live Share prerequisites
    curl -fsSL https://raw.githubusercontent.com/MicrosoftDocs/live-share/blob/master/scripts/linux-prereqs.sh | bash
    curl -fsSL https://raw.githubusercontent.com/MicrosoftDocs/live-share/master/scripts/linux-prereqs.sh | bash

    # Install hub
    apt-get -y install hub
  4. jarrodldavis revised this gist Jun 16, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vscode-devcontainer.sh
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@ apt-get update
    export DEBIAN_FRONTEND=noninteractive

    # Install man
    apt-get install man-db
    apt-get -y install man-db

    # Verify git, common tools / libs installed, add/modify non-root user, optionally install zsh
    apt-get -y install --no-install-recommends curl ca-certificates 2>&1
  5. jarrodldavis revised this gist Jun 16, 2020. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions vscode-devcontainer.sh
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@ apt-get update
    export DEBIAN_FRONTEND=noninteractive

    # Install man
    apt-get -y install man-db
    apt-get install man-db

    # Verify git, common tools / libs installed, add/modify non-root user, optionally install zsh
    apt-get -y install --no-install-recommends curl ca-certificates 2>&1
    @@ -26,7 +26,7 @@ curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh
    rm /tmp/common-setup.sh

    ## Install Live Share prerequisites
    curl -fsSL https://github.com/MicrosoftDocs/live-share/blob/master/scripts/linux-prereqs.sh | bash
    curl -fsSL https://raw.githubusercontent.com/MicrosoftDocs/live-share/blob/master/scripts/linux-prereqs.sh | bash

    # Install hub
    apt-get -y install hub
    @@ -44,6 +44,8 @@ cp ~/.dotfiles/zshrc ~/.zshrc
    cp ~/.dotfiles/zprofile ~/.zprofile
    cp ~/.dotfiles/starship.toml ~/.starship.toml

    # Set EDITOR to Visual Studio Code

    # Clean up
    apt-get autoremove -y
    apt-get clean -y
  6. jarrodldavis revised this gist Jun 16, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vscode-devcontainer.sh
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@ apt-get -y install man-db

    # Verify git, common tools / libs installed, add/modify non-root user, optionally install zsh
    apt-get -y install --no-install-recommends curl ca-certificates 2>&1
    # curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh
    curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh
    ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/common-setup.sh" | sha256sum -c -))
    /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}"
    rm /tmp/common-setup.sh
  7. jarrodldavis revised this gist Jun 16, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vscode-devcontainer.sh
    Original file line number Diff line number Diff line change
    @@ -40,7 +40,7 @@ curl -fsSL https://github.com/so-fancy/diff-so-fancy/archive/v1.3.0.tar.gz | tar
    ln -sf /opt/diff-so-fancy/diff-so-fancy /usr/local/bin

    # Copy configs
    # cp ~/.dotfiles/zshrc ~/.zshrc
    cp ~/.dotfiles/zshrc ~/.zshrc
    cp ~/.dotfiles/zprofile ~/.zprofile
    cp ~/.dotfiles/starship.toml ~/.starship.toml

  8. jarrodldavis revised this gist Jun 16, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions vscode-devcontainer.sh
    Original file line number Diff line number Diff line change
    @@ -16,11 +16,11 @@ apt-get update
    export DEBIAN_FRONTEND=noninteractive

    # Install man
    apt-get install man-db
    apt-get -y install man-db

    # Verify git, common tools / libs installed, add/modify non-root user, optionally install zsh
    apt-get -y install --no-install-recommends curl ca-certificates 2>&1
    curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh
    # curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh
    ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/common-setup.sh" | sha256sum -c -))
    /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}"
    rm /tmp/common-setup.sh
  9. jarrodldavis revised this gist Jun 16, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vscode-devcontainer.sh
    Original file line number Diff line number Diff line change
    @@ -40,7 +40,7 @@ curl -fsSL https://github.com/so-fancy/diff-so-fancy/archive/v1.3.0.tar.gz | tar
    ln -sf /opt/diff-so-fancy/diff-so-fancy /usr/local/bin

    # Copy configs
    cp ~/.dotfiles/zshrc ~/.zshrc
    # cp ~/.dotfiles/zshrc ~/.zshrc
    cp ~/.dotfiles/zprofile ~/.zprofile
    cp ~/.dotfiles/starship.toml ~/.starship.toml

  10. jarrodldavis revised this gist Jun 16, 2020. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion vscode-devcontainer.sh
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,9 @@ COMMON_SCRIPT_SHA="da956c699ebef75d3d37d50569b5fbd75d6363e90b3f5d228807cff1f7fa2
    apt-get update
    export DEBIAN_FRONTEND=noninteractive

    # Install man
    apt-get install man-db

    # Verify git, common tools / libs installed, add/modify non-root user, optionally install zsh
    apt-get -y install --no-install-recommends curl ca-certificates 2>&1
    curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh
    @@ -44,4 +47,4 @@ cp ~/.dotfiles/starship.toml ~/.starship.toml
    # Clean up
    apt-get autoremove -y
    apt-get clean -y
    rm -rf /var/lib/apt/lists/*
    rm -rf /var/lib/apt/lists/*
  11. jarrodldavis revised this gist Jun 16, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vscode-devcontainer.sh
    Original file line number Diff line number Diff line change
    @@ -34,7 +34,7 @@ curl -fsSL https://starship.rs/install.sh | bash -s -- --yes
    # Install diff-so-fancy
    mkdir -p /opt/diff-so-fancy/
    curl -fsSL https://github.com/so-fancy/diff-so-fancy/archive/v1.3.0.tar.gz | tar -xz -C /opt/diff-so-fancy --strip-components=1
    ln -s /opt/diff-so-fancy/diff-so-fancy /usr/local/bin
    ln -sf /opt/diff-so-fancy/diff-so-fancy /usr/local/bin

    # Copy configs
    cp ~/.dotfiles/zshrc ~/.zshrc
  12. jarrodldavis revised this gist Jun 16, 2020. 1 changed file with 33 additions and 35 deletions.
    68 changes: 33 additions & 35 deletions vscode-devcontainer.sh
    Original file line number Diff line number Diff line change
    @@ -12,38 +12,36 @@ COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-con
    COMMON_SCRIPT_SHA="da956c699ebef75d3d37d50569b5fbd75d6363e90b3f5d228807cff1f7fa211c"

    # Configure apt and install packages
    apt-get update \
    && export DEBIAN_FRONTEND=noninteractive \
    #
    # Verify git, common tools / libs installed, add/modify non-root user, optionally install zsh
    && apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \
    && curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh \
    && ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/common-setup.sh" | sha256sum -c -)) \
    && /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
    && rm /tmp/common-setup.sh \
    #
    ## Install Live Share prerequisites
    && curl -fsSL https://github.com/MicrosoftDocs/live-share/blob/master/scripts/linux-prereqs.sh | bash \
    #
    # Install hub
    && apt-get -y install hub \
    #
    # Install starship prompt
    && curl -fsSL https://starship.rs/install.sh | bash -s -- --yes \
    #
    # Install diff-so-fancy
    && mkdir -p /opt/diff-so-fancy/ \
    && curl -fsSL https://github.com/so-fancy/diff-so-fancy/archive/v1.3.0.tar.gz | \
    tar -xz -C /opt/diff-so-fancy --strip-components=1 \
    && ln -s /opt/diff-so-fancy/diff-so-fancy /usr/local/bin
    #
    # Copy configs
    && cp ~/.dotfiles/zshrc ~/.zshrc \
    && cp ~/.dotfiles/zprofile ~/.zprofile \
    && cp ~/.dotfiles/starship.toml ~/.starship.toml \
    #
    # Clean up
    && apt-get autoremove -y \
    && apt-get clean -y \
    && rm -rf /var/lib/apt/lists/*

    apt-get update
    export DEBIAN_FRONTEND=noninteractive

    # Verify git, common tools / libs installed, add/modify non-root user, optionally install zsh
    apt-get -y install --no-install-recommends curl ca-certificates 2>&1
    curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh
    ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/common-setup.sh" | sha256sum -c -))
    /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}"
    rm /tmp/common-setup.sh

    ## Install Live Share prerequisites
    curl -fsSL https://github.com/MicrosoftDocs/live-share/blob/master/scripts/linux-prereqs.sh | bash

    # Install hub
    apt-get -y install hub

    # Install starship prompt
    curl -fsSL https://starship.rs/install.sh | bash -s -- --yes

    # Install diff-so-fancy
    mkdir -p /opt/diff-so-fancy/
    curl -fsSL https://github.com/so-fancy/diff-so-fancy/archive/v1.3.0.tar.gz | tar -xz -C /opt/diff-so-fancy --strip-components=1
    ln -s /opt/diff-so-fancy/diff-so-fancy /usr/local/bin

    # Copy configs
    cp ~/.dotfiles/zshrc ~/.zshrc
    cp ~/.dotfiles/zprofile ~/.zprofile
    cp ~/.dotfiles/starship.toml ~/.starship.toml

    # Clean up
    apt-get autoremove -y
    apt-get clean -y
    rm -rf /var/lib/apt/lists/*
  13. jarrodldavis revised this gist Jun 16, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vscode-devcontainer.sh
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-con
    COMMON_SCRIPT_SHA="da956c699ebef75d3d37d50569b5fbd75d6363e90b3f5d228807cff1f7fa211c"

    # Configure apt and install packages
    RUN apt-get update \
    apt-get update \
    && export DEBIAN_FRONTEND=noninteractive \
    #
    # Verify git, common tools / libs installed, add/modify non-root user, optionally install zsh
  14. jarrodldavis revised this gist Jun 16, 2020. 1 changed file with 0 additions and 0 deletions.
    Empty file modified vscode-devcontainer.sh
    100644 → 100755
    Empty file.
  15. jarrodldavis created this gist Jun 16, 2020.
    4 changes: 4 additions & 0 deletions starship.toml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    add_newline = false

    [git_status]
    disabled = true
    49 changes: 49 additions & 0 deletions vscode-devcontainer.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    #!/usr/bin/env bash

    # https://github.com/microsoft/vscode-dev-containers/blob/v0.122.1/containers/debian-10-git/.devcontainer/Dockerfile

    USERNAME=vscode
    USER_UID=1000
    USER_GID=$USER_UID

    INSTALL_ZSH="true"
    UPGRADE_PACKAGES="true"
    COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/v0.122.1/script-library/common-debian.sh"
    COMMON_SCRIPT_SHA="da956c699ebef75d3d37d50569b5fbd75d6363e90b3f5d228807cff1f7fa211c"

    # Configure apt and install packages
    RUN apt-get update \
    && export DEBIAN_FRONTEND=noninteractive \
    #
    # Verify git, common tools / libs installed, add/modify non-root user, optionally install zsh
    && apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \
    && curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh \
    && ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/common-setup.sh" | sha256sum -c -)) \
    && /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
    && rm /tmp/common-setup.sh \
    #
    ## Install Live Share prerequisites
    && curl -fsSL https://github.com/MicrosoftDocs/live-share/blob/master/scripts/linux-prereqs.sh | bash \
    #
    # Install hub
    && apt-get -y install hub \
    #
    # Install starship prompt
    && curl -fsSL https://starship.rs/install.sh | bash -s -- --yes \
    #
    # Install diff-so-fancy
    && mkdir -p /opt/diff-so-fancy/ \
    && curl -fsSL https://github.com/so-fancy/diff-so-fancy/archive/v1.3.0.tar.gz | \
    tar -xz -C /opt/diff-so-fancy --strip-components=1 \
    && ln -s /opt/diff-so-fancy/diff-so-fancy /usr/local/bin
    #
    # Copy configs
    && cp ~/.dotfiles/zshrc ~/.zshrc \
    && cp ~/.dotfiles/zprofile ~/.zprofile \
    && cp ~/.dotfiles/starship.toml ~/.starship.toml \
    #
    # Clean up
    && apt-get autoremove -y \
    && apt-get clean -y \
    && rm -rf /var/lib/apt/lists/*

    2 changes: 2 additions & 0 deletions zprofile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    #!/usr/bin/env zsh
    source ~/.zshrc
    87 changes: 87 additions & 0 deletions zshrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,87 @@
    #!/usr/bin/env zsh

    export EDITOR='vim'

    # custom functions
    fpath+=~/.zshfunctions
    autoload -Uz ghq
    autoload -Uz upwork
    autoload -Uz upgrade-backblaze
    autoload -Uz vim-plugin

    alias upwork="nocorrect upwork"

    # starship prompt
    eval "$(starship init zsh)"
    export STARSHIP_CONFIG=~/.starship.toml

    # hub
    eval "$(hub alias -s)"

    # man pager
    export MANPAGER="sh -c 'col -bx | bat -l man -p'"

    # command editing options
    setopt NO_CASE_GLOB
    setopt AUTO_CD
    setopt CORRECT
    setopt CORRECT_ALL
    export CORRECT_IGNORE_FILE='.*'

    # tab completions
    setopt COMPLETE_IN_WORD

    # history options
    setopt SHARE_HISTORY
    setopt APPEND_HISTORY
    setopt INC_APPEND_HISTORY
    setopt HIST_EXPIRE_DUPS_FIRST
    setopt HIST_IGNORE_DUPS
    setopt HIST_FIND_NO_DUPS
    setopt HIST_REDUCE_BLANKS
    setopt HIST_VERIFY

    # key bindings
    bindkey '^[[A' up-line-or-search
    bindkey '^[[B' down-line-or-search

    # vim mode
    export KEYTIMEOUT=1

    bindkey -v
    bindkey '^P' up-history
    bindkey '^N' down-history
    bindkey '^?' backward-delete-char
    bindkey '^h' backward-delete-char
    bindkey '^w' backward-kill-word
    bindkey '^r' history-incremental-search-backward
    bindkey -M vicmd '?' history-incremental-search-backward
    bindkey -M vicmd '/' history-incremental-search-forward

    autoload -Uz surround
    zle -N delete-surround surround
    zle -N change-surround surround
    zle -N add-surround surround
    bindkey -M vicmd cs change-surround
    bindkey -M vicmd ds delete-surround
    bindkey -M vicmd ys add-surround
    bindkey -M vicmd S add-surround

    # The following lines were added by compinstall

    zstyle ':completion:*' completer _expand _complete _ignored _match _correct _approximate _prefix
    zstyle ':completion:*' group-name ''
    zstyle ':completion:*' list-colors ''
    zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
    zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]}' 'm:{[:lower:]}={[:upper:]} m:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:]}={[:upper:]} m:{[:lower:][:upper:]}={[:upper:][:lower:]} r:|[._-]=** r:|=**' 'm:{[:lower:]}={[:upper:]} m:{[:lower:][:upper:]}={[:upper:][:lower:]} r:|[._-]=** r:|=** l:|=*'
    zstyle ':completion:*' max-errors 3
    zstyle ':completion:*' menu select=1
    zstyle ':completion:*' preserve-prefix '//[^/]##/'
    zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
    zstyle ':completion:*' verbose true
    zstyle :compinstall filename '~/.zshrc'

    autoload -Uz compinit
    compinit

    # End of lines added by compinstall