Frage

Ich benutze das Supertab -Plugin in Vim.
Dies sind meine Standardeinstellungen (in _vimrc)

let g:SuperTabDefaultCompletionType = '<c-x><c-k>'  -->(dictionary)  
let g:SuperTabRetainCompletionDuration = "completion"  
let g:SuperTabLongestEnhanced = 1  
let g:SuperTabLongestHighlight = 1  

Ich habe dieses Skript erstellt, um Omnicomplete mit Supertab im laufenden Flug auszuwählen:

function! SuperTabFunction()
  if !exists("WhatSuperTab")
    let WhatSuperTab = "SuperTab function?"
  endif
  if !exists("MenuSuperTab_choices")
    let MenuSuperTab_choices = "&Current page\n&Spellchecker\nSentence\nCode"
  endif
  let n = confirm(WhatSuperTab, MenuSuperTab_choices, "Question")
  if n == 1
    let g:SuperTabDefaultCompletionType = '<c-x><c-m>'
    so $VIM/vimfiles/plugin/supertab.vim
  elseif n == 2
    let g:SuperTabDefaultCompletionType = '<c-x><c-k>'
    so $VIM/vimfiles/plugin/supertab.vim
  elseif n == 3
    let g:SuperTabDefaultCompletionType = '<c-x><c-l>'
    so $VIM/vimfiles/plugin/supertab.vim
  elseif n == 4
    let g:SuperTabDefaultCompletionType = '<c-x><c-o>'
    so $VIM/vimfiles/plugin/supertab.vim
  else
    return ''
  endif
endfun 

  nmap <silent> <C-S-tab> :call SuperTabFunction()<CR>
  imap <silent> <C-S-tab>  <esc>:call SuperTabFunction()<CR>a

Wenn ich oben über die Funktion aufgerufen und Pe "Satz" auswähle, kann ich die Super -Registerkarte verwenden, um Sätze zu vervollständigen, wenn ich die obige Funktion erneut aufgerufen und Pe "Spellschecker" auswähle.

Was habe ich in dieser Funktion falsch gemacht?

War es hilfreich?

Lösung

Haben Sie versucht, die bereitgestellte Funktion aufzurufen, anstatt die globale Variable direkt zu ändern?

" SuperTabSetDefaultCompletionType(type) {{{
" Globally available function that users can use to set the default
" completion type for the current buffer, like in an ftplugin.
function! SuperTabSetDefaultCompletionType(type)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top