add and remove tags
This commit is contained in:
@@ -35,7 +35,7 @@ function s:plain_new(id, title, tags)
|
||||
return [
|
||||
\ 'title: ' .. a:title,
|
||||
\ 'date: ' .. strftime('%F'),
|
||||
\ 'tags: ' .. a:tags->join(' '),
|
||||
\ 'tags: ' .. a:tags->join(' '),
|
||||
\ 'identifier: ' .. a:id,
|
||||
\ '---------------------------',
|
||||
\ ]
|
||||
@@ -76,3 +76,12 @@ function denote#frontmatter#setTitle(filename, title)
|
||||
call map(l:frontmatter, { _, v -> substitute(v, '^#\?+\?title:\?\s*"\?\zs.\{-\}\ze\"\?$', a:title, '')})
|
||||
call setbufline(a:filename, 1, l:frontmatter)
|
||||
endfunction
|
||||
|
||||
" Set tags in front matter
|
||||
function denote#frontmatter#setTags(filename, tags)
|
||||
let l:frontmatter = s:getFrontmatter(a:filename)
|
||||
let l:tagline = denote#frontmatter#new(fnamemodify(a:filename, ':t'), '', '', a:tags)
|
||||
\ ->filter('v:val =~ "^\\(#+file\\)\\?tags"')[0]
|
||||
call map(l:frontmatter, { _, v -> v =~ '^\(#+file\)\?tags' ? l:tagline : v})
|
||||
call setbufline(a:filename, 1, l:frontmatter)
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user