What is causing this SnipMate message? - vim

I have just started using the Vim plugin SnipMate. When I create an HTML file (with filetype .html), go into insert mode, and type "html" and a tab, I see this message at the bottom of my screen:
1* 1. Users/me/.vim/bundle/vim-snippets javascript-jquery default
2: 2. Users/me/.vim/bundle/vim-snippets html default
__InputList__
select snippet by name (filter: ; press <F1> for help) [glob]
I'm not sure why this is happening. How can I configure SnipMate so that it knows that when I type "html" I always want the second option?
Thanks.

This message was caused by an "html" snippet in the file vim-snippets/snippets/javascript/javascript-jquery.snippets. Once I commented that snippet out, the message stopped occurring.

Yep.
I had a similar error on the bottom of my vim screen:
1 1* 1. html bundle/vim-snippets html.snippets
2 2: 2. javascript bundle/vim-snippets javascript-jquery.snippets
There is already a snippet called html in the
~/.vim/bundle/vim-snippets/snippets/javascript-jquery.snippets file.
You should comment out these two lines with the # sign, like this:
'# snippet html
̈́'# ${1:obj}.html('${2:Some text and bold!}')
Someone should fix this problem.
Installing Vim plugins should be easy, not complicated! :-(

Related

How could I let vim ale plugin use pylint configuration file

in my vimrc file, I add this line:
let g:ale_python_pylint_options = '--rcfile ~/.pylintrc'
And in my ~/.pylintrc file, I have this line:
msg-template={msg_id}: {msg}
However, with my vim ale plugin, the error message showed does not include the mssage id.
The message is like this:
[Pylint] Unused variable 'j' [W]
But I hope I could get this:
[Pylint] [W0612] Unused variable 'j' [W]
How could I make it work?
You could do that using the g:ale_echo_msg_format option. For example, setting this option in the vimrc as shown below, would give you the desired result:
let g:ale_echo_msg_format='[%linter%] [%severity%] %code% %s'
Where code is the error code. However, this code outputted is a human-readable code instead of the actual code. For the above an example output is as follows:
[pylint] [Warning] missing-docstring Missing module docstring
Note missing-docstring instead of the code F0001. On reading through the issues, the author of ale is deliberately doing this, So, if you need the actual error code, you're out of luck. Open an issue in the project and hope the author changes this behavior.

Print lint rule out with ALE in Vim

At the moment I have the following in my vimrc to show the linter error message at the bottom of my screen:
let g:ale_echo_msg_format = '%linter% says: %s'
How do I customise this so that I get the name of the lint rule (rather than just the description).
What you're looking for is %code%. See :help g:ale_echo_msg_format. You can put just about any characters you want before or after code, and that part of the message will be removed if there's no error code. The default value for the option is '%code: %%s'.

Sublime Text snippet priority

I made my own snippet with a Tab trigger that inserts a big comment block into a CSS file when triggered with the keyword comment. After using it for a while and it working fine, I've installed the Emmet plugin, which inserts some of its own code when triggered by Tab on any arbitrary word or character combination.
So what happens now is that the Emmet plugin is overriding my snippet, and instead of getting my big comment block when typing "comment" and pressing Tab, I get comment: ; because Emmet is assuming that I want to write a CSS property named comment.
(which doesn't even make sense because I'm not in a {} block, but that's not the point)
My question is, how can I get my own snippet to execute with a "higher priority", so that if there is a snippet with the current Tab trigger, the Emmet plugin will be ignored?
Try changing away from tab completion:
https://github.com/sergeche/emmet-sublime/issues/9
The simple workaround is to change the trigger for your snippet to mycomment or commment or some other memorable but unique trigger to remove the whole issue of conflicts.

Vim ctags behaves strangely

I'm starting out Lua development, so I ran ctags on a simple starter project and tried jumping around the source code with Ctrl + ]. Upon trying this, I got E426: tag not found: cache_objects where cache_objects was a function in another file. I checked the tags file and the correct entry was there for cached_objects. I also checked my tags path and it was correct.
I then tried explicitly executing the tags command: :ta cache_objects. This returned the same error. Now things are about to get weird. I executed: :ta /cache_objects, and it worked! It brought me to the function defined as:
function cache_objects (basedir)
...
I triple checked the spelling to make sure it was right. How could this be happening?
This is a bug in ctags. http://sourceforge.net/p/ctags/bugs/347/
If you noticed in your tags file that fields are tab delimited. However when ctags generated the cache_objects tag it included the space after it. vim only looks for complete words when using <C-]> which is why it didn't find the tag but did find it when you used a regex search. If you change the line to
function cache_objects(basedir)
it works.

How can I get vim's closetag plugin to work for all html tags?

I am using the closetag.vim plugin, but it doesn't seem to work for all tags. In the plugin code there is the ignored tags var that contains some one that I noticed were not closing ex dd dl, but there are many others that aren't in the list that are not working (p, ul, li).
Nothing seemed to happen after updating the list of ignored tags.
To get this plugin to work you just enter the tag text and click tab, right? ie div
Am I missing something?
How did you install the plugin?
I had troubles with closetag.vim when I installed it in ~/.vim/plugins. Then I moved it into ~/.vim/scripts instead, and added the following to my .vimrc:
:let g:closetag_html_style=1
:source ~/.vim/scripts/closetag.vim
and now it works fine for me. I find that it closes all tags (including those included in the 'ignore' list), but not those that are self-closing (e.g. <img/>).
In the version of the script that I am using (0.9.1), it defines <C-_> as the trigger for completing tags. If you have mapped the command to <tab>, then that should work too.
I also cannot get this plugin to work, however in my case what it does it throw out a number of error messages before finally working. For instance if I try to close an H1 tag I will get the error Error Detected while processing function GetCloseTag and the error is an undefined variable b:UnaryTagsStack.
Seems like it would be a useful plugin but it just won't cooperate.
I had the same issue and nelstrom's answer above didn't solve it for me. What worked for me was adding the following lines to my .vimrc:
if !exists("b:unaryTagsStack") || exists("b:closetag_html_style")
if &filetype == "html" || exists("b:closetag_html_style")
let b:unaryTagsStacktack="area base br dd dt hr img input link meta param"
else " for xml and xsl
let b:unaryTagsStack=""
endif
endif
if !exists("b:unaryTagsStack")
let b:unaryTagsStack=""
endif
I don't know why adding just let b:unaryTagsStack="" didn't do the trick, but the combination above seems to fix it in all file types for me.

Resources