This function replaces the existing file name with the name of the file stored in register %.
The file should have the file name after "Module" word for this function to work properly.
function! ReadFileName()
let l:linenum = search("^// *[Mm]odule","w")
let l:filename = getreg("%")
let l:newline = '// Module : '.filename
sil exe ":call setline( linenum, newline)"
endfunction
No comments:
Post a Comment