From daaf838366eeb4b06e368155e0d821f312ec339a Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Sat, 3 Dec 2022 00:56:43 -0500 Subject: [PATCH] Switch to a simpler fake_home scheme. Also add a few vim templates. --- .idea/.dotfiles.iml | 8 +++ .idea/.gitignore | 8 +++ copy.sh | 69 +++++++------------ .bash_profile => fake_home/.bash_profile | 0 .bashrc => fake_home/.bashrc | 0 {.config => fake_home/.config}/starship.toml | 16 ++++- .../.config}/xfce4/terminal/terminalrc | 0 .../xfce4-keyboard-shortcuts.xml | 0 .dir_colors => fake_home/.dir_colors | 0 .gitconfig => fake_home/.gitconfig | 0 .ideavimrc => fake_home/.ideavimrc | 0 .shell_aliases => fake_home/.shell_aliases | 0 .tmux.conf => fake_home/.tmux.conf | 0 .../.vim}/colors/jellybeans.vim | 0 .vimrc => fake_home/.vimrc | 1 + .zprofile => fake_home/.zprofile | 0 .zshrc => fake_home/.zshrc | 6 +- fake_home/vim_templates/makefile | 9 +++ fake_home/vim_templates/skeleton.c | 5 ++ fake_home/vim_templates/skeleton.cpp | 7 ++ fake_home/vim_templates/skeleton.html | 23 +++++++ fake_home/vim_templates/skeleton.sh | 3 + 22 files changed, 107 insertions(+), 48 deletions(-) create mode 100644 .idea/.dotfiles.iml create mode 100644 .idea/.gitignore rename .bash_profile => fake_home/.bash_profile (100%) rename .bashrc => fake_home/.bashrc (100%) rename {.config => fake_home/.config}/starship.toml (73%) rename {.config => fake_home/.config}/xfce4/terminal/terminalrc (100%) rename {.config => fake_home/.config}/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml (100%) rename .dir_colors => fake_home/.dir_colors (100%) rename .gitconfig => fake_home/.gitconfig (100%) rename .ideavimrc => fake_home/.ideavimrc (100%) rename .shell_aliases => fake_home/.shell_aliases (100%) rename .tmux.conf => fake_home/.tmux.conf (100%) rename {.vim => fake_home/.vim}/colors/jellybeans.vim (100%) rename .vimrc => fake_home/.vimrc (98%) rename .zprofile => fake_home/.zprofile (100%) rename .zshrc => fake_home/.zshrc (90%) create mode 100644 fake_home/vim_templates/makefile create mode 100644 fake_home/vim_templates/skeleton.c create mode 100644 fake_home/vim_templates/skeleton.cpp create mode 100644 fake_home/vim_templates/skeleton.html create mode 100755 fake_home/vim_templates/skeleton.sh diff --git a/.idea/.dotfiles.iml b/.idea/.dotfiles.iml new file mode 100644 index 0000000..bc2cd87 --- /dev/null +++ b/.idea/.dotfiles.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/copy.sh b/copy.sh index cea2684..61271ee 100755 --- a/copy.sh +++ b/copy.sh @@ -1,52 +1,29 @@ #!/bin/bash -SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" - -moving_files="$(find $SCRIPT_DIR -mindepth 1 -maxdepth 1 -type f -not -name "copy.sh" -not -name "*.git*")" -moving_files=$(echo -e "$moving_files\n$(find $SCRIPT_DIR/.vim/colors/ -mindepth 1)") -moving_files=$(echo -e "$moving_files\n$(find $SCRIPT_DIR/.config/ -mindepth 1)") - -mkdir -p $HOME/.vim/user/ -touch $HOME/.vim/user/files.vim - -home_files="" -for f in $moving_files; do - home_file="$HOME$(echo $f | sed "s@$SCRIPT_DIR@@")" - if test -f "$home_file" && ! diff $home_file $f &>/dev/null; then - home_files="$home_files\n $home_file" - fi -done - -if [[ "$home_files" != "" ]]; then - echo -n "Warning! This will overwrite all of the following files:" - echo -e $home_files - - read -r -p "Are you sure you want to continue? [y/N] " response - response=${response,,} # tolower - if ! [[ "$response" =~ ^(yes|y)$ ]]; then - exit 1 - fi -fi - -for f in $moving_files; do - echo "$f => ~/" - ln -sf $f ~/ -done - -mkdir -p ~/.vim/colors -ln -sf $SCRIPT_DIR/.vim/colors/* ~/.vim/colors/ - -mkdir -p ~/.config/ -ln -sf $SCRIPT_DIR/.config/* ~/.config/ - -touch ~/.zsh_local - -if ! test -f ~/.gitlocal; then - echo "[user]" > ~/.gitlocal - echo " email = sagev9000@tutanota.com" >> ~/.gitlocal -fi # Install required packages -if [[ "$1" == "--install" ]]; then +if [[ "$1" != "--install" ]]; then + SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + FAKE_HOME="$SCRIPT_DIR/fake_home" + + dotdirs="$(find $FAKE_HOME -mindepth 1 -type d)" + + echo "$dotdirs" | while read -r dotdir; do + new="$HOME${dotdir:${#FAKE_HOME}}" + echo "mkdir -p $new" + mkdir -p $new + done + + + dotfiles="$(find $FAKE_HOME -mindepth 1 -type f)" + + echo "$dotfiles" | while read -r dotfile; do + new="$HOME${dotfile:${#FAKE_HOME}}" + echo "$dotfile => $new" + ln -sf "$dotfile" "$new" + done + + touch "$HOME/.zsh_local" +else echo -n "Rust is " if ! command -v cargo; then echo "not installed. Installing..." diff --git a/.bash_profile b/fake_home/.bash_profile similarity index 100% rename from .bash_profile rename to fake_home/.bash_profile diff --git a/.bashrc b/fake_home/.bashrc similarity index 100% rename from .bashrc rename to fake_home/.bashrc diff --git a/.config/starship.toml b/fake_home/.config/starship.toml similarity index 73% rename from .config/starship.toml rename to fake_home/.config/starship.toml index 773c5c7..504031d 100644 --- a/.config/starship.toml +++ b/fake_home/.config/starship.toml @@ -1,4 +1,4 @@ -add_newline = false +add_newline = true format = """ [\\[sage\\]](bold red) \ $username\ @@ -78,3 +78,17 @@ format = "$symbol" [time] disabled = true use_12hr = true + +[[battery.display]] +threshold = 20 +style = "bold red" + +[[battery.display]] # "bold yellow" style when capacity is between 10% and 50% +threshold = 30 +style = "yellow" +discharging_symbol = " " + +# [[battery.display]] +# threshold = 100 +# style = "green" +# discharging_symbol = " " diff --git a/.config/xfce4/terminal/terminalrc b/fake_home/.config/xfce4/terminal/terminalrc similarity index 100% rename from .config/xfce4/terminal/terminalrc rename to fake_home/.config/xfce4/terminal/terminalrc diff --git a/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml b/fake_home/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml similarity index 100% rename from .config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml rename to fake_home/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml diff --git a/.dir_colors b/fake_home/.dir_colors similarity index 100% rename from .dir_colors rename to fake_home/.dir_colors diff --git a/.gitconfig b/fake_home/.gitconfig similarity index 100% rename from .gitconfig rename to fake_home/.gitconfig diff --git a/.ideavimrc b/fake_home/.ideavimrc similarity index 100% rename from .ideavimrc rename to fake_home/.ideavimrc diff --git a/.shell_aliases b/fake_home/.shell_aliases similarity index 100% rename from .shell_aliases rename to fake_home/.shell_aliases diff --git a/.tmux.conf b/fake_home/.tmux.conf similarity index 100% rename from .tmux.conf rename to fake_home/.tmux.conf diff --git a/.vim/colors/jellybeans.vim b/fake_home/.vim/colors/jellybeans.vim similarity index 100% rename from .vim/colors/jellybeans.vim rename to fake_home/.vim/colors/jellybeans.vim diff --git a/.vimrc b/fake_home/.vimrc similarity index 98% rename from .vimrc rename to fake_home/.vimrc index 64545fc..e3f66d2 100644 --- a/.vimrc +++ b/fake_home/.vimrc @@ -148,6 +148,7 @@ nnoremap v :vert term ++cols=80 nnoremap t :term ++rows=20 autocmd BufNewFile,BufRead * if expand('%:t') !~ '\.' | setl spell | endif +autocmd BufNewFile,BufRead *.pbl set syntax=clojure " Expand %% to the current files dir cabbr %% expand('%:p:h') diff --git a/.zprofile b/fake_home/.zprofile similarity index 100% rename from .zprofile rename to fake_home/.zprofile diff --git a/.zshrc b/fake_home/.zshrc similarity index 90% rename from .zshrc rename to fake_home/.zshrc index afb6d0d..56e59d1 100644 --- a/.zshrc +++ b/fake_home/.zshrc @@ -38,7 +38,7 @@ if [ -x /usr/bin/dircolors ]; then alias egrep='egrep --color=auto' fi -export PATH=./:~/.bin:/usr/local/go/bin:$PATH +export PATH=./:~/.bin:$HOME/.platformio/penv/bin:/usr/local/go/bin:$PATH fignore=(o) @@ -91,3 +91,7 @@ if test -f ~/.cargo/env; then fi source ~/.shell_aliases + +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion diff --git a/fake_home/vim_templates/makefile b/fake_home/vim_templates/makefile new file mode 100644 index 0000000..91b50c9 --- /dev/null +++ b/fake_home/vim_templates/makefile @@ -0,0 +1,9 @@ +CC=gcc +CFLAGS=-I. +MAIN=hello + +nonnull: $(MAIN).o + $(CC) -o $(MAIN) $(MAIN).o + +clean: + rm ./*.o diff --git a/fake_home/vim_templates/skeleton.c b/fake_home/vim_templates/skeleton.c new file mode 100644 index 0000000..9b216a5 --- /dev/null +++ b/fake_home/vim_templates/skeleton.c @@ -0,0 +1,5 @@ +#include + +int main() { + printf("Hello, world!\n"); +} diff --git a/fake_home/vim_templates/skeleton.cpp b/fake_home/vim_templates/skeleton.cpp new file mode 100644 index 0000000..fce833d --- /dev/null +++ b/fake_home/vim_templates/skeleton.cpp @@ -0,0 +1,7 @@ +#include + +using namespace std; + +int main() { + cout << "Hello, world!" << endl; +} diff --git a/fake_home/vim_templates/skeleton.html b/fake_home/vim_templates/skeleton.html new file mode 100644 index 0000000..bbe7e61 --- /dev/null +++ b/fake_home/vim_templates/skeleton.html @@ -0,0 +1,23 @@ + + + + + + Wow, the title of the new website + + + + + + + + + + + + + +

Hello, world!

+

This is the beginning of a beautiful new website.

+ + diff --git a/fake_home/vim_templates/skeleton.sh b/fake_home/vim_templates/skeleton.sh new file mode 100755 index 0000000..9f3f770 --- /dev/null +++ b/fake_home/vim_templates/skeleton.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "Hello, world!"