File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Notes completion file for fish shell <https://github.com/pimterry/notes>
2
+ # Place in ~/.config/fish/completions/
3
+
4
+ # Set some useful local variables
5
+ # # lists of commands used by notes
6
+ set -l notes_list_commands o open mv rm cat
7
+ set -l notes_friendly_commands new open find ls rm cat mv grep
8
+ set -l notes_commands n new ls find f grep g search s open o mv rm cat
9
+ set -l notes_dir_commands n new grep ls
10
+
11
+ # NOTES_DIRECTORY
12
+ # # use NOTES_DIRECTORY variable if set else...
13
+ if not set -q NOTES_DIRECTORY
14
+ echo " notes dir not set"
15
+ # # if config file exists, read it
16
+ if test -e $HOME /.config/notes/config
17
+ set NOTES_DIRECTORY (string split = (grep " NOTES_DIRECTORY" $HOME /.config/notes/config))[2]
18
+ end
19
+ end
20
+ # # in case of failure, use default notes dir
21
+ if not set -q NOTES_DIRECTORY[1]
22
+ set NOTES_DIRECTORY " $HOME /notes"
23
+ end
24
+
25
+ # FILE COMPLETIONS
26
+ complete -c notes -f
27
+ complete -c notes -n " not __fish_seen_subcommand_from $notes_commands " -a " $notes_friendly_commands "
28
+ complete -c notes -n " __fish_seen_subcommand_from $notes_list_commands " -a " (notes find|grep -v '~\$ '|sed 's/[.]md\$ //')"
29
+ complete -c notes -n " __fish_seen_subcommand_from $notes_dir_commands " -a " (find $NOTES_DIRECTORY -type d -printf '%P/\n')"
You can’t perform that action at this time.
0 commit comments