Last active
December 18, 2015 05:19
-
-
Save kozo2/5731830 to your computer and use it in GitHub Desktop.
tcvime.vimをtcodeで使う場合の設定
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let tcvime_keymap_for_help = 'tcode' | |
if has('keymap') | |
set iminsert=0 imsearch=0 | |
inoremap <C-J> <C-R>=<SID>EnableKeymap('tcode')<CR> | |
inoremap <silent> <C-L> <C-R>=<SID>DisableKeymap()<CR> | |
inoremap <silent> <ESC> <ESC>:set imsearch=0<CR> | |
nnoremap <silent> <C-K>k <Plug>TcvimeNKatakana | |
vnoremap <silent> <C-K>k <Plug>TcvimeVKatakana | |
vnoremap <silent> <C-K>a <Plug>TcvimeVKanji2Seq | |
vnoremap <silent> <C-K>j <Plug>TcvimeVSeq2Kanji | |
endif | |
function! s:EnableKeymap(keymapname) | |
" 既にオンの場合は何もしない | |
if &iminsert | |
return '' | |
endif | |
call tcvime#SetKeymap(a:keymapname) | |
" <Space>で前置型交ぜ書き変換を開始するか、読みが無ければ' 'を挿入。 | |
" (lmapにすると、lmap有効時にfやtやrの後の<Space>が使用不可。(<C-R>=なので)) | |
imap <silent> <Space> <C-G>u<Plug>TcvimeIConvOrSpace | |
return "\<C-^>" | |
endfunction | |
function! s:DisableKeymap() | |
" 既にオフの場合は何もしない | |
if !&iminsert | |
return '' | |
endif | |
set iminsert=0 | |
silent! iunmap <Space> | |
TcvimeCloseHelp | |
return "\<C-^>" | |
endfunction | |
" lmapのカスタマイズを行う関数。 | |
" tcvime#SetKeymap()からコールバックされる。 | |
function! TcvimeCustomKeymap() | |
" カタカナ変換 | |
lmap <silent> 00 <C-R>=tcvime#InputConvertKatakana(0)<CR> | |
" tc2同様の後置型交ぜ書き変換を行うための設定: | |
" 活用しない語 | |
lmap <silent> 18 <C-G>u<C-R>=tcvime#InputPostConvert(1, 0)<CR> | |
lmap <silent> 28 <C-G>u<C-R>=tcvime#InputPostConvert(2, 0)<CR> | |
lmap <silent> 38 <C-G>u<C-R>=tcvime#InputPostConvert(3, 0)<CR> | |
lmap <silent> 48 <C-G>u<C-R>=tcvime#InputPostConvert(4, 0)<CR> | |
" 活用する語(ただしtc2と違って、読みの文字数には活用語尾は含まない) | |
lmap <silent> 29 <C-G>u<C-R>=tcvime#InputPostConvert(2, 1)<CR> | |
lmap <silent> 39 <C-G>u<C-R>=tcvime#InputPostConvert(3, 1)<CR> | |
lmap <silent> 49 <C-G>u<C-R>=tcvime#InputPostConvert(4, 1)<CR> | |
lmap <silent> 59 <C-G>u<C-R>=tcvime#InputPostConvert(5, 1)<CR> | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment