mirror of https://github.com/mitchell/dotfiles.git
Modify config.fish to be more functional
This commit is contained in:
parent
11fbcca723
commit
84fb6c23f8
|
@ -1,4 +1,5 @@
|
||||||
# variables
|
# _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
|
||||||
|
@ -23,10 +24,10 @@ set -gx PATH $PATH $GOBIN \
|
||||||
$HOME/code/flutter/bin \
|
$HOME/code/flutter/bin \
|
||||||
$HOME/.cargo/bin \
|
$HOME/.cargo/bin \
|
||||||
$HOME/.dotnet/tools
|
$HOME/.dotnet/tools
|
||||||
|
end
|
||||||
|
|
||||||
set -g uname (uname)
|
# _source_imports loads any additional fish files in at init
|
||||||
|
function _source_imports -a uname
|
||||||
# source imports
|
|
||||||
command -sq kitty; and kitty + complete setup fish | source
|
command -sq kitty; and kitty + complete setup fish | source
|
||||||
|
|
||||||
switch $uname
|
switch $uname
|
||||||
|
@ -40,12 +41,16 @@ end
|
||||||
|
|
||||||
# The next line updates PATH for the Google Cloud SDK.
|
# The next line updates PATH for the Google Cloud SDK.
|
||||||
# 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
|
||||||
|
|
||||||
# aliases
|
# _set_aliases sets aliases for commonly used command
|
||||||
|
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)'
|
||||||
alias vg 'vagrant'
|
alias vg 'vagrant'
|
||||||
|
alias tocb 'xclip -in -selection clipboard'
|
||||||
|
alias fromcb 'xclip -out -selection clipboard'
|
||||||
|
|
||||||
switch $uname
|
switch $uname
|
||||||
case Linux
|
case Linux
|
||||||
|
@ -59,18 +64,51 @@ switch $uname
|
||||||
alias rider 'open -a Rider'
|
alias rider 'open -a Rider'
|
||||||
alias webstorm 'open -a Webstorm'
|
alias webstorm 'open -a Webstorm'
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# _define_functions defines a couple of small globally available functions
|
||||||
|
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
|
||||||
nvim temp.$ft
|
set -l file "._temp.$ft"
|
||||||
|
|
||||||
|
touch $file
|
||||||
|
$EDITOR $file
|
||||||
|
rm $file
|
||||||
|
end
|
||||||
|
|
||||||
|
function _editcb -a uname ft
|
||||||
|
set -l file "._temp.$ft"
|
||||||
|
touch $file
|
||||||
|
|
||||||
switch $uname
|
switch $uname
|
||||||
case Linux
|
case Linux
|
||||||
xclip -selection clipboard < temp.$ft
|
xclip -out -selection clipboard > $file
|
||||||
case Darwin
|
case Darwin
|
||||||
pbcopy < temp.$ft
|
pbpaste > $file
|
||||||
end
|
end
|
||||||
|
|
||||||
rm temp.$ft
|
$EDITOR $file
|
||||||
|
|
||||||
|
switch $uname
|
||||||
|
case Linux
|
||||||
|
xclip -in -selection clipboard < $file
|
||||||
|
case Darwin
|
||||||
|
pbcopy < $file
|
||||||
end
|
end
|
||||||
|
|
||||||
|
rm $file
|
||||||
|
end
|
||||||
|
|
||||||
|
alias editcb "_editcb $uname"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Determine OS
|
||||||
|
set -l uname (uname)
|
||||||
|
|
||||||
|
# Begin profile init
|
||||||
|
_define_variables
|
||||||
|
_source_imports $uname
|
||||||
|
_set_aliases $uname
|
||||||
|
_define_functions $uname
|
||||||
|
|
Loading…
Reference in New Issue