sorry for my lazy, i use chinese to explain it...
好吧,你应该可以这么做:
function! Space()
if getline('.')[col('.')-2] !~ '\a'
" 加入下面这一行,防止变成继续补全,见:h ctrl-x_ctrl-n
\ || pumvisible()
return ' '
else
let g:old_col = col('.')
return "\<c-x>\<c-n>"
endif
endfunction
function! ResultOfSpace()
" 如果出现列表,自动选中第一个
if pumvisible()
return "\<c-n>"
" 如果当前只有唯一匹配,返回如下字符串,防止再次按空格键时产生连续补全
elseif col('.') != g:old_col
return " \<bs>"
" 补全失败,补上一个空格
else
return " "
endif
endfunction
ino <space> <c-r>=Space()<cr><c-r>=ResultOfSpace()<cr>
On 1月11日, 上午9时18分, "Yue Wu" <[email protected]> wrote:
> On Sun, 11 Jan 2009 09:10:12 +0800, StarWing <[email protected]> wrote:
>
> > just a problem, in your words,
> > app|
> > "|" places the location of cursor, now you press <space>, and it spead
> > to <C-X><C-U><C-U>, but can't find match.then you will find, you can't
> > input space in this place.
> > you can have a try.
>
> Yes, that's the correct respond of vim. That's not a problem for me.
> I just want that:
>
> In condition "app|<space>", <space> will do <C-x><C-u><C-u> for me,
> say there is a completion "程“ for app, result will be "程|"
>
> In condition "程|<space>", <space> will insert a <space> for me,
> so result will be "程 |"
>
> Any easy solution?
>
> --
> Regards,
> Van.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---