Add g:mbnotes_rename_on_save
This commit is contained in:
parent
a9ed31593f
commit
de06a2087c
6 changed files with 15 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
/doc/tags
|
/doc/tags
|
||||||
|
__pycache__
|
||||||
|
|
|
@ -64,7 +64,7 @@ export def BeforeNoteSave()
|
||||||
var daily_path = g:mbnotes_dir .. "/daily"
|
var daily_path = g:mbnotes_dir .. "/daily"
|
||||||
|
|
||||||
# Don't touch daily notes
|
# 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 base = expand('%:t')
|
||||||
var date = base[0 : 9]
|
var date = base[0 : 9]
|
||||||
|
|
||||||
|
|
|
@ -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
|
the render commands (e.g. |:MBNotesRenderPDF|) will not open the output file
|
||||||
after rendering.
|
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*
|
4. Commands *mbnotes-commands*
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,10 @@ if !exists("g:mbnotes_date_format_long")
|
||||||
g:mbnotes_date_format_long = "%A, %-e %B %Y"
|
g:mbnotes_date_format_long = "%A, %-e %B %Y"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !exists("g:mbnotes_rename_on_save")
|
||||||
|
g:mbnotes_rename_on_save = 1
|
||||||
|
endif
|
||||||
|
|
||||||
import autoload 'mbnotes.vim'
|
import autoload 'mbnotes.vim'
|
||||||
|
|
||||||
augroup MBNotes
|
augroup MBNotes
|
||||||
|
|
Binary file not shown.
|
@ -27,6 +27,4 @@ def generate_daily_note(date_offset = 0):
|
||||||
date_format = vim.eval("g:mbnotes_date_format_long")
|
date_format = vim.eval("g:mbnotes_date_format_long")
|
||||||
date = date.strftime(date_format)
|
date = date.strftime(date_format)
|
||||||
|
|
||||||
author = vim.eval("g:mbnotes_author")
|
return daily_template.substitute(date=date)
|
||||||
|
|
||||||
return daily_template.substitute(date=date, author=author)
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue