Truncating message line to avoid enter key

This commit is contained in:
Reed Esau
2014-08-21 02:44:21 -06:00
parent 7db7399705
commit d13caf6137
2 changed files with 20 additions and 11 deletions

View File

@@ -58,7 +58,7 @@ package manager.
### On demand ### On demand
Using this plugin's commands does not require any special configuration. Using this plugins commands does not require any special configuration.
Important note: on the first use of each of the plugins dictionaries, Important note: on the first use of each of the plugins dictionaries,
a spell file will be built. This produces a message that resembles: a spell file will be built. This produces a message that resembles:

View File

@@ -53,15 +53,24 @@ function! wordy#init(...) abort
let l:msg = 'Unable to read source: ' . l:src_path let l:msg = 'Unable to read source: ' . l:src_path
endif endif
endfor endfor
let l:prefix = 'wordy: '
if len(l:dst_paths) > 0 if len(l:dst_paths) > 0
let b:original_spl = &spelllang let b:original_spl = &spelllang
exe 'setlocal spelllang=' . l:lang . ',' . join(l:dst_paths, ',') exe 'setlocal spelllang=' . l:lang . ',' . join(l:dst_paths, ',')
setlocal spell setlocal spell
let l:msg = join(l:dicts, ', ')
else " the magic numbers derived empirically with MacVim
let l:msg = 'off' " docs for rulerformat say 'The default ruler width is 17 characters'
let l:msg = l:prefix . join(l:dicts, ', ')
let l:max_len = &columns - strlen(l:prefix) - 5 - (&ruler ? 18 : 0)
if strlen(l:msg) > l:max_len
let l:msg = strpart(l:msg, 0, l:max_len-3) . '...'
endif endif
echohl ModeMsg | echo 'wordy: ' . l:msg | echohl NONE else
let l:msg = l:prefix . 'off'
endif
echohl ModeMsg | echo l:msg | echohl NONE
endfunction endfunction
function! wordy#jump(mode) function! wordy#jump(mode)