Refactor fish config for omf changes and provide better nosudo

This commit is contained in:
ViViDboarder 2015-11-03 15:04:57 -08:00
parent 2bc0282bdf
commit e07808421a
24 changed files with 156 additions and 101 deletions

View File

@ -0,0 +1,46 @@
# vim
alias nv='nvim'
alias tv='tmux-vim'
alias :q='exit'
# git
alias ga='git add'
alias gc='git commit'
alias gco='git checkout'
alias gd='git diff'
alias gl='git log'
alias gr='git rebase'
alias gs='git status'
alias tiga='tig --all'
# cd
alias cd..='cd ..'
# vim
alias mviml='env VIM_COLOR=github mvim'
# terminal-notifier
alias notify-done='terminal-notifier -message "Done"'
alias notify-success='terminal-notifier -message "Success"'
alias notify-fail='terminal-notifier -message "Failure"'
# function sh-notify
# ($argv) ;and notify-success ;or notify-fail
# end
# gl-notifire
alias gl-notify-done='gl-notifier "Done"'
alias gl-notify-success='gl-notifier "Success"'
alias gl-notify-fail='gl-notifier "Failure"'
# function gl-notify
# ($argv) ;and gl-notify-success ;or gl-notify-fail
# end
# gopush
alias pb-done='pb "Done"'
alias pb-success='pb "Success"'
alias pb-failure='pb "Failure"'
# function pb-notify
# ($argv) ;and pb-success ;or pb-failure
# end

View File

@ -0,0 +1,11 @@
# package bak
# package balias
package export
package extract
package force
package jump
package notify-funcs
package osx
package pbcopy
package port
theme thefij

View File

@ -0,0 +1,2 @@
source $OMF_CONFIG/paths.fish
source $OMF_CONFIG/alias.fish

View File

@ -0,0 +1 @@
thefij

View File

@ -1,13 +0,0 @@
Theme "thefij"
Plugin "theme"
Plugin "bak"
Plugin "balias"
Plugin "export"
Plugin "extract"
Plugin "jump"
Plugin "osx"
Plugin "pbcopy"
Plugin "port"
Plugin "force"
Plugin "notify-funcs"

View File

@ -1,46 +0,0 @@
# vim
balias nv='nvim'
balias tv='tmux-vim'
balias :q='exit'
# git
balias ga='git add'
balias gc='git commit'
balias gco='git checkout'
balias gd='git diff'
balias gl='git log'
balias gr='git rebase'
balias gs='git status'
balias tiga='tig --all'
# cd
balias cd..='cd ..'
# vim
balias mviml='env VIM_COLOR=github mvim'
# terminal-notifier
balias notify-done='terminal-notifier -message "Done"'
balias notify-success='terminal-notifier -message "Success"'
balias notify-fail='terminal-notifier -message "Failure"'
# function sh-notify
# ($argv) ;and notify-success ;or notify-fail
# end
# gl-notifire
balias gl-notify-done='gl-notifier "Done"'
balias gl-notify-success='gl-notifier "Success"'
balias gl-notify-fail='gl-notifier "Failure"'
# function gl-notify
# ($argv) ;and gl-notify-success ;or gl-notify-fail
# end
# gopush
balias pb-done='pb "Done"'
balias pb-success='pb "Success"'
balias pb-failure='pb "Failure"'
# function pb-notify
# ($argv) ;and pb-success ;or pb-failure
# end

View File

