diff --git a/fish/completions/watson.fish b/fish/completions/watson.fish new file mode 100644 index 0000000..e2cf7ce --- /dev/null +++ b/fish/completions/watson.fish @@ -0,0 +1,189 @@ +# 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 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 sync -d "sync your work with $url" +complete -f -c watson -n '__fish_watson_needs_sub' -a tags -d "Display the list of tags" + +# add +complete -f -c watson -n '__fish_watson_needs_sub' -a add -d "Add time for project with tag(s) that was not tracked live" +complete -f -c watson -n '__fish_watson_using_command add' -s f -l from -d "Start date for add" +complete -f -c watson -n '__fish_watson_has_from add' -s t -l to -d "end date for add" +complete -f -c watson -n '__fish_watson_using_command add' -s c -l confirm-new-project -d "Confirm addition of new project" +complete -f -c watson -n '__fish_watson_using_command add' -s b -l confirm-new-tag -d "Confirm addition of new tag" + +# aggregate +complete -f -c watson -n '__fish_watson_needs_sub' -a aggregate -d "Display a report of the time spent on each project aggregated by day" +complete -f -c watson -n '__fish_watson_using_command aggregate' -s c -l current -d "include the running frame" +complete -f -c watson -n '__fish_watson_using_command aggregate' -s C -l no-current -d "exclude the running frame (default)" +complete -f -c watson -n '__fish_watson_using_command aggregate' -s f -l from -d "Start date for aggregate" +complete -f -c watson -n '__fish_watson_has_from aggregate' -s t -l to -d "end date for aggregate" +complete -f -c watson -n '__fish_watson_using_command aggregate' -s p -l project -d "restrict to project" -a "(__fish_watson_get_projects)" +complete -f -c watson -n '__fish_watson_using_command aggregate' -s T -l tag -d "restrict to tag" -a "(__fish_watson_get_tags)" +complete -f -c watson -n '__fish_watson_using_command aggregate' -s j -l json -d "output json" +complete -f -c watson -n '__fish_watson_using_command aggregate' -s s -l csv -d "output csv" +complete -f -c watson -n '__fish_watson_using_command aggregate' -s g -l pager -d "view through pager" +complete -f -c watson -n '__fish_watson_using_command aggregate' -s G -l no-pager -d "don't vew through pager" + +# 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 l -l luna -d "show the last lunar cycle" +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 s -l csv -d "output csv" +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 l -l luna -d "show the last lunar cycle" +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 s -l csv -d "output csv" +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" + +# restart +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" + +# stop +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_using_command stop' -l at -d "Stop frame at this time (YYYY-MM-DDT)?HH:MM(:SS)?" diff --git a/fish/conf.d/omf.fish b/fish/conf.d/omf.fish new file mode 100644 index 0000000..3e0f6d6 --- /dev/null +++ b/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 diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 0000000..5828c98 --- /dev/null +++ b/fish/config.fish @@ -0,0 +1 @@ +set EDITOR vim diff --git a/fish/fish_variables b/fish/fish_variables new file mode 100644 index 0000000..0286c75 --- /dev/null +++ b/fish/fish_variables @@ -0,0 +1,30 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR __fish_initialized:3100 +SETUVAR fish_color_autosuggestion:555\x1ebrblack +SETUVAR fish_color_cancel:\x2dr +SETUVAR fish_color_command:005fd7 +SETUVAR fish_color_comment:990000 +SETUVAR fish_color_cwd:green +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:009900 +SETUVAR fish_color_error:ff0000 +SETUVAR fish_color_escape:00a6b2 +SETUVAR fish_color_history_current:\x2d\x2dbold +SETUVAR fish_color_host:normal +SETUVAR fish_color_host_remote:yellow +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:00a6b2 +SETUVAR fish_color_param:00afff +SETUVAR fish_color_quote:999900 +SETUVAR fish_color_redirection:00afff +SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_status:red +SETUVAR fish_color_user:brgreen +SETUVAR fish_color_valid_path:\x2d\x2dunderline +SETUVAR fish_key_bindings:fish_vi_key_bindings +SETUVAR fish_pager_color_completion:\x1d +SETUVAR fish_pager_color_description:B3A06D\x1eyellow +SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline +SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan diff --git a/fish/functions/fish_mode_prompt.fish b/fish/functions/fish_mode_prompt.fish new file mode 100644 index 0000000..d551f17 --- /dev/null +++ b/fish/functions/fish_mode_prompt.fish @@ -0,0 +1,3 @@ +function fish_mode_prompt + # NOOP - Disable vim mode indicator +end diff --git a/fish/functions/fish_prompt.fish b/fish/functions/fish_prompt.fish new file mode 100644 index 0000000..ad3ce72 --- /dev/null +++ b/fish/functions/fish_prompt.fish @@ -0,0 +1,48 @@ +function fish_prompt + set -l last_command_status $status + + set -l symbol 'π' + + set -l normal_color (set_color normal) + set -l branch_color (set_color yellow) + set -l meta_color (set_color red) + set -l symbol_color (set_color blue -o) + set -l error_color (set_color red -o) + + if git_is_repo + echo -n -s $branch_color (git_branch_name) $normal_color + set -l git_meta "" + if test (command git ls-files --others --exclude-standard | wc -w 2> /dev/null) -gt 0 + set git_meta "$git_meta?" + end + if test (command git rev-list --walk-reflogs --count refs/stash 2> /dev/null) + set git_meta "$git_meta\$" + end + if git_is_touched + git_is_dirty && set git_meta "$git_meta⨯" + git_is_staged && set git_meta "$git_meta●" + end + set -l commit_count (command git rev-list --count --left-right (git remote)/(git_branch_name)"...HEAD" 2> /dev/null) + if test $commit_count + set -l behind (echo $commit_count | cut -f 1) + set -l ahead (echo $commit_count | cut -f 2) + if test $behind -gt 0 + set git_meta "$git_meta🠋" + end + if test $ahead -gt 0 + set git_meta "$git_meta🠉" + end + end + if test $git_meta + echo -n -s $meta_color " " $git_meta " " $normal_color + else + echo -n -s " " + end + end + + if test $last_command_status -eq 0 + echo -n -s $symbol_color $symbol " " $normal_color + else + echo -n -s $error_color $symbol " " $normal_color + end +end diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index bff9299..5fe6f17 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -43,3 +43,6 @@ bind -n C-Space next-window # Remove escape delay set -s escape-time 0 + +# Enable mouse scroll +set -g mouse on diff --git a/vim/.vimrc b/vim/.vimrc index 2b650ed..23438ee 100755 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -50,6 +50,9 @@ Plug 'chrisbra/colorizer' " cljfold Plug 'christoomey/vim-tmux-navigator' + Plug 'tpope/vim-rhubarb' + Plug 'zhaozg/vim-diagram' + Plug 'arcticicestudio/nord-vim' " " Todo: @@ -107,7 +110,8 @@ set ttyfast " Improves smoothness and drawing set backspace=indent,eol,start " Always allow backspacing set undofile " Make .un file for persistent undo - set relativenumber " Make numbers relative to current line + " set relativenumber " Make numbers relative to current line + set number set lazyredraw " Redraw only when necessary set updatetime=100 " Make updates happen faster (gitgutter) set splitright " Make split to right by default @@ -422,6 +426,25 @@ command! -register CopyMatches call CopyMatches() :nmap v :e $MYVIMRC "}}} +" hi DiffAdd ctermfg=NONE ctermbg=darkgreen +" hi DiffChange ctermfg=NONE ctermbg=darkgrey +" hi DiffDelete ctermfg=None ctermbg=Red +" hi Search cterm=NONE ctermfg=black ctermbg=lightgray +" +" highlight DiffAdd cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red +" highlight DiffDelete cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red +" highlight DiffChange cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red +" highlight DiffText cterm=bold ctermfg=10 ctermbg=88 gui=none guifg=bg guibg=Red + +hi DiffAdd cterm=none ctermfg=NONE ctermbg=Green +hi DiffChange cterm=none ctermfg=NONE ctermbg=Grey +hi DiffDelete cterm=bold ctermfg=NONE ctermbg=Red +hi DiffText cterm=none ctermfg=NONE ctermbg=Yellow + + + +" better diffs +set diffopt+=internal,algorithm:patience " TODO: rebind c-n " TODO: change ,k to ,n and add notes to version control diff --git a/zsh/.zshrc b/zsh/.zshrc index 9d62049..ccc8fc9 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,5 +1,5 @@ autoload -U colors && colors -PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b " +PS1="%B%{$fg[red]%}[%{$fg[yellow]%}ian%{$fg[green]%}@%{$fg[blue]%}macbook%{$fg[red]%}]%{$reset_color%}$%b " unsetopt BEEP @@ -85,4 +85,10 @@ man() { stty -ixon # remove ctrl-s terminal freeze +# AWS autocomplete +# +autoload bashcompinit && bashcompinit +autoload -Uz compinit && compinit +compinit +complete -C '/usr/local/bin/aws_completer' aws