From 965ab42cb20652145144e2175ce95e507481663e Mon Sep 17 00:00:00 2001 From: Gregory Leeman Date: Sun, 27 Mar 2022 21:53:22 +0100 Subject: [PATCH] lazygit 2022-03-27 21:53 --- autoload/notecrate.vim | 9 ++++++++- syntax/notecrate.vim | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/autoload/notecrate.vim b/autoload/notecrate.vim index f1b61ec..3b02c87 100644 --- a/autoload/notecrate.vim +++ b/autoload/notecrate.vim @@ -40,7 +40,7 @@ endfunction " }}} function! notecrate#apply_template(title) " {{{ - let l:template = "# " . a:title . "\n\n\n---\n\n" + let l:template = "\n# " . a:title . "\n\n\n\n\n---\n\n" call setreg("l", l:template) silent execute 'normal "lP4j' call notecrate#update_backlinks() @@ -76,6 +76,8 @@ endfunction " }}} function! notecrate#new_note(title, filename) " {{{ let l:filename = expand('%:t') + let l:notecrate_dir = b:notecrate_dir + let l:notecrate_history = b:notecrate_history while !isdirectory(expand(b:notecrate_dir)) let choice = confirm('', b:notecrate_dir . " does not exist. Create? &Yes\n&No\n") if choice == 1 @@ -87,8 +89,11 @@ function! notecrate#new_note(title, filename) " {{{ let l:path = b:notecrate_dir . "/" . a:filename call add(b:notecrate_history, l:filename) silent execute "normal! :w\:e " . l:path . "\" + let b:notecrate_dir = l:notecrate_dir + let b:notecrate_history = l:notecrate_history call notecrate#apply_template(a:title) call notecrate#update_backlinks() + write endfunction " }}} @@ -218,6 +223,7 @@ endfunction " }}} function! notecrate#grep(pattern) " {{{ + echom b:notecrate_dir let l:files = [] try silent execute 'vimgrep /' . a:pattern . '/j ' . b:notecrate_dir . '/*.md' @@ -260,6 +266,7 @@ function! notecrate#update_backlinks() " {{{ endif call setreg("l", l:backlinks) silent execute "normal! /^---\vG$\"lp" + silent execute "normal! gg/^# \jj" endfunction " }}} diff --git a/syntax/notecrate.vim b/syntax/notecrate.vim index 7f8fb7c..7001b77 100644 --- a/syntax/notecrate.vim +++ b/syntax/notecrate.vim @@ -10,7 +10,7 @@ syn match NotecrateLinkConceal /!*\[\+\([^\]]*](\)\@=/ conceal syn match NotecrateLinkConceal /\]\+\((\)\@=/ conceal syn match NotecrateLinkConceal /\(\[[^\]]*\]\)\@<=([^)]*)/ conceal contains=NotecrateLinkInternal syn match NotecrateLink /\(\[\)\@<=[^\[\]]*\(\](\)\@=/ -syn match NotecrateLinkImage /\(!\[\+\)\@<=[^\[\]]*\(\]\+\)\@=/ +" syn match NotecrateLinkImage /\(!\[\+\)\@<=[^\[\]]*\(\]\+\)\@=/ syn match NotecrateHeader1 /\(^# \)\@<=.*/ syn match NotecrateHeader2 /\(^##\+ \)\@<=.*/ syn match NotecrateRule /^---\+/