Last active
May 31, 2024 15:36
-
-
Save ryanolsonx/0e3edf39237b79e435e99084771bcfd0 to your computer and use it in GitHub Desktop.
My Setup
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
#!/usr/bin/env bash | |
cat << EOF > ~/.zshrc | |
function git_branch_name() { | |
branch=$(git symbolic-ref HEAD 2> /dev/null | awk 'BEGIN{FS="/"} {print $NF}') | |
if [[ $branch == "" ]]; | |
then | |
: | |
else | |
echo ' ['$branch']' | |
fi | |
} | |
setopt prompt_subst | |
setopt inc_append_history | |
setopt append_history | |
setopt extended_history | |
PATH="$HOME/bin:$HOME/.bun:$PATH" | |
source ~/.zshrc.private | |
prompt='ryanolson@$COMPUTER_NAME:%~$(git_branch_name) $ ' | |
EOF | |
cat << EOF > ~/.emacs | |
;; Font | |
(add-to-list 'default-frame-alist '(font . "Menlo-16")) | |
;; Disable Modes | |
(tool-bar-mode -1) | |
(scroll-bar-mode -1) | |
(blink-cursor-mode -1) | |
;; Enable Modes | |
(global-auto-revert-mode t) | |
(savehist-mode t) | |
(delete-selection-mode t) | |
;; Settings | |
(setq-default inhibit-startup-screen t | |
ring-bell-function 'ignore | |
indent-tabs-mode nil | |
tab-width 2 | |
js-indent-level 2 | |
css-indent-offset 2 | |
ruby-indent-level 2 | |
confirm-kill-emacs 'yes-or-no-p) | |
(fset 'yes-or-no-p 'y-or-n-p) | |
;; Key Bindings | |
(global-set-key (kbd "C-o") 'other-window) | |
(global-set-key (kbd "C-0") 'delete-window) | |
(global-set-key (kbd "C-1") 'delete-other-windows) | |
(global-set-key (kbd "C-2") 'split-window-below) | |
EOF | |
cat << EOF > ~/.vimrc | |
color quiet | |
syn on | |
set number | |
set sw=2 sts=2 ai et | |
set hid is | |
set dir=/tmp bdir=/tmp | |
nn <space> :e %:h<cr> | |
EOF | |
cat << EOF > ~/bin/fmt | |
#!/usr/bin/env python3 | |
import subprocess | |
def get_changed_files(): | |
res = subprocess.run(['git', 'diff', '--name-only', '--diff-filter=d'], stdout=subprocess.PIPE) | |
return res.stdout.decode("utf-8").strip().split('\n') | |
def run_prettier(changed_files): | |
print("Running Prettier") | |
args = ['npx', 'prettier', '-u', '--write'] | |
for file in changed_files: | |
args.append(file) | |
subprocess.run(args) | |
def run_eslint(changed_files): | |
print("Running ESLint") | |
args = ['npx', 'eslint', '--fix'] | |
for file in changed_files: | |
args.append(file) | |
subprocess.run(args) | |
def run_stylelint(changed_files): | |
print("Running StyleLint") | |
args = ['npx', 'stylelint', '--allow-empty-input'] | |
for file in changed_files: | |
args.append(file) | |
subprocess.run(args) | |
changed_files = get_changed_files() | |
if len(changed_files) > 0: | |
run_prettier(changed_files) | |
run_eslint(changed_files) | |
run_stylelint(changed_files) | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment