mirror of https://github.com/mitchell/dotfiles.git
Add ssh and key related aliases and reformat all fish files
This commit is contained in:
parent
0ef8fb571a
commit
7a361e5260
|
@ -7,6 +7,7 @@ function configure_fish
|
||||||
define_global_variables
|
define_global_variables
|
||||||
import_sources $uname
|
import_sources $uname
|
||||||
define_aliases $uname
|
define_aliases $uname
|
||||||
|
ssh_agent_startup
|
||||||
end
|
end
|
||||||
|
|
||||||
configure_fish
|
configure_fish
|
||||||
|
|
|
@ -2,5 +2,5 @@ function back -d 'A shortcut for backgrounding a command using nohup and named l
|
||||||
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,24 +1,30 @@
|
||||||
function define_aliases -a uname -d 'Defines aliases for commonly used commands'
|
function define_aliases -a uname -d 'Defines aliases for commonly used commands'
|
||||||
alias cp 'rsync -aP'
|
alias rcp '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 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'
|
alias ssh-rm 'ssh-keygen -f ~/.ssh/known_hosts -R'
|
||||||
alias wiki 'nvim +VimwikiIndex'
|
alias wiki 'nvim +VimwikiIndex'
|
||||||
|
alias ssh-a 'ssh-add ~/.secrets/id_ed25519'
|
||||||
|
alias age-p 'age --armor --passphrase'
|
||||||
|
alias age-d 'age --decrypt --identity ~/.secrets/id_ed25519'
|
||||||
|
alias age-e 'age --armor --recipient (cat ~/.secrets/id_ed25519.pub)'
|
||||||
|
alias age-k 'age --decrypt --identity ~/.secrets/id_ed25519 ~/.secrets/age_keys.age'
|
||||||
|
|
||||||
switch "$uname"
|
switch "$uname"
|
||||||
case 'Linux'
|
case 'Linux'
|
||||||
alias cat 'batcat --theme ansi-dark'
|
alias bat 'batcat --theme ansi-dark'
|
||||||
alias goland 'command goland'
|
alias goland 'command goland'
|
||||||
alias rider 'command rider'
|
alias rider 'command rider'
|
||||||
alias webstorm 'command webstorm'
|
alias webstorm 'command webstorm'
|
||||||
|
alias sctl 'sudo systemctl'
|
||||||
case 'Darwin'
|
case 'Darwin'
|
||||||
alias cat 'bat --theme ansi-dark'
|
alias bat 'bat --theme ansi-dark'
|
||||||
alias goland 'open -a Goland'
|
alias goland 'open -a Goland'
|
||||||
alias rider 'open -a Rider'
|
alias rider 'open -a Rider'
|
||||||
alias webstorm 'open -a Webstorm'
|
alias webstorm 'open -a Webstorm'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,18 +6,18 @@ function editcb -a ft -d 'Opens your editor to the cliboard\'s current contents.
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -13,7 +13,7 @@ function fish_prompt --description 'Write out the prompt'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Set jobs num, based on exit code of jobs command
|
# Set jobs num, based on exit code of jobs command
|
||||||
if jobs > /dev/null
|
if jobs >/dev/null
|
||||||
set -l jobs_out (jobs -c)
|
set -l jobs_out (jobs -c)
|
||||||
set jobs_num '[' (set_color grey) (count $jobs_out) (set_color normal) '] '
|
set jobs_num '[' (set_color grey) (count $jobs_out) (set_color normal) '] '
|
||||||
end
|
end
|
||||||
|
@ -31,49 +31,53 @@ function fish_prompt --description 'Write out the prompt'
|
||||||
|
|
||||||
if test $fish_key_bindings = 'fish_vi_key_bindings'
|
if test $fish_key_bindings = 'fish_vi_key_bindings'
|
||||||
switch "$fish_bind_mode"
|
switch "$fish_bind_mode"
|
||||||
case 'insert'
|
case 'insert'
|
||||||
set suffix (set_color brblue) $suffix (set_color normal)
|
set suffix (set_color brblue) $suffix (set_color normal)
|
||||||
case 'default'
|
case 'default'
|
||||||
set suffix '###'
|
set suffix '###'
|
||||||
case 'visual'
|
case 'visual'
|
||||||
set suffix (set_color bryellow) '<~#' (set_color normal)
|
set suffix (set_color bryellow) '<~#' (set_color normal)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
case '*'
|
case '*'
|
||||||
set color_cwd $fish_color_cwd
|
set color_cwd $fish_color_cwd
|
||||||
|
|
||||||
set suffix '$~>'
|
set suffix '$~>'
|
||||||
|
|
||||||
if test $fish_key_bindings = 'fish_vi_key_bindings'
|
if test $fish_key_bindings = 'fish_vi_key_bindings'
|
||||||
switch "$fish_bind_mode"
|
switch "$fish_bind_mode"
|
||||||
case 'insert'
|
case 'insert'
|
||||||
set suffix (set_color brblue) $suffix (set_color normal)
|
set suffix (set_color brblue) $suffix (set_color normal)
|
||||||
case 'default'
|
case 'default'
|
||||||
set suffix '<$>'
|
set suffix '<$>'
|
||||||
case 'visual'
|
case 'visual'
|
||||||
set suffix (set_color bryellow) '<~$' (set_color normal)
|
set suffix (set_color bryellow) '<~$' (set_color normal)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# Set user_prefix, based on whether or not inside of ssh session.
|
# Set user_prefix, based on whether or not inside of ssh session.
|
||||||
if test -n "$SSH_CLIENT"; set user_prefix $USER @ (prompt_hostname) ' '; end
|
if test -n "$SSH_CLIENT"
|
||||||
|
set user_prefix $USER @ (prompt_hostname) ' '
|
||||||
|
end
|
||||||
|
|
||||||
# Show current git branch, based on git commands only.
|
# Show current git branch, based on git commands only.
|
||||||
if git status > /dev/null 2>&1
|
if git status >/dev/null 2>&1
|
||||||
set -l branch_color green
|
set -l branch_color green
|
||||||
set -l git_status (git status)
|
set -l git_status (git status)
|
||||||
|
|
||||||
if string match 'Changes not staged for commit:' $git_status > /dev/null
|
if string match 'Changes not staged for commit:' $git_status >/dev/null
|
||||||
or string match 'Untracked files:' $git_status > /dev/null
|
or string match 'Untracked files:' $git_status >/dev/null
|
||||||
set branch_color red
|
set branch_color red
|
||||||
else if string match 'Changes to be committed:' $git_status > /dev/null
|
else if string match 'Changes to be committed:' $git_status >/dev/null
|
||||||
set branch_color yellow
|
set branch_color yellow
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l cur_branch (string sub -s 3 (string match -r '^\* .*$' (git branch)))
|
set -l cur_branch (string sub -s 3 (string match -r '^\* .*$' (git branch)))
|
||||||
if string match -q '(HEAD detached*' $cur_branch; set cur_branch 'detached'; end
|
if string match -q '(HEAD detached*' $cur_branch
|
||||||
|
set cur_branch 'detached'
|
||||||
|
end
|
||||||
|
|
||||||
if test -n "$cur_branch"
|
if test -n "$cur_branch"
|
||||||
set -l cur_branch_len (string length $cur_branch)
|
set -l cur_branch_len (string length $cur_branch)
|
||||||
|
@ -83,10 +87,10 @@ function fish_prompt --description 'Write out the prompt'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if string match 'Your branch is ahead of*' $git_status > /dev/null
|
if string match 'Your branch is ahead of*' $git_status >/dev/null
|
||||||
set cur_branch $cur_branch \u21A5
|
set cur_branch $cur_branch \u21A5
|
||||||
else if string match 'Your branch is behind*' $git_status > /dev/null
|
else if string match 'Your branch is behind*' $git_status >/dev/null
|
||||||
set cur_branch $cur_branch \u21A7
|
set cur_branch $cur_branch \u21A7
|
||||||
end
|
end
|
||||||
|
|
||||||
set git_branch ' on ' (set_color $branch_color) $cur_branch (set_color normal)
|
set git_branch ' on ' (set_color $branch_color) $cur_branch (set_color normal)
|
||||||
|
|
|
@ -3,7 +3,10 @@ function import_sources -a uname -d 'Loads any additional fish files needed at i
|
||||||
|
|
||||||
switch "$uname"
|
switch "$uname"
|
||||||
case 'Linux'
|
case 'Linux'
|
||||||
test -e ~/.asdf/asdf.fish; and source ~/.asdf/asdf.fish
|
test -e ~/.asdf/asdf.fish
|
||||||
|
and source ~/.asdf/asdf.fish
|
||||||
|
and mkdir -p ~/.config/fish/completions
|
||||||
|
and cp ~/.asdf/completions/asdf.fish ~/.config/fish/completions
|
||||||
case 'Darwin'
|
case 'Darwin'
|
||||||
command -q brew
|
command -q brew
|
||||||
and test -e (brew --prefix asdf)/asdf.fish
|
and test -e (brew --prefix asdf)/asdf.fish
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
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 \
|
set payload \
|
||||||
"{
|
"{
|
||||||
\"token\": \"$pushover_token\",
|
\"token\": \"$pushover_token\",
|
||||||
\"user\": \"$pushover_user\",
|
\"user\": \"$pushover_user\",
|
||||||
\"title\": \"Tasks\",
|
\"title\": \"Tasks\",
|
||||||
\"message\": $message
|
\"message\": $message
|
||||||
}"
|
}"
|
||||||
|
|
||||||
curl \
|
curl \
|
||||||
-X POST \
|
-X POST \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d $payload \
|
-d $payload \
|
||||||
https://api.pushover.net/1/messages.json
|
https://api.pushover.net/1/messages.json
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
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
|
||||||
|
|
|
@ -4,6 +4,6 @@ function tasktime -a id time -d 'Set a time to check-in on task progress using p
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -16,8 +16,8 @@ set -U fish_color_operator 00a6b2
|
||||||
set -U fish_color_param 839496
|
set -U fish_color_param 839496
|
||||||
set -U fish_color_quote 657b83
|
set -U fish_color_quote 657b83
|
||||||
set -U fish_color_redirection 6c71c4
|
set -U fish_color_redirection 6c71c4
|
||||||
set -U fish_color_search_match 'bryellow' '--background=black'
|
set -U fish_color_search_match 'bryellow' '--background=black'
|
||||||
set -U fish_color_selection 'white' '--bold' '--background=brblack'
|
set -U fish_color_selection 'white' '--bold' '--background=brblack'
|
||||||
set -U fish_color_status red
|
set -U fish_color_status red
|
||||||
set -U fish_color_user brgreen
|
set -U fish_color_user brgreen
|
||||||
set -U fish_color_valid_path --underline
|
set -U fish_color_valid_path --underline
|
||||||
|
@ -25,5 +25,5 @@ set -U fish_greeting
|
||||||
set -U fish_key_bindings fish_vi_key_bindings
|
set -U fish_key_bindings fish_vi_key_bindings
|
||||||
set -U fish_pager_color_completion B3A06D
|
set -U fish_pager_color_completion B3A06D
|
||||||
set -U fish_pager_color_description B3A06D
|
set -U fish_pager_color_description B3A06D
|
||||||
set -U fish_pager_color_prefix 'cyan' '--underline'
|
set -U fish_pager_color_prefix 'cyan' '--underline'
|
||||||
set -U fish_pager_color_progress 'brwhite' '--background=cyan'
|
set -U fish_pager_color_progress 'brwhite' '--background=cyan'
|
||||||
|
|
Loading…
Reference in New Issue