From cac1b3176a3087ccf486bbfcbe285bd558b61879 Mon Sep 17 00:00:00 2001 From: DuckDuckWhale Date: Thu, 6 Apr 2023 12:35:40 -0700 Subject: [PATCH] Misc: bash, rust, helix - Fix: `.bashrc` not loaded when `.bash_login` doesn't exist - Fix: Rust install script error when `cc` doesn't exist - Style: use tabs - Helix: use tabs for bash, toml, & markdown - Helix: highlight rust scripts --- auto/bash/bash | 16 +++++++++++++++- manual/helix/helix | 40 ++++++++++++++++++++++++---------------- manual/rust/rust | 18 +++++++++++------- 3 files changed, 50 insertions(+), 24 deletions(-) diff --git a/auto/bash/bash b/auto/bash/bash index d23a444..7b60e0e 100755 --- a/auto/bash/bash +++ b/auto/bash/bash @@ -39,10 +39,24 @@ EOF if [ -f ~/.bash_profile ]; then mv ~/.bash_profile ~/.bash_login fi -cat >> ~/.bash_login << 'EOF' +if [ -f ~/.bash_login ]; then + cat >> ~/.bash_login << 'EOF' # custom +EOF +else + cat >> ~/.bash_login << 'EOF' + +# custom + +if [ -f ~/.bashrc ]; then + . ~/.bashrc +fi + +EOF +fi +cat >> ~/.bash_login << 'EOF' if [ -z "$TMUX" ] && [ -n "$SSH_TTY" ]; then tput sc tput smso diff --git a/manual/helix/helix b/manual/helix/helix index 5e4bde0..d636075 100755 --- a/manual/helix/helix +++ b/manual/helix/helix @@ -1,22 +1,22 @@ #!/bin/sh -e if [ "$1" = '-f' ]; then - force=true + force=true fi if ! command -v cargo > /dev/null; then - echo "Error: cargo not found" - exit 1 + echo "Error: cargo not found" + exit 1 fi if ! command -v c++ > /dev/null; then - echo "Error: c++ not found" - exit 1 + echo "Error: c++ not found" + exit 1 fi if [ -d ~/.config/helix ]; then - if [ "$force" = true ]; then - rm -rf ~/.config/helix - else - echo "Error: helix config files already exist; use -f to force erase and reinstall" - exit 1 - fi + if [ "$force" = true ]; then + rm -rf ~/.config/helix + else + echo "Error: helix config files already exist; use -f to force erase and reinstall" + exit 1 + fi fi rm -rf helix-git git clone --depth 1 --branch 23.03 https://github.com/helix-editor/helix helix-git @@ -38,7 +38,7 @@ rulers = [101] left = ["mode", "spinner", "file-name"] center = ["position-percentage"] right = [ - "version-control", "diagnostics", "selections", "position", "file-encoding", "file-line-ending" + "version-control", "diagnostics", "selections", "position", "file-encoding", "file-line-ending" ] [keys.normal] @@ -54,9 +54,9 @@ auto-pairs = false [[language]] name = 'rust' -indent.unit = "\t" -indent.tab-width = 4 +indent = { tab-width = 4, unit = "\t" } config.checkOnSave = { command = "clippy" } +shebangs = ["rust-script"] [[language]] name = "c" @@ -68,11 +68,19 @@ indent = { tab-width = 4, unit = "\t" } [[language]] name = 'java' -indent.unit = "\t" -indent.tab-width = 4 +indent = { tab-width = 4, unit = "\t" } + +[[language]] +name = "bash" +indent = { tab-width = 4, unit = "\t" } + +[[language]] +name = "toml" +indent = { tab-width = 4, unit = "\t" } [[language]] name = "markdown" +indent = { tab-width = 4, unit = "\t" } language-server = { command = "ltex-ls" } file-types = ["md"] scope = "source.markdown" diff --git a/manual/rust/rust b/manual/rust/rust index e7a95ff..3d30b38 100755 --- a/manual/rust/rust +++ b/manual/rust/rust @@ -1,18 +1,22 @@ #!/bin/sh -e if [ $# -gt 2 ]; then - echo "Usage: $0 [-f]" - exit 1 + echo "Usage: $0 [-f]" + exit 1 fi if [ "$1" = '-f' ]; then - force=true + force=true fi if ! command -v curl > /dev/null; then - echo "Error: curl not found" - exit 1 + echo "Error: curl not found" + exit 1 +fi +if ! command -v cc > /dev/null; then + echo "Error: cc not found" + exit 1 fi if command -v cargo > /dev/null && [ "$force" != true ]; then - echo "Error: rust already installed; use -f to force" - exit 1 + echo "Error: rust already installed; use -f to force" + exit 1 fi curl --proto '=https' --tlsv1.3 -sSf https://sh.rustup.rs | sh -s -- -y . "$HOME/.cargo/env"