16

私はvimでsnipMatepydictionを一緒に使用しようとしていますが、どちらも<tab>キーを使用して天才自動補完スニペットレンダリングの良さを実行しています。

pydiction をインストールすると、snipMate が機能しなくなります。両方が<tab>キーを所有できないためだと思います。どうすればそれらを連携させることができますか?

それらの1つを別のキーにマッピングしてもかまいませんが、これを行う方法がよくわかりません...(おそらく<ctrl-n>キーへのパイディクションで、vimのオートコンプリートを模倣しますか?)。

関連する .vimrc は次のとおりです。

filetype indent plugin on 

autocmd FileType python set ft=python.django 
autocmd FileType html set ft=html.django_template 

let g:pydiction_location = '~/.vim/ftplugin/pydiction-1.2/complete-dict'
4

3 に答える 3

15

まあ、これはSnipmateのヘルプファイルからのものです:)

                                                              *snipMate-remap*
snipMate does not come with a setting to customize the trigger key, but you
can remap it easily in the two lines it's defined in the 'after' directory
under 'plugin/snipMate.vim'. For instance, to change the trigger key
to CTRL-J, just change this: >

 ino <tab> <c-r>=TriggerSnippet()<cr>
 snor <tab> <esc>i<right><c-r>=TriggerSnippet()<cr>

to this: >
 ino <c-j> <c-r>=TriggerSnippet()<cr>
 snor <c-j> <esc>i<right><c-r>=TriggerSnippet()<cr>
于 2009-11-06T20:20:35.937 に答える
7

または、編集して別のものに~/.vim/after/ftplugin/python_pydiction.vim 変更することもできます。Tab

" Make the Tab key do python code completion:
inoremap <silent> <buffer> <Tab> 
         \<C-R>=<SID>SetVals()<CR>
         \<C-R>=<SID>TabComplete('down')<CR>
         \<C-R>=<SID>RestoreVals()<CR>

" Make Shift+Tab do python code completion in the reverse direction:
inoremap <silent> <buffer> <S-Tab> 
         \<C-R>=<SID>SetVals()<CR>
         \<C-R>=<SID>TabComplete('up')<CR>
         \<C-R>=<SID>RestoreVals()<CR>
于 2010-03-31T08:38:58.957 に答える
4

the_karel による回答が 2009 年に提供されて以来、トリガー キーを変更する方法が変更された可能性があると思いますが、同じディレクトリ、つまり「after/plugin/snipMate.vim」にあります。ヘルプファイルにもありました:

 *snipMate-trigger*
snipMate comes with a setting to configure the key that is used to trigger
snipMate. To configure the key set g:snips_trigger_key to something other than
<tab>,e.g. <c-space> use:

 let g:snips_trigger_key='<c-space>'
于 2012-10-29T00:15:12.057 に答える