mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-24 04:21:31 +01:00
misc improvements. archlinux: also installing yay
This commit is contained in:
parent
3c048d2d48
commit
a0fe7ac1f2
|
@ -2,24 +2,21 @@
|
||||||
env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT DOTFILES=$DOTFILES zsh -f $DOTFILES/check_for_update.sh
|
env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT DOTFILES=$DOTFILES zsh -f $DOTFILES/check_for_update.sh
|
||||||
|
|
||||||
# oh-my-zsh plugins (some of these have to be installed by running install.sh or install_zsh_plugins, found in install.sh)
|
# oh-my-zsh plugins (some of these have to be installed by running install.sh or install_zsh_plugins, found in install.sh)
|
||||||
shared_plugins=(git alias-tips sudo common-aliases fast-syntax-highlighting zsh-autosuggestions colored-man-pages zsh-navigation-tools zsh_reload themes )
|
shared_plugins=(git alias-tips sudo common-aliases fast-syntax-highlighting zsh-autosuggestions colored-man-pages zsh-navigation-tools zsh_reload themes)
|
||||||
|
|
||||||
uname=$(uname -a)
|
uname=$(uname -a)
|
||||||
if [[ $uname == *"Darwin"* ]]; then
|
if [[ $uname == *"Darwin"* ]]; then
|
||||||
if [[ $(which brew) ]]; then
|
if [[ $(which port) ]]; then
|
||||||
os_extra=(osx brew)
|
|
||||||
elif [[ $(which port) ]]; then
|
|
||||||
os_extra=(osx macports)
|
os_extra=(osx macports)
|
||||||
else
|
else
|
||||||
os_extra=(osx)
|
os_extra=(osx)
|
||||||
fi
|
fi
|
||||||
elif [[ $uname == *"ARCH"* ]]; then
|
elif [[ $uname == *"ARCH"* ]]; then
|
||||||
os_extra=(archlinux)
|
os_extra=(archlinux systemd)
|
||||||
elif [[ $uname == *"Debian"* ]]; then
|
elif [[ $uname == *"Debian"* ]]; then
|
||||||
os_extra=(debian)
|
os_extra=(debian)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# https://www.xkcd.com/378/
|
# https://www.xkcd.com/378/
|
||||||
export EDITOR="vim"
|
export EDITOR="vim"
|
||||||
|
|
||||||
|
@ -44,4 +41,3 @@ if [ -f $colors_file ]; then source $colors_file; else echo "[brethil-dotfiles]
|
||||||
|
|
||||||
### SETUP PATHS ####
|
### SETUP PATHS ####
|
||||||
export PATH=$PATH:$HOME/bin
|
export PATH=$PATH:$HOME/bin
|
||||||
#export PYTHONPATH=$PYTHONPATH:$HOME/python/:$HOME/bin
|
|
17
functions.sh
17
functions.sh
|
@ -5,17 +5,17 @@
|
||||||
function dotfiles_selfupdate
|
function dotfiles_selfupdate
|
||||||
{
|
{
|
||||||
# Pull dotfiles
|
# Pull dotfiles
|
||||||
(cd $DOTFILES; git pull)
|
(cd $DOTFILES; git pull --rebase)
|
||||||
WD=$PWD
|
WD=$PWD
|
||||||
# Update all git repos in $ZSH/custom/plugins
|
# Update all git repos in $ZSH/custom/plugins
|
||||||
cd $ZSH/custom/plugins
|
cd "$ZSH/custom/plugins"
|
||||||
for folder in $(ls); do
|
for folder in *; do
|
||||||
if [[ -f "$folder/.git" ]]; then
|
if [[ -f "$folder/.git" ]]; then
|
||||||
(cd $folder; git pull)
|
(cd $folder; git pull)
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
# go back to previous working directory
|
# go back to previous working directory
|
||||||
cd $WD
|
cd "$WD"
|
||||||
}
|
}
|
||||||
|
|
||||||
## get cheat sheets for commands from cheat.sh. Usage: cheat commandname
|
## get cheat sheets for commands from cheat.sh. Usage: cheat commandname
|
||||||
|
@ -198,12 +198,6 @@ function ramdisk
|
||||||
echo " $ diskutil eject $mydev"
|
echo " $ diskutil eject $mydev"
|
||||||
}
|
}
|
||||||
|
|
||||||
## Anybar support https://github.com/tonsky/AnyBar
|
|
||||||
function anybar
|
|
||||||
{
|
|
||||||
echo -n $1 | nc -4u -w0 localhost ${2:-1738};
|
|
||||||
}
|
|
||||||
|
|
||||||
## Open a pdf version of the man in Preview
|
## Open a pdf version of the man in Preview
|
||||||
function man2pdf
|
function man2pdf
|
||||||
{
|
{
|
||||||
|
@ -221,7 +215,7 @@ function nman
|
||||||
}
|
}
|
||||||
fi # end of mac-specific functions
|
fi # end of mac-specific functions
|
||||||
|
|
||||||
# Force update git repo from origin/master# Force update git repo from origin/master# Force update git repo from origin/master
|
# Force update git repo from origin/master
|
||||||
function gitupdate(){
|
function gitupdate(){
|
||||||
git fetch --all
|
git fetch --all
|
||||||
git reset --hard origin/master
|
git reset --hard origin/master
|
||||||
|
@ -233,6 +227,7 @@ function pipupdate(){
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# dotfiles user functions
|
||||||
if [[ -f ~/.dotfiles_functions ]]; then
|
if [[ -f ~/.dotfiles_functions ]]; then
|
||||||
source ~/.dotfiles_functions
|
source ~/.dotfiles_functions
|
||||||
fi
|
fi
|
||||||
|
|
82
install.sh
82
install.sh
|
@ -10,6 +10,13 @@ echo -e "\n\n# brethil's dotfiles:" >> $ZSHTMP
|
||||||
echo "DOTFILES=$DOTFILES" >> $ZSHTMP
|
echo "DOTFILES=$DOTFILES" >> $ZSHTMP
|
||||||
echo "source \$DOTFILES/brethil_dotfile.sh" >> $ZSHTMP
|
echo "source \$DOTFILES/brethil_dotfile.sh" >> $ZSHTMP
|
||||||
echo -e "# End of brethil's dotfiles\n\n"
|
echo -e "# End of brethil's dotfiles\n\n"
|
||||||
|
|
||||||
|
function setup_git {
|
||||||
|
# set up some git stuff
|
||||||
|
git config --global pull.ff only
|
||||||
|
git config --global merge.ff only
|
||||||
|
}
|
||||||
|
|
||||||
function install_rmate {
|
function install_rmate {
|
||||||
# Install python version of the textmate rmate remote (from github)
|
# Install python version of the textmate rmate remote (from github)
|
||||||
if [[ $(whoami) == "root" ]]; then
|
if [[ $(whoami) == "root" ]]; then
|
||||||
|
@ -19,7 +26,7 @@ function install_rmate {
|
||||||
fi
|
fi
|
||||||
if [[ -f $destpath/rmate ]]; then
|
if [[ -f $destpath/rmate ]]; then
|
||||||
echo "rmate already exists: not installed"
|
echo "rmate already exists: not installed"
|
||||||
return -1
|
return 1
|
||||||
else
|
else
|
||||||
curl -sL https://raw.githubusercontent.com/sclukey/rmate-python/master/bin/rmate > $destpath/rmate
|
curl -sL https://raw.githubusercontent.com/sclukey/rmate-python/master/bin/rmate > $destpath/rmate
|
||||||
chmod a+x $destpath/rmate
|
chmod a+x $destpath/rmate
|
||||||
|
@ -31,18 +38,19 @@ function install_rmate {
|
||||||
|
|
||||||
function install_vimrc {
|
function install_vimrc {
|
||||||
# Install vimrc from github.com/amix/vimrc
|
# Install vimrc from github.com/amix/vimrc
|
||||||
git clone https://github.com/amix/vimrc.git $HOME/.vim_runtime && sh $HOME/.vim_runtime/install_awesome_vimrc.sh || return -1
|
git clone "https://github.com/amix/vimrc.git" "$HOME/.vim_runtime" && sh "$HOME/.vim_runtime/install_awesome_vimrc.sh" || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function install_zsh_plugins {
|
function install_zsh_plugins {
|
||||||
# Install fast-syntax-highlighting (git: zdharma), zsh-autosuggestions (git:zsh-users)
|
# Install fast-syntax-highlighting (git: zdharma), zsh-autosuggestions (git:zsh-users), alias-tips
|
||||||
ZSH_PLUGINS="$HOME/.oh-my-zsh/custom/plugins"
|
ZSH_PLUGINS="$HOME/.oh-my-zsh/custom/plugins"
|
||||||
mkdir -p $ZSH_PLUGINS
|
mkdir -p "$ZSH_PLUGINS"
|
||||||
git clone https://github.com/zdharma/fast-syntax-highlighting.git ${ZSH_PLUGINS}/fast-syntax-highlighting || error=true
|
git clone https://github.com/zdharma/fast-syntax-highlighting.git "${ZSH_PLUGINS}/fast-syntax-highlighting" || error=true
|
||||||
git clone git://github.com/zsh-users/zsh-autosuggestions ${ZSH_PLUGINS}/zsh-autosuggestions || error=true
|
git clone https://github.com/zsh-users/zsh-autosuggestions "${ZSH_PLUGINS}/zsh-autosuggestions" || error=true
|
||||||
|
git clone https://github.com/djui/alias-tips.git "${ZSH_PLUGINS}/alias-tips" || error=true
|
||||||
if [[ $error ]]; then
|
if [[ $error ]]; then
|
||||||
return -1
|
return 1
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
@ -77,30 +85,33 @@ function create_ssh_config {
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
exec 3>&1 # save stdout file descriptor
|
||||||
|
exec 1>$ssh_config # redirect everything below to the $ssh_config file
|
||||||
if [[ "$modifyssh" != "n" ]]
|
if [[ "$modifyssh" != "n" ]]
|
||||||
then
|
then
|
||||||
echo "# brethil's dotfiles setup start" >> $ssh_config
|
echo "# brethil's dotfiles setup start"
|
||||||
echo 'TCPKeepAlive=yes' >> $ssh_config
|
echo 'TCPKeepAlive=yes'
|
||||||
echo 'ServerAliveCountMax=6' >> $ssh_config
|
echo 'ServerAliveCountMax=6'
|
||||||
|
|
||||||
echo "## Uncomment to enable compression for all ssh sessions" >> $ssh_config
|
echo "## Uncomment to enable compression for all ssh sessions"
|
||||||
echo '#Compression=yes' >> $ssh_config
|
echo '#Compression=yes'
|
||||||
|
|
||||||
echo '## Uncomment the following to enable ssh ControlMaster and ssh session persistence' >> $ssh_config
|
echo '## Uncomment the following to enable ssh ControlMaster and ssh session persistence'
|
||||||
echo '#ControlMaster auto' >> $ssh_config
|
echo '#ControlMaster auto'
|
||||||
echo '#ControlPath /tmp/%r@%h:%p' >> $ssh_config
|
echo '#ControlPath /tmp/%r@%h:%p'
|
||||||
echo '#ControlPersist yes' >> $ssh_config
|
echo '#ControlPersist yes'
|
||||||
echo 'Host *' >> $ssh_config
|
echo 'Host *'
|
||||||
echo 'ServerAliveInterval 300' >> $ssh_config
|
echo 'ServerAliveInterval 300'
|
||||||
echo '## Enable the following if you want to use the rmate textmate remote' >> $ssh_config
|
echo '## Enable the following if you want to use the rmate textmate remote'
|
||||||
echo "#Host *" >> $ssh_config
|
echo "#Host *"
|
||||||
echo "#RemoteForward 52698 localhost:52698" >> $ssh_config
|
echo "#RemoteForward 52698 localhost:52698"
|
||||||
echo '## Enable the following if you want to use a reverse ssh tunnel to use mecp command on remote hosts' >> $ssh_config
|
echo '## Enable the following if you want to use a reverse ssh tunnel to use mecp command on remote hosts'
|
||||||
echo "Host *" >> $ssh_config
|
echo "Host *"
|
||||||
echo "Remoteforward 2222 localhost:22" >> $ssh_config
|
echo "Remoteforward 2222 localhost:22"
|
||||||
echo '# end of brethil dotfiles setup #' >> $ssh_config
|
echo '# end of brethil dotfiles setup #'
|
||||||
|
|
||||||
echo ".ssh/ssh_config configured check it to enable custom options:"
|
exec 1>&3 # restore stdout
|
||||||
|
echo ".ssh/ssh_config configured. Edit it to enable custom options:"
|
||||||
echo "- Compression"
|
echo "- Compression"
|
||||||
echo "- Remote forwarding port 52698->52698 (Textmate rmate remote)"
|
echo "- Remote forwarding port 52698->52698 (Textmate rmate remote)"
|
||||||
echo "- Remote forwarding remote:2222->localhost:22 (mecp)"
|
echo "- Remote forwarding remote:2222->localhost:22 (mecp)"
|
||||||
|
@ -126,7 +137,7 @@ function brethil_dotfiles_setup {
|
||||||
# mtr: mytraceroute, traceroute tool
|
# mtr: mytraceroute, traceroute tool
|
||||||
# pv: pipe view, monitor the progress of data through a pipe
|
# pv: pipe view, monitor the progress of data through a pipe
|
||||||
# byobu: tmux wrapper
|
# byobu: tmux wrapper
|
||||||
packages="zsh git grc ccze bmon mtr pv tmux byobu"
|
packages="zsh git grc ccze bmon mtr pv tmux byobu htop"
|
||||||
|
|
||||||
# Check if running as root, if try using sudo to install packages.
|
# Check if running as root, if try using sudo to install packages.
|
||||||
# If sudo is not installed, launch a shell to try and install it
|
# If sudo is not installed, launch a shell to try and install it
|
||||||
|
@ -153,6 +164,7 @@ function brethil_dotfiles_setup {
|
||||||
if [[ $(which apt-get ) ]]; then
|
if [[ $(which apt-get ) ]]; then
|
||||||
install_command="${sudo}apt-get install"
|
install_command="${sudo}apt-get install"
|
||||||
elif [[ $(which pacman) ]]; then
|
elif [[ $(which pacman) ]]; then
|
||||||
|
packages="$packages yay" # also install the yay aur package manager
|
||||||
install_command="${sudo}pacman -Sy"
|
install_command="${sudo}pacman -Sy"
|
||||||
elif [[ $(which yum) ]]; then
|
elif [[ $(which yum) ]]; then
|
||||||
install_command="${sudo}yum"
|
install_command="${sudo}yum"
|
||||||
|
@ -165,13 +177,15 @@ function brethil_dotfiles_setup {
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# actually install the packages:
|
||||||
$install_command $packages
|
$install_command $packages
|
||||||
|
|
||||||
# Install oh-my-zsh
|
# Install oh-my-zsh
|
||||||
echo "Installing oh-my-zsh..."
|
echo "Installing oh-my-zsh..."
|
||||||
sh -c "$(curl -sL zsh.dioporc.one)"
|
sh -c "$(curl -sL zsh.dioporc.one | sed 's/env zsh/#env zsh/')" # comment the part that launches zsh
|
||||||
|
|
||||||
# oh-my-zsh's zshrc has been installed, prepend the dotfiles setup to it
|
# oh-my-zsh's zshrc has been installed, prepend the dotfiles setup to it
|
||||||
cat $HOME/.zshrc >> $ZSHTMP
|
cat "$HOME/.zshrc" >> $ZSHTMP
|
||||||
mv $ZSHTMP $HOME/.zshrc
|
mv $ZSHTMP $HOME/.zshrc
|
||||||
|
|
||||||
# Increase history size
|
# Increase history size
|
||||||
|
@ -188,19 +202,21 @@ function brethil_dotfiles_setup {
|
||||||
echo 'bind-key m source $BYOBU_PREFIX/share/byobu/keybindings/mouse.tmux.enable \; display-message "Mouse: ON"' >> ~/.tmux.conf
|
echo 'bind-key m source $BYOBU_PREFIX/share/byobu/keybindings/mouse.tmux.enable \; display-message "Mouse: ON"' >> ~/.tmux.conf
|
||||||
echo 'bind-key M source $BYOBU_PREFIX/share/byobu/keybindings/mouse.tmux.disable \; display-message "Mouse: Off"' >> ~/.tmux.conf
|
echo 'bind-key M source $BYOBU_PREFIX/share/byobu/keybindings/mouse.tmux.disable \; display-message "Mouse: Off"' >> ~/.tmux.conf
|
||||||
|
|
||||||
# Install the rmate client for textmate
|
## Install the rmate client for textmate
|
||||||
inhstall_rmate && echo "Installed rmate Textmate remote "|| echo "Failed to install rmate Textmate remote"
|
#install_rmate && echo "Installed rmate Textmate remote "|| echo "Failed to install rmate Textmate remote"
|
||||||
|
|
||||||
# Install vim awesomerc (git amix/vimrc)
|
# Install vim awesomerc (git amix/vimrc)
|
||||||
install_vimrc && echo "Installed vim awesome rc" || echo "Failed to install vim awesome rc"
|
install_vimrc && echo "Installed vim awesome rc" || echo "Failed to install vim awesome rc"
|
||||||
# Create ssh config
|
# Create ssh config
|
||||||
create_ssh_config
|
create_ssh_config
|
||||||
|
# git config
|
||||||
|
setup_git
|
||||||
|
|
||||||
# Install new zsh plugins in $ZSH/custom/plugins/
|
# Install new zsh plugins in $ZSH/custom/plugins/
|
||||||
install_zsh_plugins && echo "Installed custom zsh plugins in $ZSH/custom/plugins/" || echo "Failed to install custom zsh plugins"
|
install_zsh_plugins && echo "Installed custom zsh plugins in $ZSH/custom/plugins/" || echo "Failed to install custom zsh plugins"
|
||||||
|
|
||||||
# Source the plugins defined in brethil_dotfile.sh ($plugins)
|
# Source the plugins defined in brethil_dotfile.sh ($plugins)
|
||||||
if [[ $(uname) == "Darwin" ]]; then # MacOS has a different syntax for sed
|
if [[ $(uname) == "Darwin" ]]; then
|
||||||
sed -i "" -e 's/plugins=.*/plugins=\( $plugins \)/' $HOME/.zshrc
|
sed -i "" -e 's/plugins=.*/plugins=\( $plugins \)/' $HOME/.zshrc
|
||||||
else
|
else
|
||||||
sed -i -e 's/plugins=.*/plugins=\( $plugins \)/' $HOME/.zshrc
|
sed -i -e 's/plugins=.*/plugins=\( $plugins \)/' $HOME/.zshrc
|
||||||
|
@ -217,6 +233,8 @@ function brethil_dotfiles_setup {
|
||||||
else
|
else
|
||||||
sed -i 's/ZSH_THEME=".*"/ZSH_THEME="brethil"/' $HOME/.zshrc
|
sed -i 's/ZSH_THEME=".*"/ZSH_THEME="brethil"/' $HOME/.zshrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#TODO: replace brethil theme with powerline?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user