-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
92279d7
commit 0999adc
Showing
11 changed files
with
300 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
let | ||
pkgs = import <nixpkgs> { | ||
config = {}; | ||
overlays = []; | ||
}; | ||
in | ||
pkgs.mkShell { | ||
packages = with pkgs; [ | ||
# Included in BusyBox | ||
ncurses | ||
less | ||
# Supported shells | ||
bash | ||
zsh | ||
# System utilities | ||
procps | ||
tree | ||
# Required utilities | ||
git | ||
nano | ||
curl | ||
gzip | ||
zopfli | ||
brotli | ||
# Development dependencies | ||
deno | ||
lightningcss | ||
]; | ||
GIT_EDITOR = "${pkgs.nano}/bin/nano"; | ||
shellHook = '' | ||
export ZDOTDIR=$PWD/nix/zsh | ||
export XDG_CONFIG_HOME=$PWD/nix | ||
export PATH=$PWD:$PATH | ||
export SOURCE_DIR=$(./shx sourceDir) | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Welcome to PonyTrails GNU Nano default configuration file. | ||
# You can choose to disable several settings by comment them out. | ||
|
||
# Make your GNU Nano editor display and behave vaguely like normal editors. | ||
set titlecolor bold,lightblack,black | ||
set numbercolor bold,lightblack,black | ||
set statuscolor lightblack,black | ||
set autoindent # Follows the current indentation | ||
set smarthome # Don't let indentation frustrate you. | ||
set tabsize 4 # A tabsize of 4 follows the setting of most editors. | ||
set softwrap # Just display the lines, and don't hide them. | ||
set linenumbers # Just show the line numbers. | ||
set constantshow # Display information of the cursor position constantly. | ||
set nonewlines # Do not add a blank new line at the end of every file. | ||
set nohelp # I know how to do basic Nano operations, so stop pestering me. | ||
set historylog # Save historical searches and replaces for later use. | ||
set positionlog # Save cursor positions of the last 200 edited files. | ||
# Some other configurations. Uncomment them to enable. | ||
|
||
# Display | ||
#set atblanks # Make soft wrapping wrap at word blanks, instead of the edge of display area. | ||
#set bookstyle # Treat lines starting with whitespaces as beginnings of paragraphs. | ||
#set emptyline # Keep the line below title bar empty. Not recommended to enable. | ||
#set indicator # Display a scroll bar on the right of display area. | ||
#set scrollercolor lightblack | ||
|
||
# Editing | ||
#set afterends # Make (^▶) and (^Del) stop at word ends instead of word beginnings. | ||
#set breaklonglines # Automatically hard-wraps the current line when too long. | ||
#set rebinddelete # Interpret (Del) and (Bksp) differently. Only enable when the two are wrong! | ||
|
||
# File behaviour | ||
#set backup # Automatically creates backups when saving files. | ||
#set backupdir ~/.nanobak # Keep seperate backups in the directory every time you save a file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
shx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
# Slightly modified test ZSH config | ||
# Set up the prompt | ||
autoload -Uz promptinit | ||
setopt histignorealldups sharehistory | ||
# Use emacs keybindings even if our EDITOR is set to vi | ||
bindkey -e | ||
# Keep 1000 lines of history within the shell and save it to ~/.zsh_history: | ||
HISTSIZE=1000 | ||
SAVEHIST=1000 | ||
HISTFILE=$SOURCE_DIR/nix/zsh/.zsh_history | ||
# Use modern completion system | ||
autoload -Uz compinit | ||
compinit | ||
zstyle ':completion:*' auto-description 'specify: %d' | ||
zstyle ':completion:*' completer _expand _complete _correct _approximate | ||
zstyle ':completion:*' format 'Completing %d' | ||
zstyle ':completion:*' group-name '' | ||
zstyle ':completion:*' menu select=2 | ||
eval "$(dircolors -b)" | ||
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} | ||
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:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*' | ||
zstyle ':completion:*' menu select=long | ||
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s | ||
zstyle ':completion:*' use-compctl false | ||
zstyle ':completion:*' verbose true | ||
|
||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' | ||
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd' | ||
|
||
# Load version control information | ||
autoload -Uz vcs_info | ||
precmd() { vcs_info } | ||
# Format the vcs_info_msg_0_ variable | ||
zstyle ':vcs_info:git*' formats '(%b) ' | ||
|
||
# Custom device name? | ||
if [ -e "./nix/zsh/.zshName" ] ; then | ||
customDeviceName=" %B%F{yellow}$(cat ./nix/zsh/.zshName)" | ||
fi | ||
|
||
# Nested or not? | ||
if [ "$shellCount" != "" ] ; then | ||
export shellCount=$(($shellCount+1)) | ||
else | ||
export shellCount=0 | ||
fi | ||
|
||
# Via SSH or not? | ||
termType="term" | ||
if [ "$SSH_CLIENT" != "" ] ; then | ||
termType="sshd" | ||
fi | ||
|
||
# Display current screen | ||
if [ "$STY" != "" ] ; then | ||
screenSupport="%b%F{white}@%B%F{yellow}$STY" | ||
fi | ||
|
||
# Use Proxychains | ||
if [ -e $PREFIX/etc/proxychains.conf ] ; then | ||
xPC_VER="proxychains.conf" | ||
else | ||
if [ -e $PREFIX/etc/proxychains4.conf ] ; then | ||
xPC_VER="proxychains4.conf" | ||
fi | ||
fi | ||
if [ "$xPC_VER" != "" ] ; then | ||
if [ "$PROXYCHAINS_CONF_FILE" = "$PREFIX/etc/$xPC_VER" ] ; then | ||
xPC_PROF="PC:S" | ||
elif [ "$PROXYCHAINS_CONF_FILE" = "$HOME/.proxychains/proxychains.conf" ] ; then | ||
xPC_PROF="PC:U" | ||
elif [ "$PROXYCHAINS_CONF_FILE" = "$PWD/proxychains.conf" ] ; then | ||
xPC_PROF="PC:D" | ||
elif [ "$PROXYCHAINS_CONF_FILE" != "" ] ; then | ||
xPC_PROF="PC:C" | ||
fi | ||
fi | ||
if [ "$xPC_PROF" != "" ] ; then | ||
if [ "$PROXYCHAINS_QUIET_MODE" = "1" ] ; then | ||
xPC_QUIET=" %B%F{green}" | ||
else | ||
xPC_QUIET=" %B%F{cyan}" | ||
fi | ||
fi | ||
|
||
# Use sudo | ||
if [ "$SUDO_USER" ] ; then | ||
sudoInfo="%B%F{blue}$SUDO_USER%b%F{white}>" | ||
fi | ||
# Use doas | ||
if [ "$DOAS_USER" != "" ] ; then | ||
sudoInfo="%B%F{blue}$DOAS_USER%b%F{white}>" | ||
fi | ||
|
||
# Which desktop environment are you using? | ||
if [ "$KDE_SESSION_VERSION" != "" ] ; then | ||
xDE_TYPE="KDE" | ||
elif [ "$GDMSESSION" != "" ] ; then | ||
xDE_TYPE="GTK" | ||
elif [ "$TERMUX_VERSION" != "" ] ; then | ||
xDE_TYPE="TMX" | ||
elif [ "$IN_NIX_SHELL" != "" ] ; then | ||
xDE_TYPE="Nix" | ||
fi | ||
# Combine DE info | ||
if [ "$xDE_TYPE" != "" ] ; then | ||
xDE_INFO=" %B%F{green}$xDE_TYPE" | ||
fi | ||
|
||
# Use ZSH in screens by default instead | ||
SHELL="$(which zsh)" | ||
|
||
# Reconfigure prompt | ||
shellSymbol="#" | ||
if [ "$(whoami)" != "root" ] ; then | ||
shellSymbol="\$" | ||
fi | ||
|
||
PS1="%b%F{white}[%B%F{green}ZSH$screenSupport$customDeviceName$xDE_INFO$xPC_QUIET$xPC_PROF%b%F{white}] %B%F{green}%99<...<%~\ | ||
%}%F{white} | ||
${sudoInfo}%B%F{cyan}%n%b%F{white}:%B%F{yellow}$termType%b%F{white}-%B%F{yellow}$shellCount %B%F{white}$shellSymbol %b%f%k" | ||
bindkey "^[[H" beginning-of-line | ||
bindkey "^[[F" end-of-line | ||
bindkey "^[[3~" delete-char |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
# shx Standard Utility | ||
# Push to a single remote | ||
git stage -A && git commit --amend && git push --force $1 | ||
# Push to all remotes | ||
#git stage -A && git commit --amend && git remote | xargs -L1 git push --force | ||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
# shx Standard Utility | ||
git stage -A | ||
git diff ${1:-HEAD} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
# shx Standard Utility | ||
if [ -e "$(which nix-shell)" ]; then | ||
useNix=${1:-env} | ||
if [ -f "nix/${useNix}.nix" ]; then | ||
echo "Preparing Nix shell with: ${useNix}.nix..." | ||
nix-shell nix/${useNix}.nix --quiet --pure --command zsh | ||
echo "Quitting Nix shell..." | ||
rm nix/.zcompdump 2> /dev/null | ||
rm nix/zsh/.zcompdump 2> /dev/null | ||
else | ||
echo "${useNix}.nix does not exist." | ||
fi | ||
else | ||
echo "Nix Shell is not available." | ||
fi | ||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
# This script is to display the project directory. | ||
# It is solely used to support shell history isolation. | ||
echo $SOURCE_DIR | ||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
echo "shx version: $SHX_VERSION" | ||
echo "Current shell: $CURRENT_SHELL" | ||
echo "Source directory: $SOURCE_DIR" | ||
echo "Invoke directory: $INVOKE_DIR" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
typeReply=$(type -p $0) | ||
if [[ "$typeReply" != "$0 "* ]]; then | ||
type -p $1 | ||
else | ||
echo "" | read -a dummyVar 2>/dev/null | ||
if [[ "$?" == "0" ]]; then | ||
reply=( $(type -p $1) ) | ||
echo ${reply[$((${#reply[@]} - 1))]} | ||
else | ||
set -A reply $(type -p $1) | ||
echo ${reply[$((${#reply[@]}))]} | ||
fi | ||
fi | ||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,62 @@ | ||
#!/bin/bash | ||
# Check the current shell | ||
export SHX_VERSION=0.2.1 | ||
export INVOKE_DIR=$PWD | ||
export CURRENT_SHELL=$(ps h -p $$ -o args='' | cut -f1 -d' ') | ||
if [[ "${NO_SHELL_CHECK}" == "" ]] && | ||
[[ "${CURRENT_SHELL}" != *"bash" ]] && | ||
[[ "${CURRENT_SHELL}" != *"ksh" ]] && | ||
[[ "${CURRENT_SHELL}" != *"zsh" ]]; then | ||
echo "Please run with bash instead of ${CURRENT_SHELL}." | ||
exit | ||
fi | ||
# Define runner | ||
runner="bash" | ||
if [[ "${CURRENT_SHELL}" == *"bash" ]]; then | ||
runner=$CURRENT_SHELL | ||
elif [[ "$(bash --version >/dev/null 2>/dev/null;echo $?)" == "0" ]]; then | ||
printf "" | ||
else | ||
echo -e "\033[1;33mWarning\033[0m: Not using Bash. Scripts may not work." | ||
fi | ||
# Locate the project folder | ||
OIFS="$IFS" | ||
IFS='/' read -r -a paths <<< "$PWD" 2>/dev/null || paths=('' ${(@s:/:)PWD}) | ||
let fsPointer=$((${#paths[@]} - 1)) | ||
IFS='/' | ||
while [ "$fsPointer" -ge 0 ]; do | ||
fsPath="${paths[@]:0:$((fsPointer + 1))}" | ||
fsPath=${fsPath:-/} | ||
if [ -f "$fsPath/shx" ] && [ -d "$fsPath/sh" ] ; then | ||
#echo "Switched to \"$fsPath\"." | ||
cd "$fsPath" | ||
break | ||
#else | ||
#echo "No match for \"$fsPath\"." | ||
fi | ||
fsPointer=$(($fsPointer - 1)) | ||
done | ||
if [[ "$fsPath" == "/" ]] ; then | ||
echo "No project directory is found. Quitting." | ||
exit 1 | ||
fi | ||
IFS="$OIFS" | ||
export SOURCE_DIR=$PWD | ||
export PATH=$PATH:./:./sh | ||
# Command parsing | ||
arg="$@" | ||
args=( "$@" ) | ||
if [ "$arg" == "" ] ; then | ||
if [[ "${arg}" == "" ]] ; then | ||
echo -e "\033[1;37mshx ${SHX_VERSION}\033[0m" | ||
echo "All available actions:" | ||
ls -1 sh | while IFS= read -r file; do | ||
echo "${file/.sh/}" | ||
echo "· ${file/.sh/}" | ||
done | ||
exit | ||
fi | ||
if [ -e "sh/$1.sh" ] ; then | ||
export PATH=./:./sh/:$PATH | ||
elif [ -e "sh/$1.sh" ] ; then | ||
bash "sh/$1.sh" "${args[@]:1}" | ||
elif [ -e "sh/$1" ] ; then | ||
export PATH=./:./sh/:$PATH | ||
bash "sh/$1" "${args[@]:1}" | ||
else | ||
echo "No action found as \"$1\". Command: \"${args[@]:1}\"". | ||
echo -e "\033[1;31mError\033[0m: No action found as \"$1\". Command: shx ${args[@]:1}". | ||
fi | ||
exit |