Merge branch 'master' of git.blakenorth.net/home/git/dotfiles
This commit is contained in:
commit
21ac398ee3
2 changed files with 9 additions and 6 deletions
|
@ -220,6 +220,7 @@ return require('packer').startup({function()
|
||||||
config = function()
|
config = function()
|
||||||
require('blake.other').zenmode()
|
require('blake.other').zenmode()
|
||||||
vim.cmd 'nnoremap <F10> <cmd>ZenMode<CR>'
|
vim.cmd 'nnoremap <F10> <cmd>ZenMode<CR>'
|
||||||
|
vim.cmd 'inoremap <F10> <cmd>ZenMode<CR>'
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
-- use { -- dim text outside paragraph or function
|
-- use { -- dim text outside paragraph or function
|
||||||
|
|
|
@ -17,7 +17,6 @@ DEFAULT_NEW_NOTE_NAME="$(date +'%m-%d')$DEFAULT_NEW_NOTE_EXT"
|
||||||
|
|
||||||
# Some fzf commands
|
# Some fzf commands
|
||||||
FZF="fzf -1 --layout=reverse --info=inline --height=10%"
|
FZF="fzf -1 --layout=reverse --info=inline --height=10%"
|
||||||
FZF_SEARCH="$FZF -q "
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<-EOF
|
cat <<-EOF
|
||||||
|
@ -50,18 +49,19 @@ edit() {
|
||||||
# This logic is to allow $2 to be optional
|
# This logic is to allow $2 to be optional
|
||||||
if [ -n "$3" ]; then
|
if [ -n "$3" ]; then
|
||||||
SEARCH_TERM="$3"
|
SEARCH_TERM="$3"
|
||||||
NOTE_DIR="$(cd "$BASE_DIR" && fd -t f | sed 's-\./--g' | $FZF_SEARCH "$2")" || exit
|
NOTE_DIR="$BASE_DIR/$(cd "$BASE_DIR" && fd -t d -d 1 | sed 's-\./--g' | $FZF -q "$2")" || exit
|
||||||
elif [ -n "$2" ]; then
|
elif [ -n "$2" ]; then
|
||||||
SEARCH_TERM="$2"
|
SEARCH_TERM="$2"
|
||||||
|
else
|
||||||
|
echo "$0: Error: No file specified" && usage && exit
|
||||||
fi
|
fi
|
||||||
# TODO: what if there is no $2 provided
|
|
||||||
|
|
||||||
# Searching for 'T' will get you today's note
|
# Searching for 'T' will get you today's note
|
||||||
if [ "$SEARCH_TERM" = 'T' ]; then
|
if [ "$SEARCH_TERM" = 'T' ]; then
|
||||||
SEARCH_TERM="$DEFAULT_NEW_NOTE_NAME"
|
SEARCH_TERM="$DEFAULT_NEW_NOTE_NAME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NOTE="$NOTE_DIR/$(cd "$NOTE_DIR" && $FZF_SEARCH "$SEARCH_TERM")" || exit
|
NOTE="$NOTE_DIR/$(cd "$NOTE_DIR" && $FZF -q "$SEARCH_TERM")" || exit
|
||||||
|
|
||||||
open_file "$NOTE"
|
open_file "$NOTE"
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ new() {
|
||||||
# TODO: what if there is no $2 provided
|
# TODO: what if there is no $2 provided
|
||||||
|
|
||||||
# Note dir
|
# Note dir
|
||||||
NEW_NOTE_DIR="$BASE_DIR/$(cd "$BASE_DIR" && fd -d 1 | sed 's-\./--g' | $FZF_SEARCH "$2")/notes" || exit
|
NEW_NOTE_DIR="$BASE_DIR/$(cd "$BASE_DIR" && fd -t d -d 1 | sed 's-\./--g' | $FZF -q "$2")/notes" || exit
|
||||||
|
|
||||||
# make the directory if it doesn't exist
|
# make the directory if it doesn't exist
|
||||||
[ -d "${NEW_NOTE_DIR}" ] || mkdir "${NEW_NOTE_DIR}"
|
[ -d "${NEW_NOTE_DIR}" ] || mkdir "${NEW_NOTE_DIR}"
|
||||||
|
@ -112,7 +112,9 @@ subshell() {
|
||||||
|
|
||||||
shell() {
|
shell() {
|
||||||
if [ -n "${2+foo}" ]; then
|
if [ -n "${2+foo}" ]; then
|
||||||
DIR="$BASE_DIR/$(cd "$BASE_DIR" && fd -d 1 -t d | sed 's-\./--g' | $FZF_SEARCH "$2")" || exit
|
DIR="$BASE_DIR/$(cd "$BASE_DIR" && fd -d 1 -t d | sed 's-\./--g' | $FZF -q "$2")" || exit
|
||||||
|
else
|
||||||
|
DIR="$BASE_DIR"
|
||||||
fi
|
fi
|
||||||
if cd "$DIR"; then
|
if cd "$DIR"; then
|
||||||
subshell
|
subshell
|
||||||
|
|
Loading…
Add table
Reference in a new issue