Last active
June 10, 2020 05:59
-
-
Save segovia94/49e36d69488118bd230edc914c52aef9 to your computer and use it in GitHub Desktop.
windows terminal
This file contains hidden or 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
# Easier navigation: .., ..., ~ and - | |
alias ..="cd .." | |
alias cd..="cd .." | |
alias ...="cd ../.." | |
alias ....="cd ../../.." | |
alias .....="cd ../../../.." | |
alias ~="cd ~" # `cd` is probably faster to type though | |
alias -- -="cd -" | |
# mv, rm, cp | |
alias mv='mv -v' | |
alias rm='rm -i -v' | |
alias cp='cp -v' | |
# List only directories | |
alias lsd='ls -l | grep "^d"' | |
# `la` defined in .functions | |
# GIT STUFF | |
# Undo a `git push` | |
alias undopush="git push -f origin HEAD^:master" | |
# git root | |
alias gr='[ ! -z `git rev-parse --show-cdup` ] && cd `git rev-parse --show-cdup || pwd`' | |
# File size | |
alias fs="stat -f \"%z bytes\"" | |
# Delete all node_module packages | |
alias delete_npm='for package in `ls node_modules`; do sudo npm uninstall $package; done; sudo rm -rf node_modules/.bin' | |
# Selenium commands for running behat tests | |
alias selenium="java -jar /Applications/selenium-server-standalone-2.45.0.jar" | |
alias selenium_chrome='java -jar /Applications/selenium-server-standalone-2.45.0.jar -Dwebdriver.chrome.driver="/data/lib/chromedriver"' | |
# Drush | |
alias drush8='~/.drush8/vendor/bin/drush' | |
alias drush='lando drush' | |
alias d8_install='drush si --account-pass=admin --account-name=admin --site-name=drupal8' | |
# Drupal Console | |
alias drupal='php ~/.console/drupal.phar' | |
# Directory shortcuts | |
alias web="cd /d/Websites" | |
alias zhuk="cd /d/Websites/Zhuk" | |
alias wamp="cd /c/wamp/www" | |
#SiteFarm | |
alias sf="cd /d/Websites/UC-Davis/Sitefarm" | |
alias sfp="cd /d/Websites/UC-Davis/Sitefarm/docroot/profiles/sitefarm" | |
alias sft="cd /d/Websites/UC-Davis/Sitefarm/docroot/themes/contrib/sitefarm_one" | |
# Install Drupal via composer in lando https://github.com/drupal-composer/drupal-project | |
alias getDrupal='lando composer -n create-project -s dev drupal/recommended-project newsite && moveSite' | |
alias newDrupal='getDrupal && lando rebuild -y && lando drupal-setup && lando drupal-install' | |
# Install the Bedrock Wordpress build via composer in lando - https://roots.io/bedrock/ | |
alias getWordpress='lando composer -n create-project roots/bedrock newsite && moveSite' |
This file contains hidden or 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
# Load our dotfiles like ~/.bash_prompt, etc� | |
for file in ~/.{bash_prompt,aliases,functions}; do | |
[ -r "$file" ] && source "$file" | |
done | |
unset file |
This file contains hidden or 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
# This prompt inspired by gf3, sindresorhus, alrra, and mathiasbynens, and paulirish | |
# https://github.com/paulirish/dotfiles/blob/master/.bash_prompt | |
default_username='segov' | |
# export TERM=xterm-256color | |
set_prompts() { | |
local black="" blue="" bold="" cyan="" green="" orange="" \ | |
purple="" red="" reset="" white="" yellow="" | |
local dateCmd="" | |
bold="" | |
reset="\e[0m" | |
black="\e[1;30m" | |
blue="\e[1;34m" | |
cyan="\e[1;36m" | |
green="\e[1;32m" | |
orange="\e[1;33m" | |
purple="\e[0;35m" | |
red="\e[1;31m" | |
magenta="\e[0;35m" | |
violet="\e[1;35m" | |
white="\e[1;37m" | |
yellow="\e[1;33m" | |
# Only show username/host if not default | |
function usernamehost() { | |
userStyle="${red}"; | |
userhost="" | |
userhost+="\[${userStyle}\]$USERNAME " | |
userhost+="${white}at " | |
userhost+="${orange}$HOSTNAME " | |
userhost+="${white}in" | |
if [ "$USERNAME" != "$default_username" ]; then echo $userhost ""; fi | |
} | |
function prompt_git() { | |
# this is >5x faster than mathias's. has to be for working in Chromium & Blink. | |
# check if we're in a git repo. (fast) | |
git rev-parse --is-inside-work-tree &>/dev/null || return | |
# check for what branch we're on. (fast) | |
# if� HEAD isn�t a symbolic ref (typical branch), | |
# then� get a tracking remote branch or tag | |
# otherwise� get the short SHA for the latest commit | |
# lastly just give up. | |
branchName="$(git symbolic-ref --quiet --short HEAD 2> /dev/null || \ | |
git describe --all --exact-match HEAD 2> /dev/null || \ | |
git rev-parse --short HEAD 2> /dev/null || \ | |
echo '(unknown)')"; | |
## early exit for Chromium & Blink repo, as the dirty check takes ~5s | |
repoUrl=$(git config --get remote.origin.url) | |
if grep -q chromium.googlesource.com <<<$repoUrl; then | |
dirty=" ?" | |
else | |
# check if it's dirty (slow) | |
# technique via github.com/git/git/blob/355d4e173/contrib/completion/git-prompt.sh#L472-L475 | |
dirty=$(git diff --no-ext-diff --quiet --ignore-submodules --exit-code || echo -e "*") | |
# mathias has a few more checks some may like: | |
# github.com/mathiasbynens/dotfiles/blob/a8bd0d4300/.bash_prompt#L30-L43 | |
fi | |
[ -n "${s}" ] && s=" [${s}]"; | |
echo -e "${1}${branchName}${2}$dirty"; | |
return | |
} | |
# ------------------------------------------------------------------ | |
# | Prompt string | | |
# ------------------------------------------------------------------ | |
PS1="\[\033]0;\w\007\]" # terminal title (set to the current working directory) | |
PS1+=$'\n'"\[$bold\]" | |
PS1+="\[$(usernamehost)\]" # username at host | |
PS1+="\[$green\]\w" # working directory | |
PS1+="\$(prompt_git \"$white on $magenta\" \"$cyan\")" # git repository details | |
PS1+=$'\n' | |
PS1+="\[$reset$white\]\\$ \[$reset\]" | |
export PS1 | |
# ------------------------------------------------------------------ | |
# | Subshell prompt string | | |
# ------------------------------------------------------------------ | |
export PS2="? " | |
# ------------------------------------------------------------------ | |
# | Debug prompt string (when using `set -x`) | | |
# ------------------------------------------------------------------ | |
# When debugging a shell script via `set -x` this tricked-out prompt is used. | |
# The first character (+) is used and repeated for stack depth | |
# Then, we log the current time, filename and line number, followed by function name, followed by actual source line | |
# FWIW, I have spent hours attempting to get time-per-command in here, but it's not possible. ~paul | |
export PS4='+ \011\e[1;30m\t\011\e[1;34m${BASH_SOURCE}\e[0m:\e[1;36m${LINENO}\e[0m \011 ${FUNCNAME[0]:+\e[0;35m${FUNCNAME[0]}\e[1;30m()\e[0m:\011\011 }' | |
# shoutouts: | |
# https://github.com/dholm/dotshell/blob/master/.local/lib/sh/profile.sh is quite nice. | |
# zprof is also hot. | |
} | |
set_prompts | |
unset set_prompts |
This file contains hidden or 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
# Create a new directory and enter it | |
function md() { | |
mkdir -p "$@" && cd "$@" | |
} | |
# find shorthand | |
function f() { | |
find . -name "$1" 2>&1 | grep -v 'Permission denied' | |
} | |
# List all files, long format, colorized, permissions in octal | |
function la() { | |
ls -l "$@" | awk ' | |
{ | |
k=0; | |
for (i=0;i<=8;i++) | |
k+=((substr($1,i+2,1)~/[rwx]/) *2^(8-i)); | |
if (k) | |
printf("%0o ",k); | |
printf(" %9s %3s %2s %5s %6s %s %s %s\n", $3, $6, $7, $8, $5, $9,$10, $11); | |
}' | |
} | |
# get gzipped size | |
function gz() { | |
echo "orig size (bytes): " | |
cat "$1" | wc -c | |
echo "gzipped size (bytes): " | |
gzip -c "$1" | wc -c | |
} | |
# direct it all to /dev/null | |
function nullify() { | |
"$@" >/dev/null 2>&1 | |
} | |
# visual studio code. a la `subl` | |
function code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCodeInsiders" --args $*; } | |
# Move a site created by "lando composer" into the current directory | |
function moveSite() { | |
mv newsite/* newsite/.[^.]* . | |
rm -rf newsite/ | |
echo "Site moved: rebuilding Lando" | |
lando rebuild -y | |
} |
This file contains hidden or 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
// To view the default settings, hold "alt" while clicking on the "Settings" button. | |
// For documentation on these settings, see: https://aka.ms/terminal-documentation | |
{ | |
"$schema": "https://aka.ms/terminal-profiles-schema", | |
"defaultProfile": "{00000000-0000-0000-ba54-000000000002}", | |
"profiles": | |
{ | |
"defaults": | |
{ | |
// Put settings here that you want to apply to all profiles | |
}, | |
"list": | |
[ | |
{ | |
"guid": "{00000000-0000-0000-ba54-000000000002}", | |
"name" : "Git Bash", | |
"commandline" : "\"%PROGRAMFILES%\\git\\usr\\bin\\bash.exe\" -i -l", | |
"hidden": false, | |
"fontFace" : "Consolas", | |
"historySize" : 9001, | |
"colorScheme" : "Campbell", | |
"startingDirectory" : "%USERPROFILE%" | |
}, | |
{ | |
// Make changes here to the powershell.exe profile | |
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", | |
"name": "Windows PowerShell", | |
"commandline": "powershell.exe", | |
"hidden": false | |
}, | |
{ | |
// Make changes here to the cmd.exe profile | |
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", | |
"name": "cmd", | |
"commandline": "cmd.exe", | |
"hidden": false | |
}, | |
{ | |
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}", | |
"hidden": false, | |
"name": "Azure Cloud Shell", | |
"source": "Windows.Terminal.Azure" | |
} | |
] | |
}, | |
// Add custom color schemes to this array | |
"schemes": [], | |
// Add any keybinding overrides to this array. | |
// To unbind a default keybinding, set the command to "unbound" | |
"keybindings": [] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment