Unify all messages to the user

This commit is contained in:
EinfachToll 2016-03-19 21:29:42 +01:00
parent 4956976bb6
commit 68cdfe36df
4 changed files with 32 additions and 32 deletions

View File

@ -390,7 +390,7 @@ function! vimwiki#base#system_open_link(url) "{{{
return return
endif endif
endtry endtry
echomsg 'Default Vimwiki link handler was unable to open the HTML file!' echomsg 'Vimwiki Error: Default Vimwiki link handler was unable to open the HTML file!'
endfunction "}}} endfunction "}}}
" vimwiki#base#open_link " vimwiki#base#open_link
@ -398,7 +398,7 @@ function! vimwiki#base#open_link(cmd, link, ...) "{{{
let link_infos = vimwiki#base#resolve_link(a:link) let link_infos = vimwiki#base#resolve_link(a:link)
if link_infos.filename == '' if link_infos.filename == ''
echom 'Vimwiki Error: Unable to resolve link!' echomsg 'Vimwiki Error: Unable to resolve link!'
return return
endif endif
@ -505,7 +505,7 @@ function! vimwiki#base#backlinks() "{{{
endfor endfor
if empty(locations) if empty(locations)
echom 'vimwiki: no other file links to this file' echomsg 'Vimwiki: No other file links to this file'
else else
call setloclist(0, locations, 'r') call setloclist(0, locations, 'r')
lopen lopen
@ -823,7 +823,7 @@ function! vimwiki#base#check_links() "{{{
endfor endfor
if empty(errors) if empty(errors)
echom 'Vimwiki: all links are OK' echomsg 'Vimwiki: All links are OK'
else else
call setqflist(errors, 'r') call setqflist(errors, 'r')
copen copen
@ -846,8 +846,8 @@ function! vimwiki#base#edit_file(command, filename, anchor, ...) "{{{
let ok = vimwiki#path#mkdir(dir, 1) let ok = vimwiki#path#mkdir(dir, 1)
if !ok if !ok
echom ' ' echomsg ' '
echom 'Vimwiki: Unable to edit file in non-existent directory: '.dir echomsg 'Vimwiki Error: Unable to edit file in non-existent directory: '.dir
return return
endif endif
@ -880,7 +880,7 @@ endfunction " }}}
function! vimwiki#base#search_word(wikiRx, cmd) "{{{ function! vimwiki#base#search_word(wikiRx, cmd) "{{{
let match_line = search(a:wikiRx, 's'.a:cmd) let match_line = search(a:wikiRx, 's'.a:cmd)
if match_line == 0 if match_line == 0
echomsg 'vimwiki: Wiki link not found.' echomsg 'Vimwiki: Wiki link not found'
endif endif
endfunction " }}} endfunction " }}}
@ -1281,7 +1281,7 @@ endfunction " }}}
" vimwiki#base#goto_index " vimwiki#base#goto_index
function! vimwiki#base#goto_index(wnum, ...) "{{{ function! vimwiki#base#goto_index(wnum, ...) "{{{
if a:wnum > len(g:vimwiki_list) if a:wnum > len(g:vimwiki_list)
echom "vimwiki: Wiki ".a:wnum." is not registered in g:vimwiki_list!" echomsg 'Vimwiki Error: Wiki '.a:wnum.' is not registered in g:vimwiki_list!'
return return
endif endif
@ -1319,7 +1319,7 @@ function! vimwiki#base#delete_link() "{{{
try try
call delete(fname) call delete(fname)
catch /.*/ catch /.*/
echomsg 'vimwiki: Cannot delete "'.expand('%:t:r').'"!' echomsg 'Vimwiki Error: Cannot delete "'.expand('%:t:r').'"!'
return return
endtry endtry
@ -1340,7 +1340,7 @@ function! vimwiki#base#rename_link() "{{{
" there is no file (new one maybe) " there is no file (new one maybe)
if glob(expand('%:p')) == '' if glob(expand('%:p')) == ''
echomsg 'vimwiki: Cannot rename "'.expand('%:p'). echomsg 'Vimwiki Error: Cannot rename "'.expand('%:p').
\'". It does not exist! (New file? Save it before renaming.)' \'". It does not exist! (New file? Save it before renaming.)'
return return
endif endif
@ -1354,13 +1354,13 @@ function! vimwiki#base#rename_link() "{{{
if new_link =~# '[/\\]' if new_link =~# '[/\\]'
" It is actually doable but I do not have free time to do it. " It is actually doable but I do not have free time to do it.
echomsg 'vimwiki: Cannot rename to a filename with path!' echomsg 'Vimwiki Error: Cannot rename to a filename with path!'
return return
endif endif
" check new_fname - it should be 'good', not empty " check new_fname - it should be 'good', not empty
if substitute(new_link, '\s', '', 'g') == '' if substitute(new_link, '\s', '', 'g') == ''
echomsg 'vimwiki: Cannot rename to an empty filename!' echomsg 'Vimwiki Error: Cannot rename to an empty filename!'
return return
endif endif
@ -1375,19 +1375,19 @@ function! vimwiki#base#rename_link() "{{{
" do not rename if file with such name exists " do not rename if file with such name exists
let fname = glob(new_fname) let fname = glob(new_fname)
if fname != '' if fname != ''
echomsg 'vimwiki: Cannot rename to "'.new_fname. echomsg 'Vimwiki Error: Cannot rename to "'.new_fname.
\ '". File with that name exist!' \ '". File with that name exist!'
return return
endif endif
" rename wiki link file " rename wiki link file
try try
echomsg "Renaming ".VimwikiGet('path').old_fname." to ".new_fname echomsg 'Vimwiki: Renaming '.VimwikiGet('path').old_fname.' to '.new_fname
let res = rename(expand('%:p'), expand(new_fname)) let res = rename(expand('%:p'), expand(new_fname))
if res != 0 if res != 0
throw "Cannot rename!" throw "Cannot rename!"
end end
catch /.*/ catch /.*/
echomsg 'vimwiki: Cannot rename "'.expand('%:t:r').'" to "'.new_fname.'"' echomsg 'Vimwiki Error: Cannot rename "'.expand('%:t:r').'" to "'.new_fname.'"'
return return
endtry endtry
@ -1428,7 +1428,7 @@ function! vimwiki#base#rename_link() "{{{
\ cur_buffer[1]]) \ cur_buffer[1]])
" execute 'bwipeout '.escape(cur_buffer[0], ' ') " execute 'bwipeout '.escape(cur_buffer[0], ' ')
echomsg old_fname." is renamed to ".new_fname echomsg 'Vimwiki: '.old_fname.' is renamed to '.new_fname
let &more = setting_more let &more = setting_more
endfunction " }}} endfunction " }}}

