Refactor config.fish and sync script

- General style cleanups
- Change user bin from ~/bin to ~/.local/bin
- Add ssh-rm-host alias
- Add back function
This commit is contained in:
mitchell 2020-07-27 21:42:56 -04:00
parent 2643d75f63
commit c2b679b51d
2 changed files with 29 additions and 21 deletions

View File

@ -1,5 +1,16 @@
# _define_variables defines all and exclusively globally exported variables function main
function _define_variables # Determine OS
set -l uname (uname)
# Begin profile init
define_variables
import_sources $uname
set_aliases $uname
define_functions $uname
end
# define_variables defines all and exclusively globally exported variables
function define_variables
set -gx AWS_SDK_LOAD_CONFIG true set -gx AWS_SDK_LOAD_CONFIG true
set -gx DOTNET_ENVIRONMENT Development set -gx DOTNET_ENVIRONMENT Development
@ -17,8 +28,7 @@ function _define_variables
set -gx LIBVIRT_DEFAULT_URI 'qemu:///system' set -gx LIBVIRT_DEFAULT_URI 'qemu:///system'
set -gx PATH $PATH $GOBIN \ set -gx PATH $PATH $GOBIN \
/snap/bin \ $HOME/.local/bin \
$HOME/bin \
$HOME/.pub-cache/bin \ $HOME/.pub-cache/bin \
$HOME/code/scripts \ $HOME/code/scripts \
$HOME/code/flutter/bin \ $HOME/code/flutter/bin \
@ -26,8 +36,8 @@ function _define_variables
$HOME/.dotnet/tools $HOME/.dotnet/tools
end end
# _source_imports loads any additional fish files in at init # import_sources loads any additional fish files in at init
function _source_imports -a uname function import_sources -a uname
command -q kitty; and kitty + complete setup fish | source command -q kitty; and kitty + complete setup fish | source
switch $uname switch $uname
@ -43,8 +53,8 @@ function _source_imports -a uname
# if test -f '/Users/m/Documents/google-cloud-sdk/path.fish.inc'; source '/Users/m/Documents/google-cloud-sdk/path.fish.inc'; end # if test -f '/Users/m/Documents/google-cloud-sdk/path.fish.inc'; source '/Users/m/Documents/google-cloud-sdk/path.fish.inc'; end
end end
# _set_aliases sets aliases for commonly used command # set_aliases sets aliases for commonly used command
function _set_aliases -a uname function set_aliases -a uname
alias cp 'rsync -aP' alias cp 'rsync -aP'
alias dm 'docker-machine' alias dm 'docker-machine'
alias v 'nvim (fzf)' alias v 'nvim (fzf)'
@ -52,6 +62,7 @@ function _set_aliases -a uname
alias tf 'terraform' alias tf 'terraform'
alias tocb 'xclip -in -selection clipboard' alias tocb 'xclip -in -selection clipboard'
alias fromcb 'xclip -out -selection clipboard' alias fromcb 'xclip -out -selection clipboard'
alias ssh-rm-host 'ssh-keygen -f ~/.ssh/known_hosts -R'
switch $uname switch $uname
case Linux case Linux
@ -67,8 +78,8 @@ function _set_aliases -a uname
end end
end end
# _define_functions defines a couple of small globally available functions # define_functions defines a couple of small globally available functions
function _define_functions -a uname function define_functions -a uname
function dm-env; eval (docker-machine env $argv); end function dm-env; eval (docker-machine env $argv); end
function temp -a ft function temp -a ft
@ -103,13 +114,12 @@ function _define_functions -a uname
end end
alias editcb "_editcb $uname" alias editcb "_editcb $uname"
function back
set log_name (string join _ $argv)
nohup $argv > "$log_name.out" &
echo "Log file: ./$log_name.out"
end
end end
# Determine OS main
set -l uname (uname)
# Begin profile init
_define_variables
_source_imports $uname
_set_aliases $uname
_define_functions $uname

4
sync
View File

@ -39,11 +39,9 @@ read -l -p "set_color red; printf '\n$prompt (Y/n) '; set_color normal" set_git_
if test -z "$set_git_user"; or test "$set_git_user" = 'y'; or test "$set_git_user" = 'Y' if test -z "$set_git_user"; or test "$set_git_user" = 'y'; or test "$set_git_user" = 'Y'
read -l -P 'name: ' name read -l -P 'name: ' name
git config --global user.name $name
read -l -P 'email: ' email read -l -P 'email: ' email
git config --global user.name $name
git config --global user.email $email git config --global user.email $email
end end