mirror of
https://github.com/preservim/vim-wordy.git
synced 2025-11-09 18:33:48 -05:00
Truncating message line to avoid enter key
This commit is contained in:
@@ -58,7 +58,7 @@ package manager.
|
|||||||
|
|
||||||
### On demand
|
### On demand
|
||||||
|
|
||||||
Using this plugin's commands does not require any special configuration.
|
Using this plugin’s commands does not require any special configuration.
|
||||||
|
|
||||||
Important note: on the first use of each of the plugin’s dictionaries,
|
Important note: on the first use of each of the plugin’s 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:
|
||||||
|
|||||||
@@ -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, ', ')
|
|
||||||
|
" the magic numbers derived empirically with MacVim
|
||||||
|
" 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
|
||||||
else
|
else
|
||||||
let l:msg = 'off'
|
let l:msg = l:prefix . 'off'
|
||||||
endif
|
endif
|
||||||
echohl ModeMsg | echo 'wordy: ' . l:msg | echohl NONE
|
echohl ModeMsg | echo l:msg | echohl NONE
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! wordy#jump(mode)
|
function! wordy#jump(mode)
|
||||||
|
|||||||
Reference in New Issue
Block a user