代码拉取完成,页面将自动刷新
" =============================================================================
"
" VimPinyin —— Vim 拼音输入法
"
" 作者: ChaiShushan<chaishushan@gmail.com>
" 版权: BSD
"
" =============================================================================
" UTF8无BOM编码
scriptencoding utf-8
" =============================================================================
"{{{
" 全角数字
let s:zhDigit = [
\'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
\]
" 全角字母
let s:zhAlphaLower = [
\'a', 'b', 'c', 'd', 'e', 'f', 'g',
\'h', 'i', 'j', 'k', 'l', 'm', 'n',
\'o', 'p', 'q', 'r', 's', 't',
\'u', 'v', 'w', 'x', 'y', 'z',
\]
let s:zhAlphaUpper = [
\'A', 'B', 'C', 'D', 'E', 'F', 'G',
\'H', 'I', 'J', 'K', 'L', 'M', 'N',
\'O', 'P', 'Q', 'R', 'S', 'T',
\'U', 'V', 'W', 'X', 'Y', 'Z',
\]
" 英文标点
let s:enPunctList = [
\'`', '~',
\'!', '@', '#', '$', '%', '^', '&', '*', '(', ')',
\'-', '_', '=', '+',
\'[', '{', ']', '}', '\', '|',
\';', ':', "'", '"',
\',', '<', '.', '>', '/', '?',
\' ',
\]
" 中文标点(全角)
let s:zhPunctList = [
\'·', '~',
\'!', '@', '#', '¥', '%', '……', '&', '*', '(', ')',
\'-', '——', '=', '+',
\'【', '『', '】', '』', '、', '|',
\';', ':', '‘', '“',
\',', '《', '。', '》', '/', '?',
\' ',
\]
"}}}
" =============================================================================
"{{{
" 单双引号匹配
let s:cntSingleQuotation = 0
let s:cntDoubleQuotation = 0
" 处理可打印字符
" 字母/数字/标点/空格/tab
function! VimPinyin_PunctEngine_ProcessInput(keycode)
" 数字
if VimPinyin_Common_IsDigit(a:keycode)
if g:VimPinyin_modeFull
return s:zhDigit[a:keycode-char2nr('0')]
else
return nr2char(a:keycode)
end
endif
" 字母
if VimPinyin_Common_IsLower(a:keycode)
if g:VimPinyin_modeFull
return s:zhAlphaLower[a:keycode-char2nr('a')]
else
return nr2char(a:keycode)
end
endif
if VimPinyin_Common_IsUpper(a:keycode)
if g:VimPinyin_modeFull
return s:zhAlphaLower[a:keycode-char2nr('A')]
else
return nr2char(a:keycode)
end
endif
for i in range(len(s:enPunctList))
if a:keycode == char2nr(s:enPunctList[i])
if g:VimPinyin_modeFull || g:VimPinyin_modeFullPunct
if a:keycode == char2nr("'")
let cnt = s:cntSingleQuotation
let s:cntSingleQuotation = s:cntSingleQuotation+1
return (cnt%2 == 0)? '‘': '’'
elseif a:keycode == char2nr('"')
let cnt = s:cntDoubleQuotation
let s:cntDoubleQuotation = s:cntDoubleQuotation+1
return (cnt%2 == 0)? '“': '”'
else
return s:zhPunctList[i]
endif
else
return s:enPunctList[i]
endif
endif
endfor
return "punct: " . a:keycode
endfunction
" 重置状态
function! VimPinyin_PunctEngine_Reset()
let s:cntSingleQuotation = 0
let s:cntDoubleQuotation = 0
endfunction
"}}}
" =============================================================================
"{{{1 vim: foldmethod=marker:
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。