View File

@ -161,7 +161,7 @@ endfunction "}}}
function! vimwiki#diary#make_note(wnum, ...) "{{{ function! vimwiki#diary#make_note(wnum, ...) "{{{
if a:wnum > len(g:vimwiki_list) if a:wnum > len(g:vimwiki_list)
echom "vimwiki: Wiki ".a:wnum." is not registered in g:vimwiki_list!" echomsg 'Vimwiki Error: Wiki '.a:wnum.' is not registered in g:vimwiki_list!'
return return
endif endif
@ -191,7 +191,7 @@ endfunction "}}}
function! vimwiki#diary#goto_diary_index(wnum) "{{{ function! vimwiki#diary#goto_diary_index(wnum) "{{{
if a:wnum > len(g:vimwiki_list) if a:wnum > len(g:vimwiki_list)
echom "vimwiki: Wiki ".a:wnum." is not registered in g:vimwiki_list!" echomsg 'Vimwiki Error: Wiki '.a:wnum.' is not registered in g:vimwiki_list!'
return return
endif endif
@ -254,7 +254,7 @@ function! vimwiki#diary#generate_diary_section() "{{{
call vimwiki#base#update_listing_in_buffer(s:format_diary(), call vimwiki#base#update_listing_in_buffer(s:format_diary(),
\ VimwikiGet('diary_header'), content_rx, line('$')+1, 1) \ VimwikiGet('diary_header'), content_rx, line('$')+1, 1)
else else
echom "vimwiki: You can generate diary links only in a diary index page!" echomsg 'Vimwiki Error: You can generate diary links only in a diary index page!'
endif endif
endfunction "}}} endfunction "}}}

View File

