~tommoa/dots

6cb67335ee1b2e40cd7d118cc3dd117b68bbbdd1 — Tom Almeida 4 years ago 856b7ce
ion: Remove initrc from source control

I've pretty much entirely transisioned to using zsh, so there's no need
for the ion initrc to stick around.
2 files changed, 0 insertions(+), 155 deletions(-)

D .config/ion/initrc
M .gitignore
D .config/ion/initrc => .config/ion/initrc +0 -152
@@ 1,152 0,0 @@
if not test -d $HOME/.config/ion/plugins
    # We don't have plugins, so clone them in first.
    git clone https://gitlab.redox-os.org/redox-os/ion-plugins $HOME/.config/ion/plugins
end

source ~/.config/ion/plugins/init.ion
source ~/.config/ion/plugins/tools/gpg-agent.ion

export SKIM_DEFAULT_OPTIONS="--multi --ansi --bind=ctrl-e:up --preview='bat --plain --color=always {}'"

if not exists -s SSH_CLIENT
    # Only launch TMUX if we're not in an SSH session
    if not exists -s VIMRUNTIME
        # We're not in a VIM session
        if not exists -s TMUX
            # We're not already in a TMUX session
            let tmux = $(/usr/bin/env which tmux)
            let sessions: int = $len(@lines($($tmux list-sessions)))
            if test $sessions -gt 0
                exec $tmux attach
            else
                exec $tmux new-session
            end
        end
    end
end

fn PROMPT
    fn ssh_prompt
        if exists -s SSH_CLIENT
            # We're in an SSH session.
            printf "${c::red}\@${c::black}${HOST}"
        end
    end
    fn kube_prompt
        if exists -b kubectl
            # We have kubectl.
            let context = $(kubectl config current-context)
            if not eq $len(context) 0
                # Icons:
                # \u2388: ⎈
                # \u2638: ☸
                printf "${c::default,bold}{${c::light_red}☸${c::default}:${c::blue}${context}${c::default}}${c::reset} "
            end
        end
    end
    fn git_prompt
        if exists -s GIT_PROMPT && test $GIT_PROMPT -eq 1 && git rev-parse --is-inside-work-tree -q &> /dev/null
            let num_added: int = 0;
            let num_removed: int = 0;
            for line in @lines($(git diff-files --numstat -r))
                let new_added = $(echo $line | cut -f1)
                let new_removed = $(echo $line | cut -f2)
                let num_added = $((num_added+new_added))
                let num_removed = $((num_removed+new_removed))
            end
            let totals = "";
            if test $num_added -gt 0 || test $num_removed -gt 0
                let totals = ":"
                if test $num_added -gt 0
                    let totals = "$totals${c::0x55}+$num_added"
                end
                if test $num_removed -gt 0
                    let totals = "$totals${c::light_red}-$num_removed"
                end
            end
            printf "[${c::red,bold}$(git symbolic-ref --short -q HEAD || git rev-parse --short HEAD)${c::default}$totals${c::default}] "
        end
    end
    fn venv
        if exists -s VIRTUAL_ENV
            let env = $(echo $VIRTUAL_ENV | awk -F'/' '{printf $NF}')
            printf "${c::bold}(${c::yellow}$env${c::default,bold})${c::default} "
        end
    end
    printf "$(kube_prompt)${c::0x55,bold}${USER}$(ssh_prompt)${c::default}:${c::0x4B}${SWD}${c::default}# $(venv)$(git_prompt)${c::reset}"
    drop kube_prompt
    drop ssh_prompt
end

fn kctx context:str -- Set the kubernetes context
    kubectl config use-context $context
end

fn show what:str -- Show the existing setting for a variable
    match @split(what)[0]
        case "kctx"
            kubectl config get-contexts
        case _
            echo "[${color::red}@split(what)[0]${color::reset}] does not seem to exist"
            echo "options:${color::blue}"
            echo -e "\tkctx"
            printf "${color::reset}"
    end
end

fn no what:str -- Remove an existing setting for a variable
    match @split(what)[0]
        case "kctx"
            kubectl config unset current-context
        case _
            echo "[${color::red}@split(what)[0]${color::reset}] does not seem to exist"
            echo "options:${color::blue}"
            echo -e "\tkctx"
            printf "${color::reset}"
    end
end

fn mux session:str -- Move or create a tmux session
    let tmux = $(/usr/bin/env which tmux)
    let fd = $(/usr/bin/env which fd || /usr/bin/env which fdfind)
    let dir = $($fd --no-ignore -i -td "$session" ~/Documents | awk -F'/' 'NR==1{n=NF; m=$0} NF<n{ m=$0; n=NF } END { print m }')
    $tmux if-shell                      \
        "$tmux has-session -t $session" \
        "switch-client -t $session"     \
        "new-session -ds $session -c $dir; switch-client -t $session"
end

alias tls="tmux ls"

fn del session:str -- Delete a tmux session
    let tmux = $(/usr/bin/env which tmux)
    $tmux kill-session -t $session
end

fn update_rust -- Update a rust crate
    let gitdr = $(git fetch --dry-run &| wc -l)
    let gitdr:int = $((gitdr))
    if test $(echo $gitdr) -ne 0
        echo "${c::red}Updating${c::reset}"
        git checkout .
        git pull --recurse-submodules
        cargo install --path . --force
    else
        echo "${c::green}Already updated!${c::reset}"
    end
end

if matches $(uname) "Darwin"
    # We're on OSX
    # We need to set PATH here because if we try to set it later, we will error
    # on all things installed by homebrew.
    # Set path to use homebrew's less
    # export PATH=$PATH
    export PAGER=less
end

export EDITOR=$(which nvim)
export GIT_PROMPT=1
export LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"

source ~/.cargo/env

M .gitignore => .gitignore +0 -3
@@ 5,9 5,6 @@
/.config/*
!/.config/alacritty
!/.config/bat
!/.config/ion
/.config/ion/*
!/.config/ion/initrc
!/.config/imv/
!/.config/khard
!/.config/khal