-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·66 lines (45 loc) · 3.19 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
cd "$(dirname "$0")"
set -o errexit -o errtrace -o pipefail
trap 'echo; echo Aborting.' ERR
ln -s `pwd`/vimrc ~/.vimrc
ln -s `pwd`/dircolors ~/.dircolors
git config --global core.excludesfile `pwd`/gitignore
git config --global diff.tool vimdiff
git config --global init.defaultBranch master # Silence "git init" message: "Using 'master' as the name for the initial branch. This default branch name is subject to change. ..."
git config --global merge.tool vimdiff
git config --global push.default simple
cat >>~/.hgrc <<EOF
# This file was generated by $(pwd)/$(basename "$0").
[ui]
ignore = $(pwd)/hgignore
%include $(pwd)/hgrc
EOF
append_if_not_already_in_file()
{
FILENAME=$1
TEXT=$2
grep --quiet --no-messages -x --fixed-strings "$TEXT" "$FILENAME" || echo "$TEXT" >> "$FILENAME"
}
zshrc() { append_if_not_already_in_file ~/.zshrc "$1"; }
profile() { append_if_not_already_in_file ~/.profile "$1"; }
append_if_not_already_in_file ~/.bashrc ". `pwd`/bashrc"
profile "export EDITOR='vim -X'"
profile 'export MAKEFLAGS="$MAKEFLAGS -j`getconf _NPROCESSORS_ONLN`"'
profile 'export XZ_DEFAULTS="-T0"'
mkdir -p ~/bin
VIMRUNTIME=`vim -e -T dumb --cmd 'exe "set t_cm=\<C-M>"|echo $VIMRUNTIME|quit' | tr -d '\015'` # (from Vim's help for VIMRUNTIME)
ln -sf "$VIMRUNTIME"/macros/less.sh ~/bin/vimless # xxx Vim's runtime path could change in future, e.g. when running a different version of Vim (note that "$VIMRUNTIME" is part of the symlink target); Make ~/bin/vimless a script that runs "$VIMRUNTIME/macros/less.sh" after determining the current Vim runtime path.
zshrc "set_output_carriage_return_with_new_line() { stty onlcr }"
zshrc "autoload -Uz add-zsh-hook"
zshrc "add-zsh-hook precmd set_output_carriage_return_with_new_line # zsh on Ubuntu 18.04.1 using WSL: Something (I don't know what) was often mucking up the terminal settings (new-lines output without carriage returns) - This is a workaround."
zshrc "disable -r time && alias time='time -f \"%E real, %U user, %S system\" ' # I like the wall-clock time to be output first. (zsh's in-built time command outputs it last.) zsh's in-built time command outputs to stdout. (This will output to stderr?)"
# Install z command for use from bash command line. z changes directory - pass it part of the pathname of a previously visited directory.
if [ ! -f ~/bin/z/z.sh ]; then
git clone https://github.com/rupa/z.git ~/bin/z
fi
echo About to install python3-dev and mono-complete.
sudo apt install --assume-yes python3-dev mono-complete # Install packages needed by YouCompleteMe Vim plugin. xxx It'd be nice to only ask for a password (run sudo) if a required packages isn't installed - See https://stackoverflow.com/a/10439058. xxx Move this to vimrc to be near the code that installs YouCompleteMe.
if [[ $(uname -r | grep WSL) ]]; then
sudo update-binfmts --package 'mono-runtime' --remove cli /usr/bin/mono # Without this (and with mono-runtime - part of mono-complete - installed and with systemd enabled) trying to run a Windows exe from WSL/Ubuntu doesn't work, e.g. "run-detectors: unable to find an interpreter for /mnt/c/Windows/system32/cmd.exe" is output when trying to run cmd.exe (Ubuntu 22.04.3, mono-runtime 6.8.0.105+dfsg-3.2).
fi