2009-11-06 73 views
16

我試圖使用VIM snipMatepydiction在一起 - 但是,無論使用<tab>鍵來執行他們的天才自動完成 - 摘錄渲染-goodness - 那 - 我那麼渴望。用vim,同時使用snipMate和pydiction在一起(分享<tab>鑰匙?)

安裝pydiction後,snipMate停止工作。我假設它是因爲他們不能擁有<tab>密鑰。我怎樣才能讓他們一起工作?我不介意將其中一個映射到不同的鍵,但我不知道如何做到這一點......(也許pydiction到<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' 

回答

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> 
+0

完美 - 謝謝!也許在我所有的搜索中,我應該仔細看看幫助文檔。嘿。 – thornomad 2009-11-06 22:48:56

+3

不再如此,現在文檔指定它可以用'imap snipMateNextOrTrigger'和'smap snipMateNextOrTrigger' – TKrugg 2013-05-08 14:38:06

+1

+1 @TKrugg重新映射看到我的dotfiles提交了重映射。 https://github.com/simeonwillbanks/dotfiles/commit/660b0505c82157656e15d47cd43108d2d39409db – simeonwillbanks 2013-07-19 15:27:38

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> 
+0

+1:這適用於我。 – 2010-09-21 22:35:03

4

我相信w由於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>'