Browse Source

Initial fish commit

Need to make sure functions are being stow'ed properly.
red-hat-laptop
Kevin Mok 5 years ago
parent
commit
1e69a014f3
Signed by: Kevin-Mok GPG Key ID: AEA75288DC135CF5
  1. 26
      aliases/key_aliases
  2. 161
      fish/.config/fish/completions/watson.fish
  3. 7
      fish/.config/fish/conf.d/omf.fish
  4. 1
      fish/.config/fish/conf.d/pure.fish
  5. 32
      fish/.config/fish/config.fish
  6. 52
      fish/.config/fish/functions/cd.fish
  7. 9
      fish/.config/fish/functions/certbot-ssl.fish
  8. 1
      fish/.config/fish/functions/fish_prompt.fish
  9. 4
      fish/.config/fish/functions/gx.fish
  10. 2
      fish/.config/fish/functions/vsnp.fish
  11. 2
      i3/.config/i3/config
  12. 4
      ranger/.config/ranger/rifle.conf
  13. 3
      shell/.zshrc
  14. 3
      txt/key_dirs.txt
  15. 3
      txt/key_files.txt
  16. 9
      txt/nzxt-pkgs.txt

26
aliases/key_aliases

@ -3,7 +3,7 @@
# clear screen
cs "printf '\033c'"
hst "history"
nf "cs && neofetch | lolcat"
nf "printf '\033c' && neofetch | lolcat"
fi "fish"
# reload urxvt
ru "xrdb ~/.Xresources"
@ -83,7 +83,9 @@ vlh "alsamixer -c 2"
# pacman
pc "sudo pacman -S"
pcr "sudo pacman -Rs"
pcu "sudo pacman -Sy"
pcud "sudo pacman -Sy"
pcug "sudo pacman -Syu"
pcv "sudo pacman -Q"
xpc "pacman -Qqe > ~/linux-config/txt/nzxt-pkgs.txt"
# tri "trizen -S --noconfirm"
tri "trizen -S"
@ -120,6 +122,7 @@ n "nvim"
sni "sudo nvim"
fh "feh"
sx "sxiv"
sxg "sxiv -a"
wp "grep wallpaper ~/.cache/wal/colors.sh"
# rsl "java -jar ~/Downloads/RuneLite.jar"
@ -151,13 +154,12 @@ yu "echo 'kevin.mok@mail.utoronto.ca' | xclip -selection clipboard"
p3 "python3"
py "python"
wt "watson"
wt "watson"
wta "watson start"
wte "watson edit"
wtl "watson log"
wts "watson stop"
wtt "watson status"
w "watson"
wa "watson start"
we "watson edit"
wl "watson log"
ws "watson stop"
wt "watson status"
# }}} applications #
@ -266,15 +268,17 @@ upip "pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xa
# update pip req's.
ureq "pip freeze > requirements.txt"
# scan history
hs "$spv_dir/src/update-history.sh && hlg"
# show last history scan
hlg "cat $spv_dir/src/api/management/commands/update-history.log | tail -n 1"
# scan history
hs "$spv_dir/src/update-history.sh && cat $spv_dir/src/api/management/commands/update-history.log | tail -n 1"
# scan cron log for hs cmd
crnl "grep \"(kevin) CMD\" /var/log/syslog | tail -n 1 && hlg"
# removes all but newest file
# rmol "ls -t | tail -n +2 | xargs rm -- && l"
snw "spotify-now -i '%artist - %title'"
# }}} spotify-lib-vis #
sc "shellcheck"

161
fish/.config/fish/completions/watson.fish

@ -0,0 +1,161 @@
# copy this into ~/.config/fish/completions/ to enable autocomplete for the watson time tracker
#
function __fish_watson_needs_sub -d "provides a list of sub commands"
set cmd (commandline -opc)
if [ (count $cmd) -eq 1 -a $cmd[1] = 'watson' ]
return 0
end
return 1
end
function __fish_watson_using_command -d "determine if watson is using the passed command"
set cmd (commandline -opc)
if [ (count $cmd) -ge 2 -a $cmd[1] = 'watson' ]
if [ $argv[1] = $cmd[2] ]
return 0
end
return 1
end
return 1
end
function __fish_watson_get_projects -d "return a list of projects"
command watson projects
end
function __fish_watson_get_tags -d "return a list of tags"
command watson tags
end
function __fish_watson_has_project -d "determine if watson is using a passed command and if it has a project"
set cmd (commandline -opc)
if [ (count $cmd) -gt 2 -a $cmd[1] = 'watson' ]
if [ $argv[1] = $cmd[2] ]
if contains "$cmd[3]" (__fish_watson_get_projects)
return 0
end
end
end
return 1
end
function __fish_watson_has_from -d "determine if watson is using a passed command and if it is using from"
set cmd (commandline -opc)
if [ (count $cmd) -gt 2 -a $cmd[1] = 'watson' ]
if [ $argv[1] = $cmd[2] ]
if contains -- "$cmd[3]" -f --from
return 0
end
end
end
return 1
end
function __fish_watson_get_frames -d "return a list of frames" #TODO, use watson logs to get more info
command watson frames
end
function __fish_watson_needs_project -d "check if we need a project"
set cmd (commandline -opc)
if [ (count $cmd) -ge 2 -a $cmd[1] = 'watson' ]
if [ $argv[1] = $cmd[2] ]
for i in $cmd
if contains $i (__fish_watson_get_projects)
return 1 # return 1 because we alredy have a project
end
end
return 0 # we are using $argv as our command and the command does not contain any projects
end
end
return 1
end
# if a backend.url is set, use it in the command description
if [ -e ~/.config/watson/config ]
set url_string (command watson config backend.url 2> /dev/null)
if test -n "$url_string"
set url $url_string
end
else
set url "a remote Crick server"
end
# ungrouped
complete -f -c watson -n '__fish_watson_needs_sub' -a cancel -d "Cancel the last start command"
complete -f -c watson -n '__fish_watson_needs_sub' -a stop -d " Stop monitoring time for the current project"
complete -f -c watson -n '__fish_watson_needs_sub' -a frames -d "Display the list of all frame IDs"
complete -f -c watson -n '__fish_watson_needs_sub' -a help -d "Display help information"
complete -f -c watson -n '__fish_watson_needs_sub' -a projects -d "Display the list of projects"
complete -f -c watson -n '__fish_watson_needs_sub' -a tags -d "Display the list of tags"
complete -f -c watson -n '__fish_watson_needs_sub' -a sync -d "sync your work with $url"
# config
complete -f -c watson -n '__fish_watson_needs_sub' -a config -d "Get and set configuration options"
complete -f -c watson -n '__fish_watson_using_command config' -s e -l edit -d "Edit the config with an editor"
# edit
complete -f -c watson -n '__fish_watson_needs_sub' -a edit -d "Edit a frame"
complete -f -c watson -n '__fish_watson_using_command edit' -a "(__fish_watson_get_frames)"
# log
complete -f -c watson -n '__fish_watson_needs_sub' -a log -d "Display sessions during the given timespan"
complete -f -c watson -n '__fish_watson_using_command log' -s c -l current -d "include the running frame"
complete -f -c watson -n '__fish_watson_using_command log' -s C -l no-current -d "exclude the running frame (default)"
complete -f -c watson -n '__fish_watson_using_command log' -s f -l from -d "Start date for log"
complete -f -c watson -n '__fish_watson_has_from log' -s t -l to -d "end date for log"
complete -f -c watson -n '__fish_watson_using_command log' -s y -l year -d "show the last year"
complete -f -c watson -n '__fish_watson_using_command log' -s m -l month -d "show the last month"
complete -f -c watson -n '__fish_watson_using_command log' -s w -l week -d "show week-to-day"
complete -f -c watson -n '__fish_watson_using_command log' -s d -l day -d "show today"
complete -f -c watson -n '__fish_watson_using_command log' -s a -l all -d "show all"
complete -f -c watson -n '__fish_watson_using_command log' -s p -l project -d "restrict to project" -a "(__fish_watson_get_projects)"
complete -f -c watson -n '__fish_watson_using_command log' -s T -l tag -d "restrict to tag" -a "(__fish_watson_get_tags)"
complete -f -c watson -n '__fish_watson_using_command log' -s j -l json -d "output json"
complete -f -c watson -n '__fish_watson_using_command log' -s g -l pager -d "view through pager"
complete -f -c watson -n '__fish_watson_using_command log' -s G -l no-pager -d "don't vew through pager"
# merge
complete -f -c watson -n '__fish_watson_needs_sub' -a merge -d "merge existing frames with conflicting ones"
complete -f -c watson -n '__fish_watson_using_command merge' -s f -l force -d "silently merge"
# remove
complete -f -c watson -n '__fish_watson_needs_sub' -a remove -d "Remove a frame"
complete -f -c watson -n '__fish_watson_using_command remove' -a "(__fish_watson_get_frames)"
complete -f -c watson -n '__fish_watson_using_command remove' -s f -l force -d "silently remove"
# rename
complete -f -c watson -n '__fish_watson_needs_sub' -a rename -d "Rename a project or tag"
complete -f -c watson -n '__fish_watson_using_command rename' -a "(__fish_watson_get_projects) (__fish_watson_get_tags)"
# report
complete -f -c watson -n '__fish_watson_needs_sub' -a report -d "Display a report of time spent"
complete -f -c watson -n '__fish_watson_using_command report' -s c -l current -d "include the running frame"
complete -f -c watson -n '__fish_watson_using_command report' -s C -l no-current -d "exclude the running frame (default)"
complete -f -c watson -n '__fish_watson_using_command report' -s f -l from -d "Start date for report"
complete -f -c watson -n '__fish_watson_has_from report' -s t -l to -d "end date for report"
complete -f -c watson -n '__fish_watson_using_command report' -s y -l year -d "show the last year"
complete -f -c watson -n '__fish_watson_using_command report' -s m -l month -d "show the last month"
complete -f -c watson -n '__fish_watson_using_command report' -s w -l week -d "show week-to-day"
complete -f -c watson -n '__fish_watson_using_command report' -s d -l day -d "show today"
complete -f -c watson -n '__fish_watson_using_command report' -s a -l all -d "show all"
complete -f -c watson -n '__fish_watson_using_command report' -s p -l project -d "restrict to project" -a "(__fish_watson_get_projects)"
complete -f -c watson -n '__fish_watson_using_command report' -s T -l tag -d "restrict to tag" -a "(__fish_watson_get_tags)"
complete -f -c watson -n '__fish_watson_using_command report' -s j -l json -d "output json"
complete -f -c watson -n '__fish_watson_using_command report' -s g -l pager -d "view through pager"
complete -f -c watson -n '__fish_watson_using_command report' -s G -l no-pager -d "don't vew through pager"
complete -f -c watson -n '__fish_watson_needs_sub' -a restart -d "Restart monitoring time for a stopped project"
complete -f -c watson -n '__fish_watson_using_command restart' -s s -l stop -d "stop running project"
complete -f -c watson -n '__fish_watson_using_command restart' -s S -l no-stop -d "do not stop running project"
complete -f -c watson -n '__fish_watson_using_command restart' -a "(__fish_watson_get_frames)"
# start
complete -f -c watson -n '__fish_watson_needs_sub' -a start -d "Start monitoring time for a project"
complete -f -c watson -n '__fish_watson_needs_project start' -a "(__fish_watson_get_projects)"
complete -f -c watson -n '__fish_watson_has_project start' -a "+(__fish_watson_get_tags)"
# status
complete -f -c watson -n '__fish_watson_needs_sub' -a status -d "Display when the current project was started and time spent"
complete -f -c watson -n '__fish_watson_using_command status' -s p -l project -d "only show project"
complete -f -c watson -n '__fish_watson_using_command status' -s t -l tags -d "only show tags"
complete -f -c watson -n '__fish_watson_using_command status' -s e -l elapsed -d "only show elapsed time"

7
fish/.config/fish/conf.d/omf.fish

@ -0,0 +1,7 @@
# Path to Oh My Fish install.
set -q XDG_DATA_HOME
and set -gx OMF_PATH "$XDG_DATA_HOME/omf"
or set -gx OMF_PATH "$HOME/.local/share/omf"
# Load Oh My Fish configuration.
source $OMF_PATH/init.fish

1
fish/.config/fish/conf.d/pure.fish

@ -0,0 +1 @@
/home/kevin/.local/share/omf/themes/pure/conf.d/pure.fish

32
fish/.config/fish/config.fish

@ -0,0 +1,32 @@
# login to X {{{ #
if status is-login
if test -z "$DISPLAY" -a $XDG_VTNR = 1
exec startx -- -keeptty
end
end
set -x GPG_TTY=$(tty)
# }}} login to X #
# input
xset r rate 200 60
fish_vi_key_bindings
set -x EDITOR /usr/bin/nvim
set -x VISUAL /usr/bin/nvim
builtin cd $last_dir
# fish-specific
source /home/kevin/.config/fish/key_abbr.fish
abbr xf "fish_config"
abbr f. "cd .."
abbr f.. "cd ../.."
# spv
set -U spv_dir "/home/kevin/coding/spotify-lib-vis"
source $spv_dir/src/api-keys.sh
# set -U PATH /usr/local/sbin /usr/local/bin /usr/bin /usr/bin/site_perl /usr/bin/vendor_perl /usr/bin/core_perl /home/kevin/linux-config/scripts
set -x PATH $PATH /home/kevin/linux-config/scripts
set -x PASSWORD_STORE_CLIP_TIME 120

52
fish/.config/fish/functions/cd.fish

@ -0,0 +1,52 @@
#
# Wrap the builtin cd command to maintain directory history.
#
function cd --description "Change directory"
set -l MAX_DIR_HIST 25
if test (count $argv) -gt 1
printf "%s\n" (_ "Too many args for cd command")
return 1
end
# Skip history in subshells.
if status --is-command-substitution
builtin cd $argv
return $status
end
# Avoid set completions.
set -l previous $PWD
if test "$argv" = "-"
if test "$__fish_cd_direction" = "next"
nextd
else
prevd
end
return $status
end
# allow explicit "cd ." if the mount-point became stale in the meantime
if test "$argv" = "."
cd "$PWD"
return $status
end
builtin cd $argv
set -l cd_status $status
if test $cd_status -eq 0 -a "$PWD" != "$previous"
set -q dirprev
or set -l dirprev
set -q dirprev[$MAX_DIR_HIST]
and set -e dirprev[1]
set -g -a dirprev $previous
set -e dirnext
set -g __fish_cd_direction prev
set -U last_dir $PWD
ls -a
end
return $cd_status
end

9
fish/.config/fish/functions/certbot-ssl.fish

@ -0,0 +1,9 @@
function certbot-ssl
set domain_args ""
for domain in $argv
set -a domain_args "-d" $domain
end
echo sudo certbot certonly --manual --preferred-challenges=dns \
--email kevin.mok@live.ca --server https://acme-v02.api.letsencrypt.org/directory \
--agree-tos $domain_args
end

1
fish/.config/fish/functions/fish_prompt.fish

@ -0,0 +1 @@
/home/kevin/.local/share/omf/themes/pure/fish_prompt.fish

4
fish/.config/fish/functions/gx.fish

@ -0,0 +1,4 @@
function gx
set key_aliases /home/kevin/linux-config/aliases/key_aliases
grep $argv[1] $key_aliases
end

2
fish/.config/fish/functions/vsnp.fish

@ -0,0 +1,2 @@
function vsnp
end

2
i3/.config/i3/config

@ -254,7 +254,7 @@ set $ws11 "11 "
# set $ws11 "11 📊"
# assign [class="Summoners War Exporter"] $ws11
workspace $ws11 output $samsung
bindsym $mod+F11 workspace $ws11; exec urxvt -e htop -s PERCENT_MEM
bindsym $mod+F11 workspace $ws11; exec urxvt -e htop -s PERCENT_CPU
set $ws12 "12 "
bindsym $mod+F12 workspace $ws12; exec $def_term

4
ranger/.config/ranger/rifle.conf

@ -87,8 +87,8 @@ ext x?html?, has w3m, terminal = w3m "$@"
# Define the "editor" for text files as first action
mime ^text, label editor = ${VISUAL:-$EDITOR} -- "$@"
mime ^text, label pager = "$PAGER" -- "$@"
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@"
!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php|fish = ${VISUAL:-$EDITOR} -- "$@"
!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php|fish = "$PAGER" -- "$@"
ext 1 = man "$1"
ext s[wmf]c, has zsnes, X = zsnes "$1"

3
shell/.zshrc

@ -171,7 +171,6 @@ fi
# # }}} autoreload zsh aliases #
source /home/kevin/.shortcuts
source /home/kevin/coding/spotify-lib-vis/src/api-keys.sh
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
@ -179,4 +178,4 @@ export GPG_TTY=$(tty)
export PASSWORD_STORE_CLIP_TIME=120
source /home/kevin/.key_aliases
exec fish
#exec fish

3
txt/key_dirs.txt

@ -5,7 +5,8 @@ cf /home/kevin/.config
lc /home/kevin/linux-config/
d /home/kevin/Downloads
D /home/kevin/Documents
fs /home/kevin/.config/fish
ff /home/kevin/.config/fish
fs /home/kevin/linux-config/fish/.config/fish
k /home/kevin/
lc /home/kevin/linux-config/
me /run/media/kevin

3
txt/key_files.txt

@ -11,7 +11,8 @@ sr /home/kevin/linux-config/configs/ranger/shortcuts.conf
ss /home/kevin/.shortcuts
u /home/kevin/.Xresources
v /home/kevin/.vimrc
# y /home/kevin/.zshrc
x /home/kevin/.config/fish/config.fish
y /home/kevin/.zshrc
z /home/kevin/linux-config/aliases/zsh_aliases
# }}} sys *

9
txt/nzxt-pkgs.txt

@ -1,5 +1,6 @@
alsa-utils
arch-install-scripts
asp
autoconf
automake
bash
@ -68,6 +69,8 @@ licenses
linux
linux-firmware
linux-headers
linux-kevin
linux-kevin-headers
logrotate
lolcat
lsof
@ -89,16 +92,18 @@ noto-fonts
ntfs-3g
ntp
numlockx
nvidia
nvidia-dkms
openssh
os-prober
pacman
pacman-contrib
pass
patch
pciutils
pcmanfm
pdfgrep
peaclock
peek
perl
pgadmin4
pipes.sh
@ -127,10 +132,12 @@ shadow
shellcheck
spotify
spotify-now-git
sqlitebrowser
st
steam
steam-native-runtime
steamos-xpad-dkms
stow
sudo
surf
sxiv

Loading…
Cancel
Save