Vim is installed at /usr/share/vim.
All snipMate's folders were added to this category in existing folders (after, autoload, plugin, snippets, etc.) accordingly.
From the documentation file:
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>
I tried this as well - the same result.
When I try to trigger snippet match it only adds a tab (4 spaces, accordingly to my .vimrc).
P.S. filetype plugin indent on.
Updated:
cat /etc/issue
Ubuntu 9.10
:inoremap
i <C-B> * <C-R>=TriggerSnippet()<CR>
:snoremap
s <C-B> * <Esc>i<Right><C-R>=TriggerSnippet()<CR>
How can I fix this?
I solved this problem by removing the 'set paste' entry on .vimrc
I had a problem with snipMate, it wasn't working, so I came across with Issue 66 in their Issue Tracker:
source ~/.vim/after/plugin/snipMate.vim
In my case, I experienced the same thing. SnipMate autocomplete does not work. One of the reasons is the is used by other plugin. Typing :verbose imap <Tab> will show you which plugin that utilizes the key and cause the conflict. You can either comment out the plugin in .vimrc or you can change it to use another key.
Related
Ok here is what I want to accomplish:
In INSERT mode I would like emmet to autocomplete with the TAB key
Here is what I have tried
let g:user_emmet_expandabbr_key = '<tab>' (Only works in NORMAL mode)
Though the above code is useful, I need it to work in INSERT mode
I am transferring over from Sublime Text to VIM and I miss having the Emmet functionality so easily accessible. Any ideas as to how I can achieve this?
Thanks in advance.
Solved my problem by including the following lines in my .vimrc file.
let g:user_emmet_expandabbr_key='<Tab>'
imap <expr> <tab> emmet#expandAbbrIntelligent("\<tab>")
Now I can use the TAB key to both indent and activate Emmet snippets in INSERT mode :D
I'm guessing that the reason for your setting not working in INSERT mode is because <tab> is mapped to something elsewhere (most likely with some auto-completion plugins). You can try to find what's mapped by :verbose imap <tab> when editing HTML files and disable that, but I think the simpler solution is to override the mapping yourself, like this:
augroup EmmetSettings
autocmd! FileType html imap <tab> <plug>(emmet-expand-abbr)
augroup END
To know what is done above, see :h autocmd (and :h augroup). Basically it's telling vim to execute the specified command when editing html files. To know about other mappings you can use, see the doc.
In my after.vim config I have line:
inoremap <S-Tab> <C-d>
I would like this binding to work. However, after starting VIM I type the first line and get the following output:
:verbose map <S-Tab>
s <S-Tab> * <Esc>i<Right><C-R>=BackwardsSnippet()<CR>
Last set from ~/dotvim/bundle/snipmate.vim/after/plugin/snipMate.vim
So snipmate is overwriting the mapping. I understand I could change it within the /bundle/snipmate.vim/after/plugin/snipMate.vim file, but that seems really ugly because I've got /bundle in my .gitignore, which seems to be standard practice.
Any ideas on how to override this, or prevent snipmate from binding to <S-Tab> ?
To remap the command executed by <S-Tab> to <C-d> add the following line to your .vimrc
imap <C-d> <Plug>snipMateBack
The snipmate documentation states you should remap <Plug>snipMateBack in your ~/.vimrc. See :h SnipMate-mappings.
Generally using a vim distribution (which you are) is considered bad for new vimmers because it disrupts learning Vim and puts up barriers when a user decides to customize (as you see here). Personally I would suggest you lose the distribution. Go find a nice plugin manager like pathogen and install plugins when you need them. Doing this means you grow your understanding of Vim as you customize it.
If really do want to use a distribution then you should first try submitting an issue to your distributions issue tracker.
A plugin adds to my insert mappings a mapping for <leader>is. I have some ideas which one it can be. But it does not matter I don't want to change anything in foreign plugins. So I want to disable this mapping. I tried this:
imap <leader>is <nop>
I did not help.
What is your suggestions?
BTW, I want to ask how disable in vimrc all insert mapping of plugins?
To remove an insert mode mapping, use the :iunmap command:
:iunmap <Leader>is
I don't know whether it is possible to do "bulk unmapping", but at least you can list all active insert mode mappings with
:imap
or, even better, with
:verbose imap
which will also tell you where the mapping has been defined in the first place.
Edit: To clarify, the unmapping needs to be done after the plugin has been loaded. To do so, create a file with the following contents in ~/.vim/after/plugin/ (see #ZyX's answer):
" myafter.vim: will be executed after plugins have been loaded
iunmap <Leader>is
Your command if inserted in the vimrc is executed before plugin defines the intrusive mapping and this is why it has no effect. To make it have effect you should make it run after that plugin which is normally achieved either by putting it into ~/.vim/after/plugin/disable_mappings.vim (any name instead of disable_mappings works). Second is using VimEnter event:
augroup DisableMappings
autocmd! VimEnter * :inoremap <leader>ic <Nop>
augroup END
. To disable all mappings see :h 'paste' and :h 'pastetoggle', also :h :imapclear (though the latter will remove mappings instead of temporary disabling them).
Of course, you may also use iunmap just where I suggested to use inoremap … <Nop>. How did I came to forget this command?
I am trying to use snipMate and pydiction in vim together - however, both use the <tab> key to perform their genius-auto-completion-snippet-rendering-goodness-that-I-so-desire.
When pydiction is installed, snipMate stops working. I assume its because they can't both own the <tab> key. How can I get them to work together?
I wouldn't mind mapping one of them to a different key, but I am not really sure how to do this ... (maybe pydiction to the <ctrl-n> key so it mimics vim's autocomplete?).
Here is the relevant .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'
Well, this is from the Snipmate help file :)
*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>
Alternatively, you can edit ~/.vim/after/ftplugin/python_pydiction.vim
and change Tab to something else:
" 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>
I believe the way to change the trigger key may have changed since the answer by the_karel was given in 2009 but it is found in the same directory, namely 'after/plugin/snipMate.vim'. I found it in the help file too:
*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>'
i just tried to install snipmate. supertab is already working.
it doesnt work. when i press tab even after a snippet keyword the completion is triggered.
i tried to remap the key (to c-m) but even then completion is triggered instaed of snipmate. (before the remap c-m didnt do a thing).
i did this mapping in vimrc. the doc tells me to do it in after/plugin/snipmate.vim but this script isnt loaded (according to :scriptnames).
any idea?
snipmate plugin hasn't been updated for a long long time. thats why i started a friendly fork and i'm merging and coordinating further development of this (at least for me) essential plugin.
more here: https://github.com/garbas/vim-snipmate/blob/master/README.md
I had a very similar problem running an old version of snipmate from vim.org
The guy who writes it doesn't always update the vim.org page, but he does work on it fairly regularly on github.
Grab the latest copy from the download link here and see if that helps you.
What did you remap to <C-m>? <Tab> or your plugins function calls? Did you try SnipMate without SuperTab?
Both plugins have their main functions hardwired to <Tab> which makes their use a bit unpredictable. I've tried it but I didn't like it.
Instead, maybe you can keep SnipMate (if it works on its own) and remap omnicompletion shortcuts to something easier. I have these in my .vimrc:
" change the mapleader from \ to ,
let mapleader=","
" omnicompletion : words
inoremap <leader>, <C-x><C-o>
" omnicompletion : filenames
inoremap <leader>: <C-x><C-f>
" omnicompletion : lines
inoremap <leader>= <C-x><C-l>
Also autocomplpop.vim works very well.
Use SuperTab 2.0 version.
Do not use the latest version 2.1, it doesn't work with each other.
I managed to remap SnippMate's TAB key to a different key, in my case c-j, and it worked OK:
ino <silent> <c-j><c-r>=TriggerSnippet()<cr>
snor <silent> <c-j> <esc>i<right><c-r>=TriggerSnippet()<cr>
I did the change in after/plugin/snipmate.vim. In my case, :scriptnames listed the file as loaded.
add it to .vimrc, when you use Tab, then show the list of snippets.
au BufRead,BufNewFile *.py set expandtab
au BufRead,BufNewFile *.sh set expandtab
au BufRead,BufNewFile *.go set expandtab