@ -80,7 +80,7 @@ function! s:create_default_CSS(path) " {{{
if default_css != '' if default_css != ''
let lines = readfile(default_css) let lines = readfile(default_css)
call writefile(lines, css_full_name) call writefile(lines, css_full_name)
echomsg "Default style.css has been created." echomsg 'Vimwiki: Default style.css has been created'
endif endif
endif endif
endfunction "}}} endfunction "}}}
@ -112,7 +112,7 @@ function! s:get_html_template(template) "{{{
let lines = readfile(template_name) let lines = readfile(template_name)
return lines return lines
catch /E484/ catch /E484/
echomsg 'vimwiki: html template '.template_name. echomsg 'Vimwiki: HTML template '.template_name.
\ ' does not exist!' \ ' does not exist!'
endtry endtry
endif endif
@ -171,7 +171,7 @@ function! s:delete_html_files(path) "{{{
try try
call delete(fname) call delete(fname)
catch catch
echomsg 'vimwiki: Cannot delete '.fname echomsg 'Vimwiki Error: Cannot delete '.fname
endtry endtry
endfor endfor
endfunction "}}} endfunction "}}}
@ -1501,7 +1501,7 @@ function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
endif endif
if done == 0 if done == 0
echomsg 'vimwiki: conversion to HTML is not supported for this syntax!!!' echomsg 'Vimwiki Error: Conversion to HTML is not supported for this syntax'
return return
endif endif
@ -1511,11 +1511,11 @@ endfunction "}}}
function! vimwiki#html#WikiAll2HTML(path_html) "{{{ function! vimwiki#html#WikiAll2HTML(path_html) "{{{
if !s:syntax_supported() && !s:use_custom_wiki2html() if !s:syntax_supported() && !s:use_custom_wiki2html()
echomsg 'vimwiki: conversion to HTML is not supported for this syntax!!!' echomsg 'Vimwiki Error: Conversion to HTML is not supported for this syntax'
return return
endif endif
echomsg 'Saving vimwiki files...' echomsg 'Vimwiki: Saving Vimwiki files ...'
let save_eventignore = &eventignore let save_eventignore = &eventignore
let &eventignore = "all" let &eventignore = "all"
let cur_buf = bufname('%') let cur_buf = bufname('%')
@ -1526,10 +1526,10 @@ function! vimwiki#html#WikiAll2HTML(path_html) "{{{
let path_html = expand(a:path_html) let path_html = expand(a:path_html)
call vimwiki#path#mkdir(path_html) call vimwiki#path#mkdir(path_html)
echomsg 'Deleting non-wiki html files...' echomsg 'Vimwiki: Deleting non-wiki html files ...'
call s:delete_html_files(path_html) call s:delete_html_files(path_html)
echomsg 'Converting wiki to html files...' echomsg 'Vimwiki: Converting wiki to html files ...'
let setting_more = &more let setting_more = &more
setlocal nomore setlocal nomore
@ -1547,11 +1547,11 @@ function! vimwiki#html#WikiAll2HTML(path_html) "{{{
call VimwikiSet('invsubdir', vimwiki#base#invsubdir(subdir)) call VimwikiSet('invsubdir', vimwiki#base#invsubdir(subdir))
if !s:is_html_uptodate(wikifile) if !s:is_html_uptodate(wikifile)
echomsg 'Processing '.wikifile echomsg 'Vimwiki: Processing '.wikifile
call vimwiki#html#Wiki2HTML(path_html, wikifile) call vimwiki#html#Wiki2HTML(path_html, wikifile)
else else
echomsg 'Skipping '.wikifile echomsg 'Vimwiki: Skipping '.wikifile
endif endif
endfor endfor
" reset 'subdir' state variable " reset 'subdir' state variable
@ -1559,8 +1559,8 @@ function! vimwiki#html#WikiAll2HTML(path_html) "{{{
call VimwikiSet('invsubdir', current_invsubdir) call VimwikiSet('invsubdir', current_invsubdir)
call s:create_default_CSS(path_html) call s:create_default_CSS(path_html)
echomsg 'HTML exported to '.path_html echomsg 'Vimwiki: HTML exported to '.path_html
echomsg 'Done!' echomsg 'Vimwiki: Done!'
let &more = setting_more let &more = setting_more
endfunction "}}} endfunction "}}}

View File

@ -2356,7 +2356,7 @@ A second example handles a new scheme, "vfile:", which behaves similar to
endif endif
let link_infos = vimwiki#base#resolve_link(link) let link_infos = vimwiki#base#resolve_link(link)
if link_infos.filename == '' if link_infos.filename == ''
echom 'Vimwiki Error: Unable to resolve link!' echomsg 'Vimwiki Error: Unable to resolve link!'
return 0 return 0
else else
exe 'tabnew ' . fnameescape(link_infos.filename) exe 'tabnew ' . fnameescape(link_infos.filename)