How do I display brackets around assumptions in Isabelle/jEdit? - jedit

When goals are displayed by Isabelle in ProofGeneral, assumptions are rendered as having brackets around them as so:
In Isabelle/jEdit, however, this seems to have changed to meta-implication arrows:
While I understand the former is somewhat non-standard, I find it much easier to read. Is there a way to modify the behaviour of Isabelle/jEdit to print out goals in the old ProofGeneral style?

The format Isabelle renders its output is determined by Isabelle's "print modes". In ProofGeneral, the default print_mode includes the brackets mode, which renders brackets around assumptions, while the default jEdit print_mode includes no_brackets, which does the opposite.
The print mode can be changed either by setting Plugins > Plugin Options > Isabelle/General > Print Mode to brackets and restarting jEdit, by adding -m brackets to the isabelle jedit command line, or by including in your ~/.isabelle/etc/settings file:
ISABELLE_JEDIT_OPTIONS="-m brackets"
This will result in jEdit displaying brackets like ProofGeneral:

Go into Plugins -> Plugin Options -> Isabelle -> General
then type in brackets in the Print Mode field.
Click Apply.
Then close out of Isabelle and restart it.
You should have brackets around your hypotheses thereafter.

Related

Intellij is incorrectly formatting my `.yml` file, I cannot see any errors in my style settings. how can I fix it?

Intellij keeps formatting my spotbugs.yml file incorrectly, and so breaking the github action.
I cannot figure out why it's doing this:
It was working fine last week, I haven't made any changes to the formatting config, but now, every time I change focus from the file Intellij auto-formats like this, then saves it. How can I fix it?
The thing I don't get is what it's formatting to appears to be invalid yaml, right?
YAML has a syntax that makes it incompatible with indentation that is not 2 spaces. With 4 spaces, you have:
droggel:
jug:
- sequence item: with indentation
this line: isn't aligned to four spaces
nor are further indented lines:
if you indent relative four spaces
spam:
- same: problem
without: indenting the sequence item
This makes it hard for code formatters to get it right. Proper alignment would mean:
droggel:
jug:
- three spaces after the sequence item indicator.
that's horrible, nobody does that.
spam:
- alternatively this.
nobody does this either and it breaks
- - with nested sequences
I assume some bug in IntelliJ causes the formatter to be confused because of this. Generally it would be better to just use 2 space indentation which seems far more natural due to the problems described above. That should avoid confusing the formatter.

What vimrc settings control syntax highlighting of indented awk code in markdown?

I cannot get indented code to highlight in GAWK in vim markdown model
Context: I doing some literature programming in gawk. Comments are markdown syntax and code is GAWK, indented by a tab spaces.
Problem: I followed the doc at https://github.com/plasticboy/vim-markdown#options. The markdown highlights as it should but the indented code remains white and bland:
What I did: The first line of my source code is
# vim: nospell filetype=markdown :
My .vimrc contains the line
let g:vim_markdown_fenced_languages = ['awk=awk']
Which, according to the doc at SHOULD be enough to make that syntax highlight happen
Help?
That information is not enough to get vim to understand how to highlight your block of code. "Fenced" refers to code that is bounded by triple backticks as follows:
```awk
this is some awk code that would be highlighted
```
This, when combined with the let g:vim_markdown_fenced_languages = ['awk', 'sh', 'make'] etc lists, lets vim know exactly which highlighting syntax to use in a particular block.
You should also note that you don't need that particular vim plugin to get this to work; this is native vim functionality.
Edit: If you really want indentation, you can just indent the code block with the fencing:
```awk
some awk code surrounded by indented fencing would be highlighted
```
If you were really hard-pressed to avoid the fencing entirely, the only way I know of would be to go into the actual vim syntax files:
cd $(vim -Nesc '!echo $VIMRUNTIME' -c qa)
vim syntax/markdown.vim
and try to figure out a way to force a default of awk highlighting on indented code, but I wouldn't recommend it.

How to stop intellij-idea from removing white spaces at end of text lines in my file?

