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
# Determine current running shell.
# unix.stackexchange.com/questions/71121/ (comment by frostschutz)
CURSHELL="$(sed -re 's/\x0.*//' /proc/$$/cmdline)"
# https://unix.stackexchange.com/a/72475
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
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
echo "" > ~/.exportenvs.fish # clear the file
for fileline in (cat ~/.exportenvs | sed 's/#!.\+$/#!\/usr\/bin\/env fish/')
set line (echo "$fileline" | sed 's/export //' | sed 's/#.\+//')
if test -z "$line"
while read fileline; do
line=$(echo "$fileline" | sed 's/#. sed 's/export //' | sed 's/#\.\+//')
if [ -z "$line" ]; then
echo "Adding '$fileline' as-is"
echo "$fileline" >> ~/.exportenvs.fish
continue
end
set name (echo "$line" | sed 's/=.\+$//' | sed 's/^$//')
set content (echo "$line" | sed 's/^.\+=//' | sed 's/\$(/(/')
echo "Adding $name with $content"
echo set -x "$name" $content >> ~/.exportenvs.fish
end
fi
tline=$(echo "$line" | sed 's/=/ /')
echo Adding "$tline"
echo "set -x $tline" >> ~/.exportenvs.fish
done < ~/.exportenvs

View File

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

View File

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