From de06a2087c422eef823f2c5bfec099e70dd1c879 Mon Sep 17 00:00:00 2001 From: Max Bucknell Date: Sat, 11 Jan 2025 01:44:04 +0000 Subject: [PATCH] Add g:mbnotes_rename_on_save --- .gitignore | 1 + autoload/mbnotes.vim | 2 +- doc/mbnotes.txt | 8 ++++++++ plugin/mbnotes.vim | 4 ++++ python3/__pycache__/mbnotes.cpython-313.pyc | Bin 1715 -> 0 bytes python3/mbnotes.py | 4 +--- 6 files changed, 15 insertions(+), 4 deletions(-) delete mode 100644 python3/__pycache__/mbnotes.cpython-313.pyc diff --git a/.gitignore b/.gitignore index 0a56e3f..ab2e9f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /doc/tags +__pycache__ diff --git a/autoload/mbnotes.vim b/autoload/mbnotes.vim index 45a4904..ab4bf44 100644 --- a/autoload/mbnotes.vim +++ b/autoload/mbnotes.vim @@ -64,7 +64,7 @@ export def BeforeNoteSave() var daily_path = g:mbnotes_dir .. "/daily" # Don't touch daily notes - if daily_path != full_path[0 : len(daily_path) - 1] + if g:mbnotes_rename_on_save && daily_path != full_path[0 : len(daily_path) - 1] var base = expand('%:t') var date = base[0 : 9] diff --git a/doc/mbnotes.txt b/doc/mbnotes.txt index e96baae..137edf6 100644 --- a/doc/mbnotes.txt +++ b/doc/mbnotes.txt @@ -130,6 +130,14 @@ If none of the above are defined, and this variable is not set explicitly, then the render commands (e.g. |:MBNotesRenderPDF|) will not open the output file after rendering. +g:mbnotes_rename_on_save *g:mbnotes_rename_on_save* + +This plugin will attempt to intelligently rename a note based on its title, +which is the first H1 that it finds in the document. Disable this behaviour by +setting this variable to false >vim + + let g:mbnotes_rename_on_save = 0 + ============================================================================== 4. Commands *mbnotes-commands* diff --git a/plugin/mbnotes.vim b/plugin/mbnotes.vim index 27662fe..ea1658d 100644 --- a/plugin/mbnotes.vim +++ b/plugin/mbnotes.vim @@ -41,6 +41,10 @@ if !exists("g:mbnotes_date_format_long") g:mbnotes_date_format_long = "%A, %-e %B %Y" endif +if !exists("g:mbnotes_rename_on_save") + g:mbnotes_rename_on_save = 1 +endif + import autoload 'mbnotes.vim' augroup MBNotes diff --git a/python3/__pycache__/mbnotes.cpython-313.pyc b/python3/__pycache__/mbnotes.cpython-313.pyc deleted file mode 100644 index c20436df45b36af0f8996364fa910b49bd1ca557..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1715 zcmb7F&2QXP5FhVHvbCEwBmvZ}gdUqk$|81yC>7L7f>a_93F;x6pojp;+x6IMYQML7 zZyea3mLt7HLPBuh4}cqgN}?P90|Kd)5VuN!3n%pK{V3vq_#Nzd^JeCaXMXd1F*j!e z0KELcC&6DOfCpwVMsXxu+y;Qpp$%+qqaW&*1*`@2!!X;^7x7vp}!2^)p9;&DO>V@xlZr-u=7{+k8RY&LBQ zDMFXkHhCBg*d0k&vw1>2sa#g8=Tgl!5zN}WYql>{%*nMGW2{GUluHH}chGAp)G|?B z)Gi~HU}iVAZN{8>%^0aCJ(u0(gdb1#V;%}$3Ub-ooa9t3h0N7&iGD&8J@qig>DdNR z81%?xe#9vnObiV?uI{?obF|U-{Hd=eyGe|Kx)ImfWn59%ji!nJ&%^?hF_Icg;~O*? z$^QC{7vuOJi8Wb-KCQp>Z+#EV*C?3?550+xNa7Bvrp7LXQjAM%TDi=!{@C{NGMl#3 zw!0&;WGDkR6g$f3aPO!uRZ%-K;W zaO@j}niv-z<64J-K+hN-<)IGT_m5h3!%AmIncce{xN*mnQ6FYi$ghRNNQ&Uz{B$qB zLmGv&WUSJe(Ym5a0FaimVk$$gw0IoGX$g;clvXq;KfAN8WbHbn(S4TMI_YQ%DIsi> zQs=SyE5pH&CeKA(0sw8!F$0)Bzxs}hk{I>s>(ay3<1lV!>96KByRka@oK}C3E{=I{ zn4fP9)gk~qYeK#Y07Lj=2`(?4Y~0^CcdB27-#TZ{terV)!_A)-p8R6vvz628E9VQZ z4!6H|uAZ!ay8dPL+<9)e`EYLjWdHvD=~FA`bB*B}51nh@IrTHA{&oG-sh>I%}0A~Dk4FDb$ kEz9~5?4P0f3#|O`#I;9It(GpJx=