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
This commit is contained in:
		
							parent
							
								
									38ec154801
								
							
						
					
					
						commit
						cac1b3176a
					
				@ -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
 | 
			
		||||
 | 
			
		||||
@ -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"
 | 
			
		||||
 | 
			
		||||
@ -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"
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user