As the title states, how do I check if a plugin is loaded?
When I hit tab (for SuperTab) all I get is the ordinary character "tab" inserted in my file and when I hit ctrl-space I just get thrown out of insert-mode (same behavior as hitting ESC)
The :scriptnames command lists all scripts that have been sourced; check for the plugin name in its output. If it's missing, it is either due to a wrong installation or because 'runtimepath' is incorrect.
Alternatively, if you know the mapping a plugin should define
:verbose imap <Tab>
will show the mapping and from which script is was set.
Programmatically, it is best to check for the canonical include guard if exists('g:loaded_pluginname') or for a defined command via if exists(':PluginCommand').
Related
I am using GVim 7.4 and I would like to do some really simple mapping to use CtrlP fuzzy matching of tags when a key combination is used.
I tried 2 approaches and they all seem to fail when vim calls Control + [x] combination. While I do understand that there are restrictions when it comes to mapping Ctrl+[x] codes, I haven't found any information on why ctrl mapping wouldn't work.
noremap \t :CtrlPTag<CR><C-\>w
This one enters CtrlP tag mode but then it doesn't enter word from under the cursor.
noremap \t <C-p><C-\>w
Here we don't even get to CtrlP window (I even omit going into tag mode here for simplicity).
As far as I understand (I'm no CtrlP user), the plugin is triggered via some command / key combination, and then presents interactive selection and filtering. It even has different "source" modes.
Now, this is a pretty heavy integration into Vim, probably using scratch buffers and its own input loop. That's why you cannot simply append keys to the mapping and get them interpreted by the plugin "as typed".
Typically, these plugins offer mode selection and so on via (optional) command arguments. Check the plugin's help, and if you cannot get the plugin into the state you need, best contact the plugin's author and ask for such enhancement.
One of vim plugin added this mapping, which starts auto completion when I press tab.
s <Tab> * <Esc>i<Right><C-R>=TriggerSnippet()<CR>
How do I restore the tab mapping to insert spaces instead of autocomplete. I tried various noremap but it did not take effect or simply did nothing. unmap do not help either.
Vim version 7.2
CentOS 6.4
Use :unmap <Tab>, considering the mode(s). You've shown the :smap (presumably of the snipMate plugin), but the behavior you've described is the :imap.
Now, that unmap needs to be done after the plugin has defined the mapping, so you can't do that in your ~/.vimrc. Usually you put the commands into ~/.vim/after/plugin/<pluginname>.vim, but snipMate already uses such a file to define the mapping! Therefore, choose a name in the after directory that alphabetically comes after snipMate, e.g. ~/.vim/after/plugin/zzzSnipMate.vim.
As you probably want to define different mapping keys for it (otherwise you could just uninstall the plugin, right?), you can do that there, too.
my setting for command mode completion is:
set wildmenu
set wildmode=longest,list,full
currently when i type
:set fdm=
in command mode, then press tab, manual appended, if i Press tab again , character ^I appended, what i want is manual changed to another foldmethod options such as syntax, indent and so on.
does anyone know is that possible or if there is any plugin could do that ?
thanks !
As you say, when you press <Tab> after :set fdm=, you get manualinserted.
That could seem the usual autocomplete behaviour we are used to in many places, manual being just the first of all possible values. So, you expect that repeating <Tab> will give you more possibilites.
But that's not indeed the case. What you get when pressing <Tab> in such a situation is not the first autocompletion alternative, but the current option value. So, you're getting manual because that's in fact the default value for that option. Successive <Tab>s get inserted literally, as this behaviour is only fired right after =.
From Vim's help:
The old value of an option can be obtained by hitting 'wildchar' just after
the '='. For example, typing 'wildchar' after ":set dir=" will insert the
current value of 'dir'. This overrules file name completion for the options
that take a file name.
So, what you described is expected behaviour. See :help cmdline-completion for the whole story.
I don't know about any plugin capable of changing this to what you want.
I've come to a vim completion behavior that is very annoying for me and I cannot figure out how to configure vim to behave differently.Maybe it is not possible at all.
Suppose I'm editing file with following content:
MyCompany2
MyCompanies
MyCompany3
Now I want to add another entry (say MyCompanyABC) so I type My and hit Ctrl-N, so now I have
MyCompany2
Now I hit backspace, then A so I'm at
MyCompanyA
No I decide to try completion again so I hit Ctrl-N and vim takes me back to
My
So is there a way to make it so that the last step keeps what I already have?
UPDATE:
I gave the completion sequence wrong. The problem I describe appears if one first hits Ctrl-P. Then in the above scenario you get and the rest as above.
MyCompany3
This doesn't behave like this on my machine (Ubuntu 10.10, vim 7.2.330 here). If I do this:
Open vim by typing vi
Type the text you gave above
MyCompany2
MyCompanies
MyCompany3
Open a new line below
Type "My"
Press Ctrl-N
Choose MyCompany2
Backspace (get "MyCompany" after that)
Type A (get "MyCompanyA")
Ctrl-N does nothing - as expected, status bar says: -- Keyword completition (^N^P) Pattern not found.
Is it possible you have some plugin that is changing the default behavior? You can also try vi -u NONE to check whether you have something in your .vimrc that is changing this behavior. Best if you have some other system to check it out.
Are you sure that you want to use Ctrl-N directly without hitting Ctrl-X beforehand? Ctrl-N will also search in all opened buffers.
Maybe hitting CTRL-X CTRL-N or CTRL-X CTRL-P will result in a more stable completion.
I have added the following lines to the vimrc file so that i could use s-tab for indenting
map <esc>[Z <s-tab>
ounmap <esc>[Z
After i have added this , i get the following error. I use SnippetsEmu plugin
Error detected while processing function <SNR>15_SnipMapKeys:
line 10:
E227: mapping already exists for ^I
How do i solve this conflict.Why does this happen
A helpful way you can detect whether your version of vim is capable of differentiating between Tab and Shift-Tab is to:
Go into insert mode, press Ctrl-v* then Shift-Tab. I get <S-Tab> when I do that (gvim 7.2 on Windows XP).
If you don't get that then I don't think you can map Shift-Tab separately from Tab with your current setup.
*Ctrl-v will take the next key combination you press and output the key combination that vim actually sees.
EDIT: If you're sourced mswin.vim then you'll want to use Ctrl-q instead.