mirror of https://github.com/mitchell/dotfiles.git
Reformat all fish files
This commit is contained in:
parent
2f5438dc21
commit
0a0a2decef
|
@ -1,12 +1,12 @@
|
||||||
function configure_fish
|
function configure_fish
|
||||||
# Determine OS
|
# Determine OS
|
||||||
set uname (uname)
|
set uname (uname)
|
||||||
|
|
||||||
# Begin profile init
|
# Begin profile init
|
||||||
# (These functions are defined in the functions/ directory.)
|
# (These functions are defined in the functions/ directory.)
|
||||||
define_global_variables
|
define_global_variables
|
||||||
import_sources $uname
|
import_sources $uname
|
||||||
define_aliases $uname
|
define_aliases $uname
|
||||||
end
|
end
|
||||||
|
|
||||||
configure_fish
|
configure_fish
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
function back -d 'A shortcut for backgrounding a command using nohup and named log file'
|
function back -d 'A shortcut for backgrounding a command using nohup and named log file'
|
||||||
set log_name (string join _ $argv)
|
set log_name (string join _ $argv)
|
||||||
|
|
||||||
echo "log file: $log_name.out"
|
echo "log file: $log_name.out"
|
||||||
nohup $argv > "$log_name.out" &
|
nohup $argv > "$log_name.out" &
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
function dm-env -d 'Shortcut for setting your shell env for a docker-machine'
|
function dm-env -d 'Shortcut for setting your shell env for a docker-machine'
|
||||||
eval (docker-machine env $argv)
|
eval (docker-machine env $argv)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
function editcb -a ft -d 'Opens your editor to the cliboard\'s current contents.'
|
function editcb -a ft -d 'Opens your editor to the cliboard\'s current contents.'
|
||||||
set uname (uname)
|
set uname (uname)
|
||||||
set file "._temp.$ft"
|
set file "._temp.$ft"
|
||||||
|
|
||||||
touch $file
|
touch $file
|
||||||
|
|
||||||
switch "$uname"
|
switch "$uname"
|
||||||
case 'Linux'
|
case 'Linux'
|
||||||
xclip -out -selection clipboard > $file
|
xclip -out -selection clipboard > $file
|
||||||
case 'Darwin'
|
case 'Darwin'
|
||||||
pbpaste > $file
|
pbpaste > $file
|
||||||
end
|
end
|
||||||
|
|
||||||
$EDITOR $file
|
$EDITOR $file
|
||||||
|
|
||||||
switch "$uname"
|
switch "$uname"
|
||||||
case 'Linux'
|
case 'Linux'
|
||||||
xclip -in -selection clipboard < $file
|
xclip -in -selection clipboard < $file
|
||||||
case 'Darwin'
|
case 'Darwin'
|
||||||
pbcopy < $file
|
pbcopy < $file
|
||||||
end
|
end
|
||||||
|
|
||||||
rm $file
|
rm $file
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
function push_tasks -d 'Push tasks as a notification to your phone'
|
function push_tasks -d 'Push tasks as a notification to your phone'
|
||||||
set tasks (task +READY export | jq 'sort_by(.urgency) | reverse | map(@text "\(.description)\nLink: \(.link)") | join("\n\n")')
|
set tasks (task +READY export |
|
||||||
send_push $tasks
|
jq 'sort_by(.urgency) |
|
||||||
|
reverse |
|
||||||
|
map(@text "\(.description)\nLink: \(.link)") |
|
||||||
|
join("\n\n")')
|
||||||
|
send_push $tasks
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
function send_push -a message -d 'Send a push notification to your phone via pushover (optional delay as second arg)'
|
function send_push -a message -d 'Send a push notification to your phone via pushover (optional delay as second arg)'
|
||||||
if test -n "$argv[2]"; sleep $argv[2]; end
|
if test -n "$argv[2]"; sleep $argv[2]; end
|
||||||
|
|
||||||
set payload "{\"token\":\"$pushover_token\",\"user\":\"$pushover_user\",\"title\":\"Tasks\",\"message\":$message}"
|
set payload \
|
||||||
|
"{
|
||||||
|
\"token\": \"$pushover_token\",
|
||||||
|
\"user\": \"$pushover_user\",
|
||||||
|
\"title\": \"Tasks\",
|
||||||
|
\"message\": $message
|
||||||
|
}"
|
||||||
|
|
||||||
curl \
|
curl \
|
||||||
-X POST \
|
-X POST \
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
function tasko -a id -d 'Open the link of a taskwarrior task by id'
|
function tasko -a id -d 'Open the link of a taskwarrior task by id'
|
||||||
set link (task _get $id.link)
|
set link (task _get $id.link)
|
||||||
if test -n $link; open $link; end
|
if test -n $link; open $link; end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
function tasktime -a id time -d 'Set a time to check-in on task progress using pushover'
|
function tasktime -a id time -d 'Set a time to check-in on task progress using pushover'
|
||||||
set half_time (math $time/2)
|
set half_time (math $time/2)
|
||||||
set desc (task _get $id.description)
|
set desc (task _get $id.description)
|
||||||
|
|
||||||
task $id start
|
task $id start
|
||||||
|
|
||||||
fish -c "send_push '\"Half-time: $desc\"' $half_time" > /dev/null & disown
|
fish -c "send_push '\"Half-time: $desc\"' $half_time" > /dev/null & disown
|
||||||
fish -c "send_push '\"Timer over: $desc\"' $time" > /dev/null & disown
|
fish -c "send_push '\"Timer over: $desc\"' $time" > /dev/null & disown
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
function taskwiki -a id
|
function taskwiki -a id
|
||||||
set page (task _get $id.wiki)
|
set page (task _get $id.wiki)
|
||||||
|
|
||||||
if test -n $page
|
if test -n $page
|
||||||
$EDITOR +VimwikiIndex "+VimwikiGoto $page"
|
$EDITOR +VimwikiIndex "+VimwikiGoto $page"
|
||||||
else
|
else
|
||||||
echo 'no wiki file specified'
|
echo 'no wiki file specified'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# temp creates a temporary file in your editor, with the given filetype.
|
# temp creates a temporary file in your editor, with the given filetype.
|
||||||
function temp -a ft
|
function temp -a ft
|
||||||
set file "._temp.$ft"
|
set file "._temp.$ft"
|
||||||
|
|
||||||
touch $file
|
touch $file
|
||||||
$EDITOR $file
|
$EDITOR $file
|
||||||
rm $file
|
rm $file
|
||||||
end
|
end
|
||||||
|
|
108
sync
108
sync
|
@ -1,97 +1,97 @@
|
||||||
#!/usr/bin/env fish
|
#!/usr/bin/env fish
|
||||||
|
|
||||||
function main
|
function main
|
||||||
set start_dir (pwd)
|
set start_dir (pwd)
|
||||||
set cwd (string match -r '\w+$' $start_dir)
|
set cwd (string match -r '\w+$' $start_dir)
|
||||||
set uname (uname)
|
set uname (uname)
|
||||||
|
|
||||||
echo 'Syncing configuration files to your home dir...'
|
echo 'Syncing configuration files to your home dir...'
|
||||||
set_color grey
|
set_color grey
|
||||||
|
|
||||||
setup_tmp_space $cwd
|
setup_tmp_space $cwd
|
||||||
|
|
||||||
sync_files
|
sync_files
|
||||||
|
|
||||||
set_kitty_font_size $uname
|
set_kitty_font_size $uname
|
||||||
|
|
||||||
install_fisher_packages
|
install_fisher_packages
|
||||||
|
|
||||||
set_color normal
|
set_color normal
|
||||||
|
|
||||||
set_git_user
|
set_git_user
|
||||||
|
|
||||||
set_fish_universal_vars
|
set_fish_universal_vars
|
||||||
|
|
||||||
clean_up_tmp_space $cwd $start_dir
|
clean_up_tmp_space $cwd $start_dir
|
||||||
|
|
||||||
echo -s \n 'Done syncing.'
|
echo -s \n 'Done syncing.'
|
||||||
end
|
end
|
||||||
|
|
||||||
function setup_tmp_space -a cwd
|
function setup_tmp_space -a cwd
|
||||||
if test ! "$cwd" = 'dotfiles'
|
if test ! "$cwd" = 'dotfiles'
|
||||||
cd /var/tmp
|
cd /var/tmp
|
||||||
git clone --recurse-submodules https://github.com/mitchell/dotfiles.git
|
git clone --recurse-submodules https://github.com/mitchell/dotfiles.git
|
||||||
cd ./dotfiles
|
cd ./dotfiles
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function sync_files
|
function sync_files
|
||||||
if ! test -e ~/.config; mkdir ~/.config; end
|
if ! test -e ~/.config; mkdir ~/.config; end
|
||||||
|
|
||||||
rsync -aP ./.config/fish ~/.config/
|
rsync -aP ./.config/fish ~/.config/
|
||||||
rsync -aP ./.config/kitty ~/.config/
|
rsync -aP ./.config/kitty ~/.config/
|
||||||
rsync -aP ./.config/nvim ~/.config/
|
rsync -aP ./.config/nvim ~/.config/
|
||||||
rsync -aP ./.config/bspwm ~/.config/
|
rsync -aP ./.config/bspwm ~/.config/
|
||||||
rsync -aP ./.config/sxhkd ~/.config/
|
rsync -aP ./.config/sxhkd ~/.config/
|
||||||
rsync -aP ./.config/picom ~/.config/
|
rsync -aP ./.config/picom ~/.config/
|
||||||
rsync -aP ./.gitconfig ~/
|
rsync -aP ./.gitconfig ~/
|
||||||
rsync -aP ./.tmux-line.conf ~/
|
rsync -aP ./.tmux-line.conf ~/
|
||||||
rsync -aP ./.tmux.conf ~/
|
rsync -aP ./.tmux.conf ~/
|
||||||
rsync -aP ./.vim ~/
|
rsync -aP ./.vim ~/
|
||||||
rsync -aP ./.vimrc ~/
|
rsync -aP ./.vimrc ~/
|
||||||
rsync -aP ./.ideavimrc ~/
|
rsync -aP ./.ideavimrc ~/
|
||||||
rsync -aP ./.yabairc ~/
|
rsync -aP ./.yabairc ~/
|
||||||
rsync -aP ./.skhdrc ~/
|
rsync -aP ./.skhdrc ~/
|
||||||
rsync -aP ./.taskrc ~/
|
rsync -aP ./.taskrc ~/
|
||||||
end
|
end
|
||||||
|
|
||||||
function set_kitty_font_size -a uname
|
function set_kitty_font_size -a uname
|
||||||
if test "$uname" = 'Darwin'
|
if test "$uname" = 'Darwin'
|
||||||
sed -i '' -e 's/font_size 11\.0/font_size 13\.0/' ~/.config/kitty/kitty.conf
|
sed -i '' -e 's/font_size 11\.0/font_size 13\.0/' ~/.config/kitty/kitty.conf
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function install_fisher_packages
|
function install_fisher_packages
|
||||||
eval fisher
|
eval fisher
|
||||||
end
|
end
|
||||||
|
|
||||||
function install_nvim_plugins
|
function install_nvim_plugins
|
||||||
command -q nvim; and nvim +PlugUpgrade +PlugUpdate +qa
|
command -q nvim; and nvim +PlugUpgrade +PlugUpdate +qa
|
||||||
end
|
end
|
||||||
|
|
||||||
function set_git_user
|
function set_git_user
|
||||||
set prompt 'Would you like to set your git user name and email?'
|
set prompt 'Would you like to set your git user name and email?'
|
||||||
read -p "set_color red; printf '\n$prompt (Y/n) '; set_color normal" set_git_user
|
read -p "set_color red; printf '\n$prompt (Y/n) '; set_color normal" set_git_user
|
||||||
|
|
||||||
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 -P 'name: ' name
|
read -P 'name: ' name
|
||||||
read -P 'email: ' email
|
read -P 'email: ' email
|
||||||
|
|
||||||
git config --global user.name $name
|
git config --global user.name $name
|
||||||
git config --global user.email $email
|
git config --global user.email $email
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function set_fish_universal_vars
|
function set_fish_universal_vars
|
||||||
source ./fish_universal_vars.fish
|
source ./fish_universal_vars.fish
|
||||||
end
|
end
|
||||||
|
|
||||||
function clean_up_tmp_space -a cwd start_dir
|
function clean_up_tmp_space -a cwd start_dir
|
||||||
if test ! "$cwd" = 'dotfiles'
|
if test ! "$cwd" = 'dotfiles'
|
||||||
cd ..
|
cd ..
|
||||||
rm -rf ./dotfiles
|
rm -rf ./dotfiles
|
||||||
cd $start_dir
|
cd $start_dir
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
main
|
main
|
||||||
|
|
Loading…
Reference in New Issue