Skip to content

Commit 69e4769

Browse files
authored
Merge pull request #46 from tardypad/completion_directory
Fix autocompletion in case of non default notes directory
2 parents 3f4cb64 + b1e53be commit 69e4769

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

_notes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ __notes_cmd ()
3131

3232
_notes ()
3333
{
34+
# Look for configuration file at ~/.config/notes/config and use it
35+
if [ -f ~/.config/notes/config ]; then
36+
. ~/.config/notes/config
37+
fi
38+
3439
local configured_dir=${NOTES_DIRECTORY%/}
3540
local note_dir="${configured_dir:-$HOME/notes}"
3641

config

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This is an example configuration file for notes
1+
# This is an example configuration file for notes
22
# To use it, copy to ~/.config/notes/config
33
# This config is case sensitive
44

@@ -9,4 +9,7 @@
99
# QUICKNOTE_FORMAT="%Y-%m-%d"
1010

1111
# Set extension to plain txt instead of markdown
12-
#NOTES_EXT="txt"
12+
# NOTES_EXT="txt"
13+
14+
# Define the directory where notes are stored
15+
# NOTES_DIRECTORY=~/notes

notes.bash_completion

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/bin/bash
22

33
_notes_complete_notes() {
4+
# Look for configuration file at ~/.config/notes/config and use it
5+
if [ -f ~/.config/notes/config ]; then
6+
. ~/.config/notes/config
7+
fi
8+
49
local configured_dir=${NOTES_DIRECTORY%/} # Remove trailing slashes
510
local notes_dir="${configured_dir:-$HOME/notes}"
611
local OLD_IFS="$IFS"

0 commit comments

Comments
 (0)