Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Vimwiki working with SnipMate (the vim plugins)

Tags:

vim

snipmate

My issue is that <Tab> completion for SnipMate does not work when I'm in a vimwiki file. I am testing by typing APACHE<Tab> in insert mode, but I don't get the snippet as I do when I'm in, say, .vimrc.

And even though i_<Tab> doesn't work in a vimwikie file, i_<C-R><Tab> does. I get a list of available snippets. Strange.

To make it stranger (well, to me at least), here's the partial output of :imap in a vimwiki file:

i  <Tab>       * <C-G>u<C-R>=snipMate#TriggerSnippet()<CR>
i  <C-R><Tab>  * <C-R>=snipMate#ShowAvailableSnips()<CR>

I think these are correct, and in other files where <Tab> completion does work, the mappings are the same.

oh, and in case you are thinking to suggest putting let g:vimwiki_table_auto_fmt = 0 in my .vimrc as suggested in http://code.google.com/p/vimwiki/wiki/ChangeLog, I tried it and it doesn't solve my problem. That's the only suggestion I found in my search, so that's why I'm here.

I don't know how much of my .vimrc you would want, so I'm just going to give you the ones I think are relevant to keep this question short:

" Vundle: The plugin manager for vim.                                        
    set runtimepath+=~/.vim/bundle/vundle/                                   
    call vundle#rc()                                                         
    Bundle 'gmarik/vundle'                                                   
" SnipMate: TextMate snippets for vim.                                       
    Bundle "MarcWeber/vim-addon-mw-utils"                                    
    Bundle "tomtom/tlib_vim"                                                 
    Bundle "honza/snipmate-snippets"                                         
    Bundle "garbas/vim-snipmate"                                             
" Vimwiki: A personal wiki for vim.                                          
    Bundle 'vim-scripts/vimwiki'                                             
    let g:vimwiki_hl_headers = 1                                             
    let g:vimwiki_hl_cb_checked = 1                                          
    let g:vimwiki_folding = 1                                                
    let g:vimwiki_fold_lists = 1                                             
    let s:vimwiki = {}                                                       
    let s:vimwiki.path             = '~/Vimwiki/wiki'                        
    let s:vimwiki.path_html        = '~/Vimwiki/html'                        
    let s:vimwiki.ext              = '.md'                                   
    let s:vimwiki.syntax           = 'markdown'                              
    let s:vimwiki.maxhi            = 1                                       
    let s:vimwiki.diary_rel_path   = 'Journal/'                              
    let s:vimwiki.diary_index      = 'index'                                 
    let s:vimwiki.diary_header     = 'Journal'                               
    let s:vimwiki.diary_sort       = 'asc'                                   
    let g:vimwiki_list = [s:vimwiki]

Thanks

Edit:

I don't know why I forgot about this while writing the above. The output of :imap above is incomplete. It also shows:

i  <Tab>       *@vimwiki#tbl#kbd_tab()

Regardless of the value of g:vimwiki_table_auto_fmt. It's probably the source of my problem.. and if so I'd like to get rid of it from .vimrc somehow.

like image 601
user1252848 Avatar asked Dec 11 '22 23:12

user1252848


1 Answers

The @ in the :imap output shows that Vimwiki defines a buffer-local <Tab> mapping that overrides snipMate's global one. A

:iunmap <buffer> <Tab>

should fix that. You can put that command into ~/.vim/after/ftplugin/vimwiki.vim to make it permanent. But apparently Vimwiki allows customization:

" Table mappings
if g:vimwiki_table_mappings
  inoremap <expr> <buffer> <Tab> vimwiki#tbl#kbd_tab()
  inoremap <expr> <buffer> <S-Tab> vimwiki#tbl#kbd_shift_tab()
endif

So, :let g:vimwiki_table_mappings = 0 in your .vimrc should work, too.

like image 55
Ingo Karkat Avatar answered Jan 16 '23 06:01

Ingo Karkat