Fixes for MacOS

This commit is contained in:
hedy 2023-01-13 17:13:11 +08:00
parent a1c30cfcab
commit cc00374c88
Signed by: hedy
GPG Key ID: B51B5A8D1B176372
4 changed files with 30 additions and 15 deletions

View File

@ -5,8 +5,22 @@
# For fish see ~/dotscripts/setup/fish and ~/.config/fish/config.fish # For fish see ~/dotscripts/setup/fish and ~/.config/fish/config.fish
# Determine current running shell. # Determine current running shell.
# unix.stackexchange.com/questions/71121/ (comment by frostschutz) # https://unix.stackexchange.com/a/72475
CURSHELL="$(sed -re 's/\x0.*//' /proc/$$/cmdline)" if test -n "$ZSH_VERSION"; then
CURSHELL=zsh
elif test -n "$FISH_VERSION"; then
CURSHELL=fish
elif test -n "$BASH_VERSION"; then
CURSHELL=bash
elif test -n "$KSH_VERSION"; then
CURSHELL=ksh
elif test -n "$FCEDIT"; then
CURSHELL=ksh
elif test -n "$PS3"; then
CURSHELL=unknown
else
CURSHELL=sh
fi
# Add the paths # Add the paths
export PATH="$(~/bin/parse_addpath | sed 's/ /:/g'):$PATH" export PATH="$(~/bin/parse_addpath | sed 's/ /:/g'):$PATH"

View File

@ -1,18 +1,19 @@
#!/usr/bin/env fish #!/usr/bin/env bash
# TODO: Use aerc instead
# Stubbornly translates ~/.exportenvs to ~/.exportenvs.fish # Stubbornly translates ~/.exportenvs to ~/.exportenvs.fish
echo "" > ~/.exportenvs.fish # clear the file echo "" > ~/.exportenvs.fish # clear the file
for fileline in (cat ~/.exportenvs | sed 's/#!.\+$/#!\/usr\/bin\/env fish/') while read fileline; do
set line (echo "$fileline" | sed 's/export //' | sed 's/#.\+//') line=$(echo "$fileline" | sed 's/#. sed 's/export //' | sed 's/#\.\+//')
if test -z "$line" if [ -z "$line" ]; then
echo "Adding '$fileline' as-is" echo "Adding '$fileline' as-is"
echo "$fileline" >> ~/.exportenvs.fish echo "$fileline" >> ~/.exportenvs.fish
continue continue
end fi
set name (echo "$line" | sed 's/=.\+$//' | sed 's/^$//') tline=$(echo "$line" | sed 's/=/ /')
set content (echo "$line" | sed 's/^.\+=//' | sed 's/\$(/(/') echo Adding "$tline"
echo "Adding $name with $content" echo "set -x $tline" >> ~/.exportenvs.fish
echo set -x "$name" $content >> ~/.exportenvs.fish done < ~/.exportenvs
end

View File

@ -9,8 +9,8 @@ DEST=${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim"
if ! [[ -f "$DEST" ]]; then if ! [[ -f "$DEST" ]]; then
echo "installing vim-plug for nvim" echo "installing vim-plug for nvim"
sh -c 'curl -fLo "$DEST" --create-dirs \ curl -fLo "$DEST" --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
echo "installing nvim plugins" echo "installing nvim plugins"
nvim +PlugInstall +qall nvim +PlugInstall +qall
else else

View File

@ -1,5 +1,5 @@
function! IsWSL() function! IsWSL()
if has("unix") if has("unix") && !has("mac")
let lines = readfile("/proc/version") let lines = readfile("/proc/version")
if lines[0] =~ "Microsoft" if lines[0] =~ "Microsoft"
return 1 return 1