VIM拼写功能(VIM spelling function)

我不想有一个功能,可以打开拼写检查然后去到下一个拼写错误的单词,并用第一个建议替代迄今为止我所得到的:

function! Spell_new_word() set spell=true exe ']s' exe '1z=' set spell=false endfunction

但它似乎只是拼写为真,并没有做任何事情....我做错了什么?

更新:

我已经厌倦改变EXE正常,但仍然没有运气:

function! Spell_new_word() set spell! normal ']s' normal '1z=' set spell! endfunction

更新2:

我已经厌倦了这一点,它仍然无法正常工作:

function! Spell_new_word() set spell normal ]s normal 1z= set nospell endfunction

但我不认为这是我认为它不具有约束力的问题,d :

let mapleader = "," namp ,d Spell_next_word()

I wan't to have a function that turns spell check on then go's to the next misspelled word and replaces with the first suggestion heres what I've got so far:

function! Spell_new_word() set spell=true exe ']s' exe '1z=' set spell=false endfunction

but it only seems to set spelling to true and doesn't do anything.... what am I doing wrong?

UPDATE:

I've tired changing exe to normal, but still no luck:

function! Spell_new_word() set spell! normal ']s' normal '1z=' set spell! endfunction

UPDATE 2:

I've tired this and it still doesn't work:

function! Spell_new_word() set spell normal ]s normal 1z= set nospell endfunction

But I don't think that is the problem I think thats its not binding to ,d:

let mapleader = "," namp ,d Spell_next_word()

最满意答案

nnoremap ,d :call Spell_next_word()^M

需要注意的事项:

选择模式(普通模式,不重映射) 包括:进入命令模式 call该函数 执行它! ^M 通常在Linux上使用Cv Enter或在Windows上使用CQ Enter来输入

另外,也许包括

inoremap ,d ^O:call Spell_next_word()^M

(再次输入^O作为Cv CoCQ Co

nnoremap ,d :call Spell_next_word()^M

things to note:

choose mode (normal mode, no remapping) include : to enter command mode call the function Execute it! The ^M is normally entered with C-vEnter on linux, or C-QEnter on Windows

Additionally, perhaps include

inoremap ,d ^O:call Spell_next_word()^M

(again typeing the ^O as C-vC-o or C-QC-o)

VIM拼写功能(VIM spelling function)

我不想有一个功能,可以打开拼写检查然后去到下一个拼写错误的单词,并用第一个建议替代迄今为止我所得到的:

function! Spell_new_word() set spell=true exe ']s' exe '1z=' set spell=false endfunction

但它似乎只是拼写为真,并没有做任何事情....我做错了什么?

更新:

我已经厌倦改变EXE正常,但仍然没有运气:

function! Spell_new_word() set spell! normal ']s' normal '1z=' set spell! endfunction

更新2:

我已经厌倦了这一点,它仍然无法正常工作:

function! Spell_new_word() set spell normal ]s normal 1z= set nospell endfunction

但我不认为这是我认为它不具有约束力的问题,d :

let mapleader = "," namp ,d Spell_next_word()

I wan't to have a function that turns spell check on then go's to the next misspelled word and replaces with the first suggestion heres what I've got so far:

function! Spell_new_word() set spell=true exe ']s' exe '1z=' set spell=false endfunction

but it only seems to set spelling to true and doesn't do anything.... what am I doing wrong?

UPDATE:

I've tired changing exe to normal, but still no luck:

function! Spell_new_word() set spell! normal ']s' normal '1z=' set spell! endfunction

UPDATE 2:

I've tired this and it still doesn't work:

function! Spell_new_word() set spell normal ]s normal 1z= set nospell endfunction

But I don't think that is the problem I think thats its not binding to ,d:

let mapleader = "," namp ,d Spell_next_word()

最满意答案

nnoremap ,d :call Spell_next_word()^M

需要注意的事项:

选择模式(普通模式,不重映射) 包括:进入命令模式 call该函数 执行它! ^M 通常在Linux上使用Cv Enter或在Windows上使用CQ Enter来输入

另外,也许包括

inoremap ,d ^O:call Spell_next_word()^M

(再次输入^O作为Cv CoCQ Co

nnoremap ,d :call Spell_next_word()^M

things to note:

choose mode (normal mode, no remapping) include : to enter command mode call the function Execute it! The ^M is normally entered with C-vEnter on linux, or C-QEnter on Windows

Additionally, perhaps include

inoremap ,d ^O:call Spell_next_word()^M

(again typeing the ^O as C-vC-o or C-QC-o)