Loading ...
Sorry, an error occurred while loading the content.

Cannot map to auto completion

Expand Messages
  • Ansman
    No matter what I do I cannot bind to autocompletion in insert mode. I ve tried removing my vimrc and just having set nocompatible and it still doesn t
    Message 1 of 2 , May 18, 2012
    • 0 Attachment
      No matter what I do I cannot bind <Tab> to autocompletion in insert mode.

      I've tried removing my vimrc and just having set nocompatible and it still
      doesn't work.
      Running :verbose set cp? wc? shows
      nocompatible
      Last set from ~/.vimrc
      wildchar=<Tab>
      Last set from ~/.vimrc

      What am I missing?

      P.S. <ctrl>+<n> works just fine.

      --
      View this message in context: http://vim.1045645.n5.nabble.com/Cannot-map-Tab-to-auto-completion-tp5708415.html
      Sent from the Vim - Mac mailing list archive at Nabble.com.

      --
      You received this message from the "vim_mac" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Ben Schmidt
      ... Strange nobody replied to this. wildchar only applies to commandline mode, not insert mode. I make work the way I want it in insert mode, and
      Message 2 of 2 , Jun 18 10:12 AM
      • 0 Attachment
        On 18/05/12 8:08 PM, Ansman wrote:
        > No matter what I do I cannot bind<Tab> to autocompletion in insert mode.
        >
        > I've tried removing my vimrc and just having set nocompatible and it still
        > doesn't work.
        > Running :verbose set cp? wc? shows
        > nocompatible
        > Last set from ~/.vimrc
        > wildchar=<Tab>
        > Last set from ~/.vimrc
        >
        > What am I missing?
        >
        > P.S.<ctrl>+<n> works just fine.

        Strange nobody replied to this.

        'wildchar' only applies to commandline mode, not insert mode.

        I make <Tab> work the way I want it in insert mode, and enabled by
        default only for PHP files, with this in my .vimrc:

        function! TabCompletion()
        inoremap <buffer> <expr> <Tab>
        \ col('.')==1\|\|match(getline('.')[col('.')-2],'\s')!=-1?
        \ "\<Tab>":"\<C-N>"
        endfunction
        function! TabCompletionOff()
        iunmap <buffer> <Tab>
        endfunction
        command! TabCompletion call TabCompletion()
        command! TabCompletionOff call TabCompletionOff()
        augroup TabCompletion
        au FileType php TabCompletion
        augroup END

        You may find this helpful.

        Smiles,

        Ben.



        --
        You received this message from the "vim_mac" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      Your message has been successfully submitted and would be delivered to recipients shortly.