@ -6,22 +6,29 @@
function init_paths_and_vars { function init_paths_and_vars {
# Directory for projects # Directory for projects
WORKSPACE=$HOME/workspace WORKSPACE="$HOME/workspace"
# This is in bashrc # This is in bashrc
USER_BIN=$HOME/bin USER_BIN="$HOME/bin"
# Local prefix
LOCAL_PREFIX="$HOME/usr/local"
# Temp dir for downloads # Temp dir for downloads
TMP_DIR=$PROJECT_DIR/tmp TMP_DIR="$PROJECT_DIR/tmp"
# System uname # System uname
UNAME_STR=`uname` UNAME_STR=`uname`
# XGD_DATA
XDG_DATA_HOME="$HOME/.local/share"
# XGD_CONFIG
XDG_CONFIG_HOME="$HOME/.config"
# Create workspace dir # Create workspace dir
mkdir -p $WORKSPACE mkdir -p $WORKSPACE
mkdir -p $USER_BIN mkdir -p $USER_BIN
mkdir -p $TMP_DIR mkdir -p $TMP_DIR
mkdir -p $XDG_DATA_HOME
mkdir -p $XDG_CONFIG_HOME
} }
function source_dotfile { function source_dotfile {
local RC_PATH=$1 local RC_PATH=$1
local RC_NAME=`basename $1` local RC_NAME=`basename $1`
local SOURCE_CMD="source" local SOURCE_CMD="source"

View File

@ -21,14 +21,13 @@ recipe () {
CURRENT_RECIPE_NAME=$1 CURRENT_RECIPE_NAME=$1
DEFAULT_ASSETS_PATH="$DIR/assets/default/$CURRENT_RECIPE_NAME" DEFAULT_ASSETS_PATH="$DIR/assets/default/$CURRENT_RECIPE_NAME"
COOKBOOK_ASSETS_PATH="$DIR/assets/$COOKBOOK_NAME/$CURRENT_RECIPE_NAME" COOKBOOK_ASSETS_PATH="$DIR/assets/$COOKBOOK_NAME/$CURRENT_RECIPE_NAME"
local custom_recipe="$DIR/recipes/custom/$CURRENT_RECIPE_NAME"
local default_recipe="$DIR/recipes/default/$CURRENT_RECIPE_NAME" local default_recipe="$DIR/recipes/default/$CURRENT_RECIPE_NAME"
local cookbook_recipe="$DIR/recipes/$COOKBOOK_NAME/$CURRENT_RECIPE_NAME"
if [ -f $custom_recipe ]; then if [ -f $cookbook_recipe ]; then
log "Running recipe '$custom_recipe'..." 1 log "Running recipe '$cookbook_recipe'..." 1
separator separator
. $custom_recipe . $cookbook_recipe
elif [ -f $default_recipe ]; then elif [ -f $default_recipe ]; then
log "Running recipe '$default_recipe'..." 1 log "Running recipe '$default_recipe'..." 1
separator separator

View File

@ -101,7 +101,8 @@ if $install_golang ; then
fi fi
if $install_fish ; then if $install_fish ; then
recipe 'fish' recipe 'fish-install'
recipe 'fish-config'
set_installed 'fish' set_installed 'fish'
fi fi

28
no-sudo
View File

@ -11,12 +11,12 @@
cd $(dirname $0) cd $(dirname $0)
PROJECT_DIR=$(pwd) PROJECT_DIR=$(pwd)
init_paths_and_vars
install_vim_src=false install_vim_src=false
if [ "$PACKAGE_MANAGER" == 'apt-get' ]; then is_installed "vim-from-source"
is_installed "vim-from-source" if prompt_yn "Compile vim?" ; then
if prompt_yn "Compile vim?" ; then install_vim_src=true
install_vim_src=true
fi
fi fi
install_vim_settings=false install_vim_settings=false
if ! is_installed "vim-settings" || prompt_yn "Reinstall vim-settings?" ; then if ! is_installed "vim-settings" || prompt_yn "Reinstall vim-settings?" ; then
@ -27,9 +27,11 @@ is_installed "salesforce"
if prompt_yn "Install Salesforce tools?" ; then if prompt_yn "Install Salesforce tools?" ; then
install_sfdc=true install_sfdc=true
fi fi
install_fish=false
# Create workspace dir is_installed "fish"
mkdir -p ~/workspace if prompt_yn "Install fish?" ; then
install_fish=true
fi
### Run recipes ### Run recipes
recipe 'dotfiles' recipe 'dotfiles'
@ -51,6 +53,16 @@ if $install_sfdc ; then
set_installed 'salesforce' set_installed 'salesforce'
fi fi
if $install_fish ; then
if ! command_exist fish ; then
recipe 'fish-install'
fi
if command_exist fish ; then
recipe 'fish-config'
set_installed 'fish'
fi
fi
### Show the Finished banner ### Show the Finished banner
finished finished

View File

@ -1,23 +0,0 @@
#! /bin/bash
if ! command_exist fish ; then
sudo_package 'fish'
fi
if [ ! -d $HOME/.oh-my-fish ]; then
curl -L https://github.com/bpinto/oh-my-fish/raw/master/tools/install.fish | fish
fi
OMF_CUSTOM=$DEFAULT_ASSETS_PATH/custom
FISH_CONFIG=$HOME/.config/fish/config.fish
if [ ! -f $FISH_CONFIG ]; then
touch $FISH_CONFIG
fi
add_line 'set fish_path $HOME/.oh-my-fish' $FISH_CONFIG
add_line "set fish_custom $OMF_CUSTOM" $FISH_CONFIG
add_line '. $fish_path/oh-my-fish.fish' $FISH_CONFIG
fish -c 'omf install'

View File

@ -0,0 +1,8 @@
#! /bin/bash
local omf_config="$XDG_CONFIG_HOME/omf"
try_link "$DEFAULT_ASSETS_PATH" "$omf_config"
if [ ! -d "$XDG_DATA_HOME/.omf" ]; then
curl -L https://github.com/oh-my-fish/oh-my-fish/raw/master/bin/install | fish
fi

View File

@ -0,0 +1,5 @@
#! /bin/bash
if ! command_exist fish ; then
sudo_package 'fish'
fi

View File

@ -22,7 +22,7 @@ if command_exist pip3 ; then
sudo pip3 install neovim sudo pip3 install neovim
fi fi
neovim_dir=$WORKSPACE/neovim local neovim_dir=$WORKSPACE/neovim
if [ ! -d $neovim_dir ]; then if [ ! -d $neovim_dir ]; then
log "Cloning neovim" log "Cloning neovim"

View File

@ -0,0 +1,31 @@
#!/bin/bash
local vim_dir="$WORKSPACE/vim"
# Build latest vim
if [ ! -d $vim_dir ]; then
hg clone https://vim.googlecode.com/ $vim_dir
fi
# Go to workspace
cd $vim_dir
# Use latest tagged source code
hg update -r 'max(tagged())'
# Configure vim with ruby, python and GTK
./configure --with-features=huge \
--enable-pythoninterp \
--enable-rubyinterp \
--enable-gui=gtk2 \
--prefix=$LOCAL_PREFIX
# Compile
make
# Install newly compiled vim
make install
# Link vi to vim out of convenience
vim_path=$(which vim)
sudo ln -s $vim_path ${vim_path:0:(-1)}
# Go back to previous directory
cd $ROOT_DIR

View File

@ -0,0 +1,14 @@
#! /bin/bash
log "Compiling and installing fish-shell to local prefix"
local fish_shell_dir=$WORKSPACE/fish-shell
if [ ! -d $fish_shell_dir ]; then
log "Cloning fish-shell"
git clone https://github.com/fish-shell/fish-shell $fish_shell_dir
else
(cd $fish_shell_dir && git pull)
fi
(cd $fish_shell_dir && ./configure --prefix=$LOCAL_PREFIX --disable-shared && make && make install)