Skip to content

g:SuperTabNoCompleteAfter not being respected #74

Closed

Description

@srushti

With the default settings Supertab has started autocompleting at the beginning of a new line. I tried overriding it explicitly as well with:

let g:SuperTabNoCompleteAfter = ['^', ',', '\s']

but that didn't help either.

Activity

  1. ervandew commented on Apr 30, 2013

    @ervandew
    Owner

    My guess would be that you have snipmate or some other plugin installed which is actually mapped to <tab>. You can confirm this using:

    :verbose imap <tab>
    

    The problem is probably due to the recent removal of the <c-n> and <c-p> mappings from supertab which doesn't affect supertab's functionality, but some plugins (the original author's version of snipmate being the most common) re-map tab and will delegate to supertab through those <c-n> and <c-p> mappings instead of the explicit <Plug>SuperTabForward and <Plug>SuperTabBackward mappings. But since the <c-n> and <c-p> mappings no longer exist in supertab, the offending plugin is now actually invoking vim's keyword completion directly, bypassing supertab entirely.

    So, if you are using snipmate, you can:

    1. Start using a more recent fork since the original author has abandoned it. garbas/vim-snipmate seems to be the most popular.
    2. Use my fork: ervandew/snipmate.vim

    If you are using some other plugin that is triggering this issue, then first see if there is a more recent version, if not, let me know what the plugin is and I'll take a look.

  2. paulstaab commented on Apr 30, 2013

    @paulstaab

    Removing the original version of snipmate solved the issue for me. Thanks.

  3. l3pp4rd commented on May 2, 2013

    @l3pp4rd

    thanks, guess it would be good to place this in readme as well.

  4. srushti commented on May 3, 2013

    @srushti
    Author

    That was indeed it. Using the newer version fixed it. Thanks.

  5. ygt-luca commented on Apr 2, 2014

    @ygt-luca

    Hi Eric,
    I recently found that the default supertab mapping is overridden by ultisnips.
    As a workaround I temporarily mapped ultisnip completion to <s-tab> (https://github.com/lucabelmondo/bouncing-vim/commit/630f519be3cb0915404447eeb03cf4b77001d26e) but I thought to let you know.
    Thanks,
    Luca

  6. ervandew commented on Apr 2, 2014

    @ervandew
    Owner

    That's something they would need to address. Snipmate handles this by looking for snippets first, then forwarding on to supertab if no snippets are found.

  7. ygt-luca commented on Apr 2, 2014

    @ygt-luca

    Ah, cool, thanks for letting me know. I will post an issue for ultisnips then :-)

  8. fespinoza commented on Jul 24, 2014

    @fespinoza

    just to clarify... when you execute :verbose imap <tab> the result should say Snippmate...

    and at least with Vundle, the plugin inclussion with

    Bundle 'ervandew/supertab'
    

    should be after the snipmate bundle definition... at least in my configuration

  9. j5shi commented on Nov 29, 2014

    @j5shi

    If you are using some other plugin that is triggering this issue, then first see if there is a more recent version, if not, let me know what the plugin is and I'll take a look.

    Hi, when I use supertab together with jedi-vim, I met the similiar issue, this is my configuration:

    let g:SuperTabDefaultCompletionType = "<c-space>"
    let g:jedi#completions_command      = "<c-space>" 
    

    I configured the default completion type of supertab to jedi-vim's for python scripts, and when I press tab in a python script, the cursor will move to the begining of the current line. below is what verbose imap <tab> returned

    i <Tab>    * <ESC>I
    Last set from /.../vimrc
    
  10. ervandew commented on Dec 2, 2014

    @ervandew
    Owner
    let g:SuperTabDefaultCompletionType = "<c-space>"
    

    "<c-space>" isn't a valid vim insert completion keybinding, so I'm not sure that using that will work. If it doesn't, try using "<c-x><c-o>" instead since jedi does set vim's omnifunc option.

    i <Tab>    * <ESC>I
    Last set from /.../vimrc
    

    Somewhere in that vimrc file you've mapped <tab> to move the cursor to the beginning of the current line. If you no longer want that to be the behavior when you hit <tab>, then you'll need to remove that mapping from that file.

  11. j5shi commented on Dec 3, 2014

    @j5shi

    i * I
    Last set from /.../vimrc

    This is a very tricky issue, I used to use an autocmd :so % to re-source _vimrc when _vimrc is modified and saved, so at the very begining when vim is initialized and _vimrc has not been re-sourced, everything works perfectly, and later when I modify _vimrc and it get re-sourced, then the tab mapping is screwed up, which became * <ESC>I. Now I disabled _vimrc auto re-sourcing and I 'm able to use supertab and Jedi-vim together, but, still, I don't know what exactly makes my tab mapping fucked up.

  12. ervandew commented on Dec 3, 2014

    @ervandew
    Owner

    This is a very tricky issue, I used to use an autocmd :so % to re-source _vimrc when _vimrc is modified and saved, so at the very begining when vim is initialized and _vimrc has not been re-sourced, everything works perfectly, and later when I modify _vimrc and it get re-sourced, then the tab mapping is screwed up, which became * <ESC>I.

    Here is what is happening:

    • you start vim and your vimrc is loaded early in the process and creates the i <TAB> * <ESC>I mapping.
    • supertab is loaded later during startup and overrides you vimrc mapping with its own.
    • you modify your vimrc and the autocmd reloads it, re-executing your i <TAB> * <ESC>I mapping which now overrides the supertab mapping (supertab is not reloaded)

    Now I disabled _vimrc auto re-sourcing and I 'm able to use supertab and Jedi-vim together, but, still, I don't know what exactly makes my tab mapping fucked up.

    Simply remove the imap <Tab> <ESC>I mapping from your vimrc, problem solved.

  13. qstrahl commented on Dec 3, 2014

    @qstrahl

    Simply remove the imap <Tab> <ESC>I mapping from your vimrc, problem solved.

    Alternatively, use :imap <unique> <Tab> <ESC>I so that it only creates the map if nothing is mapped to <Tab>.

  14. j5shi commented on Dec 4, 2014

    @j5shi

    Hi, I know you guys are genius, but none of your suggestions work.

    @ervandew: I didn't find any imap <Tab> <ESC>I in my vimrc, so problem not solved.

    @qstrahl: I tried to add this line to :imap <unique> <Tab> <ESC>I my vimrc, even though I saw the warning: tab mapping already exist, BUT, tab is mapped to <ESC>I anyway, when vimrc got re-sourced!

    what's more, I scanned everyfile in vimfiles/autoload and vimfiles/bundle to try to find any <Tab> <ESC>I statements, but I found nothing.

  15. ervandew commented on Dec 4, 2014

    @ervandew
    Owner

    When you run

    :verbose imap <tab>
    

    That will tell you the file that last set that mapping, so there must be an imap, inoremap, etc in there that is mapping <tab>. If you're comfortable posting the contents of that file here, then I can point out the line.

  16. j5shi commented on Dec 4, 2014

    @j5shi
    source $VIMRUNTIME/vimrc_example.vim
    
    "" To open files in tabs in the instance, use command line option: 
    "gvim -p --remote-tab-silent
    
    " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    " pathogen
    " https://github.com/tpope/vim-pathogen
    " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    execute pathogen#infect()
    filetype plugin indent on 
    
    
    " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    " taglist
    " https://github.com/j5shi/vim-taglist.git
    " http://vim-taglist.sourceforge.net/
    " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    let Tlist_Auto_Highlight_Tag      = 1
    let Tlist_Auto_Open               = 1
    let Tlist_Auto_Update             = 1
    let Tlist_Close_On_Select         = 0
    let Tlist_Ctags_Cmd               = 'c:/ctags/ctags.exe'
    let Tlist_Enable_Fold_Column      = 0
    let Tlist_File_Fold_Auto_Close    = 1
    let Tlist_GainFocus_On_ToggleOpen = 1
    let Tlist_Exit_OnlyWindow         = 1
    let Tlist_Display_Prototype       = 1
    let Tlist_Use_SingleClick         = 1
    let Tlist_Use_SingleClick         = 1
    let Tlist_Auto_Highlight_Tag      = 1
    let Tlist_Process_File_Always     = 1
    let Tlist_Show_One_File           = 0
    let Tlist_Sort_Type               = "name"
    let Tlist_WinWidth                = 25
    let Tlist_Display_Prototype       = 1
    let Tlist_Show_Menu               = 1
    let Tlist_Max_Submenu_Items       = 25
    noremap <leader>tt :TlistToggle<CR>
    noremap <leader>tr <c-w>w<CR>/
    
    
    " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    " snipmate
    " https://github.com/msanders/snipmate.vim
    " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    let g:snips_author = 'Jia Shi'
    
    
    " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    " nerdtree
    " https://github.com/scrooloose/nerdtree.git
    " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    let NERDTreeChDirMode     = 1
    let NERDTreeQuitOnOpen    = 1
    let NERDTreeShowBookmarks = 1
    let NERDTreeWinPos        = "right"
    let NERDTreeWinSize       = 30
    let NERDTreeIgnore        = ['\~$']
    nnoremap <leader>ee :NERDTreeToggle<CR>
    nnoremap <leader>eo :NERDTree 
    nnoremap <leader>em :NERDTreeMirror<CR>
    nnoremap <leader>ec :NERDTreeClose<CR>
    nnoremap <leader>ef :NERDTreeFind<CR>
    nnoremap <leader>eb :Bookmark  
    nnoremap <leader>et :BookmarkToRoot  
    nnoremap <leader>er :ClearBookmarks  
    
    " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    " nerdcommenter
    " https://github.com/scrooloose/nerdcommenter.git
    " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    "<Leader>cc      : Comment out the current line or text selected in visual mode.
    "<Leader>cn      : Same as <Leader>cc but forces nesting.
    "<Leader>c<space>: Toggles the comment state of the selected line(s).
    "<Leader>cm      : Comments the given lines using only one set of multipart delimiters.
    "<Leader>ci      : Toggles the comment state of the selected line(s) individually.
    "<Leader>cs      : Comments out the selected lines 'sexily'
    "<Leader>cy      : Same as <Leader>cc except that the commented line(s) are yanked first.
    "<Leader>c$      : Comments the current line from the cursor to the end of line.
    "<Leader>cA      : Adds comment delimiters to the end of line and goes into insert mode between them.
    "<Leader>ca      : Switches to the alternative set of delimiters.
    "<Leader>cl      : Same as NERDComComment except that the delimiters are aligned down the left side
    "<Leader>cb      : Same as NERDComComment except that the delimiters are aligned down both side
    "<Leader>cu      : Uncomments the selected line(s).
    let NERDSpaceDelims = 1
    
    " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    " jedi-vim
    " https://github.com/davidhalter/jedi-vim
    " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    let g:jedi#auto_initialization      = 1
    let g:jedi#auto_vim_configuration   = 0
    let g:jedi#completions_command      = "<C-x><C-o>" 
    let g:jedi#goto_assignments_command = "<leader>a"
    let g:jedi#goto_definitions_command = "<leader>d"
    let g:jedi#documentation_command    = "<leader>k"
    let g:jedi#rename_command           = "<leader>r"
    let g:jedi#usages_command           = "<leader>n"
    let g:jedi#popup_on_dot             = 1
    let g:jedi#popup_select_first       = 0
    let g:jedi#auto_close_doc           = 1
    let g:jedi#show_call_signatures     = 1
    let g:jedi#use_tabs_not_buffers     = 1
    let g:jedi#completions_enabled      = 1
    let g:jedi#use_splits_not_buffers   = ""
    
    
    " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    " supertab
    " https://github.com/ervandew/supertab.git
    " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    au filetype python :call SuperTabSetDefaultCompletionType("<c-x><c-o>")
    let g:SuperTabDefaultCompletionType        = "context"
    let g:SuperTabContextDefaultCompletionType = "<c-n>"
    
    
    " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    " vim-markdown
    " https://github.com/plasticboy/vim-markdown
    " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    let g:vim_markdown_folding_disabled        = 1
    let g:vim_markdown_no_default_key_mappings = 1
    set nofoldenable
    
    
    " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    " delimitMate
    " https://github.com/Raimondi/delimitMate
    " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    let g:delimitMate_autoclose          = 1
    let g:delimitMate_matchpairs         = "(:),[:],{:},<:>"
    let g:delimitMate_quotes             = "\" ' ` *"
    let g:delimitMate_nesting_quotes     = ['"','`']
    let g:delimitMate_smart_quotes       = 1
    let g:delimitMate_smart_matchpairs   = "\" ' ` *"
    let g:delimitMate_excluded_regions   = ""
    let g:delimitMate_expand_cr          = 1
    
    
    " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    " surround
    " https://github.com/tpope/vim-surround
    " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    " ds            delete surroundings
    "               'Hello *world!'           ds'         Hello world!
    "               (123+4*56)/2              ds)         123+456/2
    "               <div>Yo!*</div>           dst         Yo!
    " cs            change surroundings
    "               'Hello *world!'           cs'>        <Hello world!>
    "               'Hello *world!'           cs'<q>      <q>Hello world!</q>
    "               (123+4*56)/2              cs)]        [123+456]/2
    "               (123+4*56)/2              cs)[        [ 123+456 ]/2
    "               <div>Yo!*</div>           cst<p>      <p>Yo!</p>
    " ys            yank surroundings 
    " yS            yank surroundings and indent it
    " yss           yank surroundings to the current line, ignoring leading whitespaces
    " ySS           yank surroundings to the current line, and indent it. Ignoring leading whitespaces
    "               Hello w*orld!         ysiw)       Hello (world)!
    "               Hello w*orld!         yssB        {Hello world!}
    " S             used in visual mode, wraps the selection
    "               In linewise visual mode, the surroundings are placed on separate lines and indented.  
    "               In blockwise visual mode, each line is surrounded.
    " gS            used in visual mode, wraps the selection
    "               In linewise visual mode, the automatic indenting is suppressed
    "               In blockwise visual mode, this enables surrounding past the end of the line with 
    "               'virtualedit' set 
    " b, B, r, a    Aliases for ), }, ], and >, If t or < is used, Vim prompts for an HTML/XML 
    "               tag to insert. 
    " t             pair of HTML or XML tags.  See |tag-blocks| for details.  
    "               Remember that you can specify a numerical argument if 
    "               you want to get to a tag other than the innermost one.
    " w, W, s       Correspond to a |word|, a |WORD|, and a |sentence|
    " p             Represents a |paragraph|
    
    
    " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    " autopep8   
    " https://github.com/tell-k/vim-autopep8
    " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    let g:autopep8_ignore            = "E501,W293"
    let g:autopep8_max_line_length   = 99
    let g:autopep8_aggressive        = 1
    let g:autopep8_disable_show_diff = 0
    
    
    " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    " easy-align
    " https://github.com/junegunn/vim-easy-align
    " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    " Option               name        Type        Default                  Description
    " --------------------------------------------------------------------------------------------------------------
    " filter               CTRL-F      string      Line                     Line filtering expression: g/../ or v/../
    " left_margin          CTRL-L      number      1                        Number of spaces to attach before delimiter
    " right_margin         CTRL-R      number      1                        Number of spaces to attach after delimiter
    " stick_to_left        <Left>,     boolean     0                        Whether to position delimiter on the left-side
    " ignore_groups        CTRL-G      list        ['String', 'Comment']    Delimiters in these syntax highlight groups are ignored
    " ignore_unmatched     CTRL-U      boolean     1                        Whether to ignore lines without matching delimiter
    " indentation          CTRL-I      string      k                        Indentation method (*k*eep, *d*eep, *s*hallow, *n*one)
    " delimiter_align      CTRL-D      string      r                        Determines how to align delimiters of different lengths
    " align                CTRL-A      string      l                        Alignment modes for multiple occurrences of delimiters
    vmap <Enter>   <Plug>(LiveEasyAlign)
    let g:easy_align_ignore_groups = []
    let g:easy_align_delimiters = { 'h': { 'pattern': '-',
                                  \        'ignore_groups': []},
                                  \ ':': { 'pattern': '\:',
                                  \        'left_margin': 0,
                                  \        'right_margin': 1,
                                  \        'ignore_groups': []},
                                  \ '@': { 'pattern': '@',
                                  \        'left_margin': 0,
                                  \        'right_margin': 0,
                                  \        'ignore_groups': []},
                                  \ '<': { 'pattern': '<<\|<=\|<',
                                  \        'left_margin': 1,
                                  \        'right_margin': 0,
                                  \        'ignore_groups': []},
                                  \ '"': { 'pattern': '"',
                                  \        'ignore_groups': []},
                                  \ "'": { 'pattern': "'",
                                  \        'left_margin': 1,
                                  \        'right_margin': 0,
                                  \        'ignore_groups': []},
                                  \ '>': { 'pattern': '>>\|=>\|>',
                                  \        'ignore_groups': []},
                                  \ '\': { 'pattern': '\\',
                                  \        'ignore_groups': []},
                                  \ '/': { 'pattern': '//\+\|/\*\|\*/',
                                  \        'delimiter_align': 'l',
                                  \        'ignore_groups': []},
                                  \ ']': { 'pattern': '[[\]]',
                                  \        'left_margin': 0,
                                  \        'right_margin': 0,
                                  \        'stick_to_left': 0,
                                  \        'ignore_groups': []},
                                  \ ')': { 'pattern': '[()]',
                                  \        'left_margin': 0,
                                  \        'right_margin': 0,
                                  \        'stick_to_left': 0,
                                  \        'ignore_groups': []},
                                  \ 'x': { 'pattern': ' \(\S\+\s*[;=]\)\@=',
                                  \        'left_margin': 0,
                                  \        'right_margin': 0,
                                  \        'ignore_groups': []},
                                  \ }
    
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "                           Preference                              "
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " popup menu color option
    highlight Pmenu     guibg=darkgrey    guifg=white
    highlight PmenuSel  guibg=LightYellow guifg=darkgrey
    highlight PmenuSbar guibg=darkgrey
    
    syntax enable
    colorscheme molokai
    set guifont=meslo_lg_l_dz:h11:cANSI
    set guioptions=erRbh
    set guitablabel=%t 
    set laststatus=2  
    set statusline=%y%r%m[BUF:%n]%=%l,%c\ \ [ASCII:%b]\ \ \ \ \ \ \ [%p%%]
    set number 
    set nowrap
    set autoindent
    set smartindent 
    set formatoptions=croqj
    set encoding=utf-8 
    set autowrite 
    set nobackup 
    set completeopt=longest,menuone
    set backspace=indent,eol,start
    set clipboard=unnamed
    set nospell 
    set spelllang=en_us 
    set mousemodel=popup
    set smarttab 
    set expandtab 
    set shiftwidth=4 
    set softtabstop=4
    set hlsearch 
    set incsearch 
    set ignorecase
    set cryptmethod=blowfish
    
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "                           key mapping                             "
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    inoremap <F11>   <ESC>:g//p<CR>
    nnoremap <F11>   <ESC>:g//p<CR>
    inoremap <F12>   <ESC>:tabnew $VIM/_vimrc<CR>
    nnoremap <F12>   <ESC>:tabnew $VIM/_vimrc<CR>
    inoremap <C-a>   <ESC>A
    nnoremap <C-a>   <ESC>ggVG
    inoremap <C-c>   <ESC>lC
    inoremap <C-d>   <ESC>lDa
    inoremap <C-i>   <ESC>I
    nnoremap <C-del> gg"_dG
    inoremap <C-p>   <C-R>+
    cnoremap <C-p>   <C-R>+
    inoremap <C-s>   <ESC>:w!<CR>
    nnoremap <C-s>   <ESC>:w!<CR>
    inoremap <C-z>   <ESC>ui
    nnoremap <C-z>   u
    inoremap <C-y>   <ESC>lY$a
    nnoremap gf      <c-w>gf
    nnoremap Y       y$
    nnoremap r       <C-r>
    nnoremap S       "_C
    nnoremap ;;      yiw:%s///gc<Left><Left><Left><Left>
    vnoremap ;;      :s///gc<Left><Left><Left><Left>
    vnoremap \\      :s/\\/\//gc<Left><Left><Left><Left>
    
    noremap <silent> <m-w> :call ToggleWrap()<CR>
    function! ToggleWrap()
        if &wrap
            set nowrap
            silent! iunmap <buffer> <Up>
            silent! nunmap <buffer> <Up>
            silent! iunmap <buffer> <Down>
            silent! iunmap <buffer> <Down>
            silent! nunmap <buffer> <Home>
            silent! iunmap <buffer> <Home>
            silent! nunmap <buffer> <End>
            silent! nunmap <buffer> <End>
        else
            set wrap
            inoremap <buffer> <silent> <Up>   <C-o>gk
            noremap  <buffer> <silent> <Up>   gk
            inoremap <buffer> <silent> <Down> <C-o>gj
            noremap  <buffer> <silent> <Down> gj
            inoremap <buffer> <silent> <Home> <C-o>g^
            noremap  <buffer> <silent> <Home> g^
            inoremap <buffer> <silent> <End> <C-o>g$
            noremap  <buffer> <silent> <End> g$
        endif
    endfunction
    
    " black hole replacement
    nnoremap R      "_Dp
    nnoremap rr     "_ddP
    nnoremap riw    "_diwP
    nnoremap raw    "_dawP
    nnoremap ri"    "_di"P
    nnoremap ri'    "_di'P
    nnoremap ra"    "_da"P
    nnoremap ra'    "_da'P
    nnoremap ri]    "_di]P
    nnoremap ra]    "_da]P
    nnoremap ri)    "_di)P
    nnoremap ra)    "_da)P
    nnoremap ri}    "_di}P
    nnoremap ra}    "_da}P
    nnoremap ri>    "_di>P
    nnoremap ra>    "_da>P
    
    " black hole change
    inoremap <C-x>    <ESC>l"_C
    nnoremap <C-x>    "_C
    inoremap <C-x>    <ESC>l"_C
    vnoremap x        "_c
    nnoremap xx       "_cc
    nnoremap xs       "_s
    nnoremap xiw      "_ciw
    nnoremap xaw      "_caw
    nnoremap xis      "_cis
    nnoremap xas      "_cas
    nnoremap xip      "_cip
    nnoremap xap      "_cap
    nnoremap xi"      "_ci"
    nnoremap xa"      "_ca"
    nnoremap xi'      "_ci'
    nnoremap xa'      "_ca'
    nnoremap xi]      "_ci]
    nnoremap xa]      "_ca]
    nnoremap xi)      "_ci)
    nnoremap xa)      "_ca)
    nnoremap xi>      "_ci>
    nnoremap xa>      "_ca>
    nnoremap xi}      "_ci}
    nnoremap xa}      "_ca}
    
    " <ENTER>
    nnoremap <expr><ENTER> getpos('.')[2] == 1 ? "i<ENTER><ESC>" : "i<ENTER><ESC>"
    inoremap <S-ENTER>     <ESC><up>J
    nnoremap <S-ENTER>     <up>J
    inoremap <C-ENTER>     <ESC>o
    nnoremap <C-ENTER>     o
    inoremap <C-S-ENTER>   <ESC>O
    nnoremap <C-S-ENTER>   O
    
    " <SPACE>
    " warning: remapping <SPACE> in insert mode 
    " would cause abbr. And folding issue.
    nnoremap <SPACE>         i<SPACE><ESC>l
    vnoremap <SPACE>         I
    inoremap <S-SPACE>       <ESC>geldwi<SPACE>
    nnoremap <S-SPACE>       geldwi<SPACE><ESC>l
    inoremap <expr><C-SPACE> getpos('.')[2] == 1 ? "<ESC>" : "<ESC>l"
    nnoremap <C-SPACE>       i
    
    "" <TAB> 
    vnoremap <TAB>   >
    nnoremap <TAB>   >>
    inoremap <C-TAB> <TAB>
    vnoremap <S-TAB> <
    nnoremap <S-TAB> <<
    inoremap <S-TAB> <BackSpace>
    
    "" <ARROW>
    inoremap <silent> <S-left>  <Esc><C-v>
    nnoremap <silent> <S-left>  <C-v>
    inoremap <silent> <S-right> <right><Esc><C-v>
    nnoremap <silent> <S-right> <C-v>
    inoremap <silent> <S-up>    <ESC><UP><S-v>
    nnoremap <silent> <S-up>    <S-v>
    inoremap <silent> <S-down>  <ESC><S-v>
    nnoremap <silent> <S-down>  <S-v>
    inoremap <silent> <C-left>  <c-PageUp>
    nnoremap <silent> <C-left>  <c-PageUp>
    inoremap <silent> <C-right> <c-PageDown>
    nnoremap <silent> <C-right> <c-PageDown>
    nnoremap <silent> <M-left>  <c-o>
    nnoremap <silent> <M-right> <c-i>
    nnoremap <silent> <M-up>    #
    nnoremap <silent> <M-down>  *
    
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "                          AUTO COMMAND                             "
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    if !exists("autocmdLoaded")
        let g:autocmdLoaded=1
    
        " start with window maximized 'x' on an English Windows version. 'n' on a French one
        au GUIEnter * simalt ~x
    
        " set the working directory
        au BufEnter * silent! lcd %:p:h
        au BufEnter python execute Python()
        au BufEnter xml execute XML()
        au BufEnter markdown execute Markdown()
        au BufEnter text execute PlainText()
    
        "" restore last view, don't change the position of it
        "" You might want to clean up your 'viewdir' directory now and then.
        au BufLeave *[._]* silent mkview
        au BufReadPost,BufEnter *[._]* silent loadview
        " au BufWritePost _vimrc so %
    endif
    
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "                     USER DEFINED COMMAND                          "
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    command! TabtoSpace   :%s/\t/    /gc
    command! RemoveTab    :%s/\t//gc
    command! ClearView    :!del /Q "c:\Program Files (x86)\Vim\vimfiles\view"
    
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "                     FUNCTION DEFINITION                           "
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    function! Python()
        setlocal foldmethod=indent           " fdm=syntax doesn't work properly
        setlocal foldlevel=1
        nnoremap <F1>                /^class .*:<CR>zz
        inoremap <F1>                <ESC>/^class .*:<CR>zz
        nnoremap <S-F1>              ?^class .*:<CR>zz
        inoremap <S-F1>              <ESC>?^class .*:<CR>zz
        nnoremap <C-F1>              :g/^class .*:/print<CR>
        inoremap <C-F1>              <ESC>:g/^class .*:/print<CR>
        nnoremap <F2>                /def .*:<CR>zz
        inoremap <F2>                <ESC>/def .*:<CR>zz
        nnoremap <S-F2>              ?def .*:<CR>zz
        inoremap <S-F2>              <ESC>?def .*:<CR>zz
        nnoremap <C-F2>              :g/def .*:/print<CR>
        inoremap <C-F2>              <ESC>:g/def .*:/print<CR>
        nnoremap <F3>                /^ *[\(def\)\|\(class\)]\+ .*
        inoremap <F9>                <ESC>:wa<CR>:!python "%:p"<CR><CR>
        nnoremap <F9>                <ESC>:wa<CR>:!python "%:p"<CR><CR>
        inoremap <C-\>               <ESC>/__main__<CR>
        nnoremap <C-\>               /__main__<CR>
    endfunction
    
    function! XML()
        " zc  close a fold at the cursor.
        " zC  close all fold at the cursor.
        " za  toggle open and folder.
        " zA  toggle open and folder all.
        " zo  open fold at the cursor.
        " zO  open all below folds under cursor.
        " zr  decreases folding by one level.
        " zR  decreases all folds.
        " zm  increases more folding by level.
        " zM  increases all folds.
        " zf  creates a fold from the cursor to motion.
        " zd  deletes the fold at the cursor.
        " zE  deletes all folds.
        " [z  move to start of open fold.
        " ]z  move to end of open fold.
        setlocal foldmethod=indent
        setlocal foldlevel=1
        inoremap <F5>   <ESC>za
        nnoremap <F5>   za
        inoremap <F6>   <ESC>zO
        nnoremap <F6>   zO
        inoremap <S-F6> <ESC>zc
        nnoremap <S-F6> zc
        nnoremap <F9>   :%!"c:\Program Files (x86)\Vim\vimfiles\bundle\xmllint\xmllint-1.0.exe" % --format<CR>
        inoremap <F9>   <ESC>:% !"c:\Program Files (x86)\Vim\vimfiles\bundle\xmllint\xmllint-1.0.exe" % --format<CR>
    endfunction
    
    function! Markdown()
        nnoremap <F1>   /^[ ]*#\{1}[ ].*<CR>zz
        nnoremap <S-F1> ?^[ ]*#\{1}[ ].*<CR>zz
        nnoremap <C-F1> :g/^[ ]*#\{1}[ ].*/print<CR>
        nnoremap <F2>   /^[ ]*#\{2}[ ].*<CR>zz
        nnoremap <S-F2> ?^[ ]*#\{2}[ ].*<CR>zz
        nnoremap <C-F2> :g/^[ ]*#\{2}[ ].*/print<CR>
        nnoremap <F3>   /^[ ]*#\{3}[ ].*<CR>zz
        nnoremap <S-F3> ?^[ ]*#\{3}[ ].*<CR>zz
        nnoremap <C-F3> :g/^[ ]*#\{3}[ ].*/print<CR>
        nnoremap <F4>   /^[ ]*#\{4}[ ].*<CR>zz
        nnoremap <S-F4> ?^[ ]*#\{4}[ ].*<CR>zz
        nnoremap <C-F4> :g/^[ ]*#\{4}[ ].*/print<CR>
        nnoremap <F5>   /^[ ]*#\{5}[ ].*<CR>zz
        nnoremap <S-F5> ?^[ ]*#\{5}[ ].*<CR>zz
        nnoremap <C-F5> :g/^[ ]*#\{5}[ ].*/print<CR>
        nnoremap <F6>   /^[ ]*#\{6}[ ].*<CR>zz
        nnoremap <S-F6> ?^[ ]*#\{6}[ ].*<CR>zz
        nnoremap <C-F6> :g/^[ ]*#\{6}[ ].*/print<CR>
        nnoremap <F7>   :g/^[ ]*#\{1,6}[ ].*/print<CR>
        nnoremap <C-F7> :0,.g/^[ ]*#\{1,6}[ ].*/print<CR>
        inoremap <F8>   <ESC>/^ *#\+ .*
        nnoremap <F8>   /^ *#\+ .*
        inoremap <F9>   <ESC>:!start "c:\program Files (x86)\google\Chrome\Application\chrome.exe" "%:p"<CR>
        nnoremap <F9>   :!start "c:\program Files (x86)\google\Chrome\Application\chrome.exe" "%:p"<CR>
        nnoremap -      I-<Space><Esc>
    endfunction
    
    function! PlainText()
        inoremap <F9>    <ESC>:wa<CR>:!"%:p"<CR><CR>
        nnoremap <F9>    <ESC>:wa<CR>:!"%:p"<CR><CR>
    endfunction

    @ervandew: that's my _vimrc

  17. ervandew commented on Dec 4, 2014

    @ervandew
    Owner

    Well I'm not seeing the mapping in that file, but I'm curious if that is the right file. Your original post showed Last set from /.../vimrc (I'm assuming you abbreviated the path before posting?) , and you've posted your _vimrc file, so can you confirm that the /.../vimrc in your :verbose imap <tab> output was actually the full path to your _vimrc?

  18. j5shi commented on Dec 5, 2014

    @j5shi

    sorry, my bad, it should be Last set from /.../_vimrc, and I double checked that my last post was exactly the file where Tab mapping was changed to i <Tab> * <Esc>I.

    That's really weird.

  19. j5shi commented on Dec 6, 2014

    @j5shi

    I found the configuration which causing this issue: inoremap <C-i> <ESC>I, but I still don't know how this happened. As long as I remove <C-i> mapping in insert mode, it will work fine, and I find <C-i> will cause auto completion in insert mode, that's strange since I didn't configured it specifically.

  20. ervandew commented on Dec 6, 2014

    @ervandew
    Owner

    I found the configuration which causing this issue: inoremap <C-i> <ESC>I, but I still don't know how this happened. As long as I remove <C-i> mapping in insert mode, it will work fine, and I find <C-i> will cause auto completion in insert mode, that's strange since I didn't configured it specifically.

    Ah yes, I forgot that due to the way vim handles keyboard input, it sees <c-i> and <tab> as the same key, so you can't map them separately.

  21. j5shi commented on Dec 6, 2014

    @j5shi

    Ah yes, I forgot that due to the way vim handles keyboard input, it sees and as the same key, so you can't map them separately.

    omg, then everything can be explained, thank you Eric.

  22. evencoil commented on Jan 17, 2016

    @evencoil

    I think I am having this problem using recent pulls of supertab and garbas/vim-snipmate.

    The only SuperTab setting I have in my .vimrc is:
    let g:SuperTabDefaultCompletionType = "<c-x><c-o>"

    Yet typically when I try to complete I get keyword completion instead of omnicompletion.
    The behavior seems to be erratic.
    The first time I hit tab in a file I get omnicomplete.
    However after that I usually (but not always) get keyword complete when expecting omnicomplete.

    I have also tried adding
    let g:SuperTabContextDefaultCompletionType = "<c-x><c-o>"

    But this doesn't change anything.

    verbose imap returns:
    <Plug>snipMateNextOrTrigger

    Am I doing something wrong?

  23. nerdpad commented on Dec 1, 2016

    @nerdpad

    @atorg Did you solve your issue? I have the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions