ned: ned cd
works good now
No, I do not mean "it works well." I meant what I said.
This commit is contained in:
parent
244939b28c
commit
1aac39b453
1 changed files with 13 additions and 7 deletions
|
@ -12,7 +12,8 @@
|
|||
BASE_DIR="${NOTES_DIR:-"$HOME/Documents/college/current"}"
|
||||
EDITOR="nvim"
|
||||
EDITOR_CMD="nvim -c :ZenMode"
|
||||
DEFAULT_NEW_NOTE_NAME="$(date +'%m-%d').md"
|
||||
DEFAULT_NEW_NOTE_EXT=.md
|
||||
DEFAULT_NEW_NOTE_NAME="$(date +'%m-%d')$DEFAULT_NEW_NOTE_EXT"
|
||||
|
||||
# Some fzf commands
|
||||
FZF="fzf -1 --layout=reverse --info=inline --height=10%"
|
||||
|
@ -26,9 +27,10 @@ usage() {
|
|||
[edit|ed] [folder] <note name> Search for and edit a text document in a folder
|
||||
ned Edit ned
|
||||
help Print this message
|
||||
cd [folder] Open a shell in a directory or the default directory
|
||||
|
||||
Notes:
|
||||
Edit 'T' to get today's note
|
||||
Edit 'T' to get today's note
|
||||
Folder and file names are searched with fuzzy search
|
||||
ned will automatically activate the ZenMode neovim extension
|
||||
Current repository path: '$BASE_DIR'
|
||||
|
@ -69,7 +71,7 @@ new() {
|
|||
|
||||
# Note name
|
||||
if [ -n "$3" ]; then
|
||||
NEW_NOTE_NAME="$3.md"
|
||||
NEW_NOTE_NAME="$3"
|
||||
else
|
||||
NEW_NOTE_NAME="$DEFAULT_NEW_NOTE_NAME"
|
||||
fi
|
||||
|
@ -83,7 +85,7 @@ new() {
|
|||
cd "$NEW_NOTE_DIR" || exit
|
||||
# apply a template for notes
|
||||
cat <<-EOF >> "$NEW_NOTE_DIR/$NEW_NOTE_NAME"
|
||||
# $NEW_NOTE_NAME
|
||||
# ${NEW_NOTE_NAME%%$DEFAULT_NEW_NOTE_EXT}
|
||||
|
||||
<!-- vim: wrap nonu nornu
|
||||
-->
|
||||
|
@ -104,10 +106,14 @@ subshell() {
|
|||
}
|
||||
|
||||
shell() {
|
||||
if [ -n "${1+foo}" ]; then
|
||||
DIR="$BASE_DIR/$(cd "$BASE_DIR" && fd -d 1 -t d | sed 's-\./--g' | $FZF_SEARCH "$1")" || exit
|
||||
if [ -n "${2+foo}" ]; then
|
||||
DIR="$BASE_DIR/$(cd "$BASE_DIR" && fd -d 1 -t d | sed 's-\./--g' | $FZF_SEARCH "$2")" || exit
|
||||
fi
|
||||
if cd "$DIR"; then
|
||||
subshell
|
||||
else
|
||||
exit
|
||||
fi
|
||||
cd "$DIR" || exit
|
||||
}
|
||||
|
||||
check_setup() {
|
||||
|
|
Loading…
Add table
Reference in a new issue