I am using 2018.1.5 community edition of intellij editor to edit a plain text file.
I am not using a project. I start it, on Linux as follows:
idea.sh my_file.mpl
where my_file.mpl is plain text file.
And this works well, except for one big problem.
I need to have an empty space at end of some lines. i.e. after the line character on some line in the file, I insert some white. I see the space is there, by doing View->Active editor->Show White spaces. I can see the small tiny dotts, showing there are white space character at end of line.
But as soon as I save the file, these white spaces are removed from end of line.
This causes a problem for me (for other reason, when this file is read by another app).
Is there an option to tell it intellij NOT to remove white spaces after the last character on the line?
Go to File->Settings->Editor->General and under Other, set the drop down next to Strip trailing spaces on Save to whatever you wish. For future reference, you can press Ctrl-Shift-A and type a search term to find any menu command or setting very quickly. In this case, "trailing spaces" or "strip trailing spaces" works really well.
Newer PyCharm (2020 and beyond) have slightly different answer than Code-Apprentice's.
Go to File->Settings->Editor->General, and then scroll down to Save Files section. The drop down Strip trailing spaces on Save for: is there. You can select None if you don't want any stripping in no circumstances.
Here is an image showing the setting:
If changing the settings in "Editor > General > Save Files" doesn't work, the below might be useful...
There is a discussion here about a possible bug (or at least confusing scenario) where you have set "Strip trailing spaces on Save for"=None and you still get stripping of trailing spaces, as I did. The comment by Oksana Chumak worked for me - namely, I unticked "Enable EditorConfig Support" in Settings > Editor > Code Style. This seems to allow a config file ".editorconfig" to be used which overrides some settings - also see Andriy Bazanov's answer, quoted below...
NOTE: If you have .editorconfig file in your project, such option can
also be controlled via that file. This file can provide more granular
control over what files are affected by those settings.
Settings from .editorconfig file will OVERWRITE IDE settings (the
whole nature of such files), so if you have such files in your project
and such instruction there, you will have to either disable the
EditorConfig for this project or disable plugin completely (if you do
not care about it at all).
I had my .editorconfig and I have used trim_trailing_whitespace=true. So that was the issue. This is what I did to fix the issue.
[*.md]
trim_trailing_whitespace=false
So here's what worked for me. I wanted intellij to keep trimming whitespaces but to keep the whitespace on blank lines.
First like #Michael-Veksler suggested, I changed intellij's default removal on save.
But it kept trimming the trailing whitespace, that was because in my .editorconfig file I had a trim_trailing_whitespace config turned on. So now I've set trim_trailing_whitespace = false.
Lastly, because I still wanted the editor to trim the trailing whitespaces, just not on blank lines I've added to my .eslintrc.js file the following setting:
module.exports = {
...
rules: {
...
'no-trailing-spaces': [2, { "skipBlankLines": true }]
}
}
And now lint-fix on save just takes care of it

Intellij: how to convert indents for all files

I know how to convert indent for a single file. I go to edit -> convert indent -> space/tab.
But I want to do this for all files under a directory.
I try click on a directory and then go to edit -> convert indent, but the options are grayed out.
You can use the shortcut Ctrl+ALT+L (Windows/Linux) or ⌥⌘+L (MAC OS X) and select the Rearrange entries option to reformat the code in the current file or reformat a module or directory.
You can also Right-click a module, file, or directory from the context menu and select Reformat Code and also select the Rearrange entries option.
This will convert the indents for all files/directories selected:
This works on most of the Jetbrains IDES (iDea, PyCharm, WebStorm, RubyMine, and so on.)
It seems there is no such dedicated option in IntelliJ, but you could just work around it using a "low-level" Replace All action.
Open the Edit → Find → Replace in Files... dialog
In case you want to convert spaces to tabs, you should
Enter in the Find field (i.e. four spaces (or whatever number of spaces the project is currently indented with))
Press the Regex search modifier (Alt + X)
Enter \t in the Replace field
NB: In case you have valid strings with 4+ spaces in them, they will get replaced too. In most use cases, however, this is not happening.
In case you want to convert tabs to spaces, you should do the same as above, but swap the Find and Replace field contents
NB: Again, if you have valid strings with tabs in them, they will get replaced too. I haven't had this use case, because I've only needed to convert in the opposite direction.
You will probably also want to set a File mask in order not to replace spaces in code-irrelevant files

How to turn off JSLint indentation warnings?

I find that JSLint produces lots of warnings of the form:
Expected 'foo' to have an indentation at X instead at Y.
The JSLint options documentation describes an indent option that recognizes a numerical value representing the amount of space for each level of indentation. This option allows me to say things like use 2 spaces per level of indentation. I just write something like this at the top of my JavaScript file:
/*jslint indent: 2 */
OK, great. Now JSLint knows how much to indent for each level of indentation, but JSLint seems to be hardcoded to decide what level of indentation each line should have.
Suppose I want to indent my code differently than the way JSLint prescribes. Can I do this with some JSLint option? If not, can I at least turn off the indentation warnings? I tried:
/*jslint indent: false */
but that did not cause indentation warnings to be elided; it caused a JSLint error.
What a difference that morning coffee makes:
/*jslint white: true */
If you don't want to disable JSLint, you can remove the double indentations (e.g. when defining multiple var's in a javascript file) by adjusting this setting:
Options > Editor > Formatting > Language: Javascript > Continuation Indentation - set to 4.
Now you can use ctrl shift f to format code, and JSLint doesn't freak out...