Autoclose and Autoindent Conflict in Vim - c

So I'm using a tool to automatically indent after brackets in C files:
filetype plugin indent on
However, I also want to automatically close brackets, parens, and other code delimiters when I type the first part of them. To achieve this, I have added this to my vimrc:
inoremap ( ()<Left>
inoremap { {}<Left>
Now, however, when I press enter in between the two brackets that are created, my code is no longer automatically indented. If the automatic completion of brackets feature is disabled, it works fine, but I have to manually close my brackets. I have also tried using DelimiterMate to the same effect. Is there any way around this?

This Vim Tips Wiki page contains a full discussion of the topic, starting with simple mappings like yours. Because there are many corner cases and areas where it should just work, I recommend a plugin though. The mentioned page has a comprehensive list of plugins. (I occasionally use AutoClose by Karl Guertin.)

Related

Vim is not seeing these curly braces as valid? It works in Xcode

What is the reason for vim not seeing the braces, when it works in Xcode?
You need to find out which syntax group causes the highlighting. :syn list shows all active groups, but it's easier when you install the SyntaxAttr.vim - Show syntax highlighting attributes of character under cursor plugin. When you have the name of the offending syntax group, you can investigate where it comes from; (the last lines of) :scriptnames may help.
Some syntax plugins can be configured, e.g. whether to display errors, or the particular dialect to use. As most syntaxes are not accompanied by documentation, it's best to directly check in the source code, usually at $VIMRUNTIME/syntax/{filetype}.vim. If you think the highlighting is wrong, contact the author; the email address usually can be found in the plugin's header.

How do I stop the following "External changes" message in Brackets

I am using Brackets with Angular. When I Alt-Tab and come back to Brackets it presents me with the seemingly helpful message.
I would like to turn this off. I don't think it is the live preview feature because I still seem to get the message when I close the browser session which auto reload my files.
Regards
I created an extension named “External changes dialog”.
You can find it in available extensions directly in Brackets Editor,
or here https://registry.brackets.io/ or here https://github.com/StarboyCZ/external-changes-dialog.
It automatically clicks on “Cancel” button in that “External changes” dialog.
After some digging around it appears that this is indeed an issue in Brackets. What I suspect is happening in my case is that I have unsaved changes in my js file when I focus away from Brackets. When I return to Brackets the FileSyncManager in Brackets picks up that I might have changed the js file but it cant work out that it happened in Brackets or outside, so it safely displays the message, albeit slightly misleadingly. The issue is highlighted in github issue ISSUE#10341
I have not yet tried it but will install the autosave extension through the extensions manager in brackets to see if this resolves the issue.

Sublime Text 2: Different language highlighting based on context? (a la Webstorm)

I was watching some videos on Egghead.io about AngularJS. The creator of the videos uses Webstorm (and, I believe, works for them). One feature I noticed is that he can set different syntax highlighting within different scopes or quotation marks. So, in code like the following (from an AngularJS directive)
return {
template: '<div>something</div>',
// ^^^ these guys ^^^
}
...he can get the inside of the quotation marks to highlight as HTML.
I use Sublime Text 2, and am fairly wedded to it. Is there an existing feature/plugin for Sublime that could handle a case like this? If not, is something like this technically possible using the Sublime Text 2 API?
I don't think it's built in, but it's certainly possible. I've been doing some work with graphviz and wanted to do something similar. Labels can be generated with html like syntax. Anyways, I played around with the .tmLanguage file and added a new pattern to match the context where html like entries were valid (I look for label = <). The patterns I used for the captures aren't that good, but it works for fine for me. This give me the following, which I think is similar to what you are looking for.
I don't know anything about AngularJS, so I can't help you with anything specific to that, but it is certainly possible. Note that in the image below, the last <table></table> are just to show that highlighting doesn't occur there.
Edit:
Forgot to include this in the original post, but here is my updated tmLangauage file. That first pattern is what I added(link). I used PlistJsonConverter to go from JSON to plist, then saved the file as .tmLanguage. Hope this helps.
#skuroda is right, I implemented #skuroda's code with an additional plugin to easily edit HTML within an AngularJS directive JS file. The result is HTML syntax highlighting within a directive JS file and additional functionality to remove string related delimiters while editing templates.... Sublime AngularJS HTML Template Plugin

Drupal 7 - Blocks: how do you specify it a list of pages except certain pages?

I created a block that I want to appear on these paths:
example.com/sample/1
example.com/sample/2 example.com/sample/3
example.com/sample/4 example.com/sample/6
However, I don't want it to appear on:
example.com/sample/5
Under the visibility setting for the block, I can select show block on "Only the listed pages"
and enter something like /sample/*
Howevever, how do I tell it not to show up in /sample/5 without typing out all other paths individually? Is there an "except" or "not" indicator somehow like how the * indicates all?
Use the context module to handle the placement of your block. It allows you to specify which paths the block should display on, as well as which it should not (by starting the path with a ~)
For example, in your context you can specify your paths like so:
sample/*
~sample/5
this tells drupal to display your block on all paths that match "sample/*" except for "sample/5"
There is only two ways of getting the fine tuning you need:
You type one by one all the URLs you want to include/exclude
You go for the perfectly customizable php code mode.
Maybe you should try Context module http://drupal.org/project/context and see if the more complex, configurable options it provide serve your purpose/solve your problem.
PD. My first answer completely missed the point, i was thinking on views... sorry!

HTMLPurifier: how to escape broken tags instead of removing?

I am using HTMLPurifier for cleaning the post input but I'd like it to escape (html encode) all broken tags or suspicious symbols instead of removing them completely. I have searched through it's docs and this site but without any luck. Still hope that I have missed something.
Opening tag is the most irritating. If someone tries to post a formula or comparison, writes "param1<param2" and does not put space in between, the purifier gets it as a wrong tag opening and completely discards everything on the right side.
I am using htmlspecialchars inside [code] tags, but I want to allow some html outside and cannot encode everything.. That is why I'm filtering it with HTMLPurifier.
Your advice would be appreciated.
Try %Core.AggressivelyFixLt or using %Core.LexerImpl set to DirectLex. I don't know offhand if this will work, it may not.
A partial solution is to set %Core.EscapeInvalidTags; but it's a pretty imperfect fix, and it may mangle some text.

Resources