|
|
@ -361,6 +361,21 @@ function! notecrate#delete_note() " {{{ |
|
|
|
endif |
|
|
|
endfunction |
|
|
|
|
|
|
|
" }}} |
|
|
|
function! notecrate#rename_note(new) " {{{ |
|
|
|
let l:old = substitute(expand('%:t'), ".md", "", "g") |
|
|
|
let l:new = a:new |
|
|
|
let l:oldpath = b:notecrate_dir."/".l:old.".md" |
|
|
|
let l:newpath = b:notecrate_dir."/".l:new.".md" |
|
|
|
let choice = confirm('', "Rename " . l:old . ".md " . l:new . ".md? &Yes\n&No\n") |
|
|
|
if choice == 1 |
|
|
|
silent execute "normal! :!mv " . l:oldpath . " " . l:newpath . "\<CR>" |
|
|
|
call notecrate#open_note(a:new . ".md") |
|
|
|
call notecrate#update_links(l:old, l:new) |
|
|
|
call notecrate#update_backlinks() |
|
|
|
endif |
|
|
|
endfunction |
|
|
|
|
|
|
|
" }}} |
|
|
|
|
|
|
|
" }}} |
|
|
@ -389,6 +404,11 @@ function! notecrate#delete_links(filename) " {{{ |
|
|
|
execute "!" . g:gsed_command . " -i 's/\\[\\([^]]*\\)\\](" . a:filename . ")/\\1/g' " . b:notecrate_dir . "/*md" |
|
|
|
endfunction |
|
|
|
|
|
|
|
" }}} |
|
|
|
function! notecrate#update_links(old, new) " {{{ |
|
|
|
execute "!" . g:gsed_command . " -i 's/" . a:old . ".md/" . a:new . ".md/g' " . b:notecrate_dir . "/*md" |
|
|
|
endfunction |
|
|
|
|
|
|
|
" }}} |
|
|
|
|
|
|
|
" }}} |
|
|
|