You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for this amazing tool. I just discovered this and have been having fun trying to figure out how to integrate it into my daily workflow. The documentation is fantastic and I love the zk-nvim integration.
While working on a dynamic zsh auto completion function for zk, I discovered that zk emits unwanted characters to stderr due to bar.Clear() on line 89 of notebook.go. Even on the simplest run of zk command, it always generates output to stderr. For example:
It would be nice to have an option to disable the use of progressbar for those using zk in scripts and such. For now, I've resorted to redirecting stderr to /dev/null in my zsh auto completer. Without it, the auto completer formatting was broken due to those extra carriage returns emitted.
For those interested, I wrote a simple auto completer for a custom zk alias of mine called 1on1. As a manager, I use this to take notes when I have my bi-weekly one on ones with associates. I have a folder in my notebook called meetings and a group called 1_on_1 that uses a custom template with this headline # {{date now "%Y-%m-%d"}}: {{title}} 1:1. Then I have an alias called 1on1 that expands to zk new --title "$*" meetings. When I am about to meet with an associate, I execute zk 1on1 John Smith for example. I then wanted to build an auto completer so I could tab after typing zk 1on1 and be presented with a list of anyone I've had a prior 1:1 with. So, in my .zshrc file, I wrote the following to list all my one on one note titles and parse out the person's name from it:
function_zk {
local state line
_arguments "1: :(init index new list graph edit tag 1on1)""2:Person:->names"case$statein
names)
case$line[1] in
1on1)
_values 'Names'"${(@f)$(zk list -q -f '{{title}}' -t 1_on_1 2> /dev/null | sed 's/....-..-..: \(.*\) 1:1/\1/' | sort -u)}"
;;
esac
;;
esac
}
compdef _zk zk
With that, I now have auto completion and a snazzy new workflow for all of my one on ones.
It took me hours to make this work only because I've never done any zsh auto completion before, but mostly because I had no idea why the formatting of the auto completion was busted when using zk. After eliminating pieces, I finally realized that zk was outputting characters to stderr, which ultimately was the root cause of my issue.
The text was updated successfully, but these errors were encountered:
Thank you for this amazing tool. I just discovered this and have been having fun trying to figure out how to integrate it into my daily workflow. The documentation is fantastic and I love the
zk-nvim
integration.While working on a dynamic zsh auto completion function for zk, I discovered that zk emits unwanted characters to stderr due to
bar.Clear()
on line 89 of notebook.go. Even on the simplest run ofzk
command, it always generates output to stderr. For example:It would be nice to have an option to disable the use of
progressbar
for those using zk in scripts and such. For now, I've resorted to redirecting stderr to/dev/null
in my zsh auto completer. Without it, the auto completer formatting was broken due to those extra carriage returns emitted.For those interested, I wrote a simple auto completer for a custom zk alias of mine called
1on1
. As a manager, I use this to take notes when I have my bi-weekly one on ones with associates. I have a folder in my notebook calledmeetings
and a group called1_on_1
that uses a custom template with this headline# {{date now "%Y-%m-%d"}}: {{title}} 1:1
. Then I have an alias called1on1
that expands tozk new --title "$*" meetings
. When I am about to meet with an associate, I executezk 1on1 John Smith
for example. I then wanted to build an auto completer so I could tab after typingzk 1on1
and be presented with a list of anyone I've had a prior 1:1 with. So, in my.zshrc
file, I wrote the following to list all my one on one note titles and parse out the person's name from it:With that, I now have auto completion and a snazzy new workflow for all of my one on ones.
It took me hours to make this work only because I've never done any zsh auto completion before, but mostly because I had no idea why the formatting of the auto completion was busted when using zk. After eliminating pieces, I finally realized that zk was outputting characters to stderr, which ultimately was the root cause of my issue.
The text was updated successfully, but these errors were encountered: