Notepad++ special string character highlighting - printf

In notepad++ if I have the code
printf("Hello, World\n");
The whole string '"Hello, World\n"' is one color but in editors like vim '\n' is a different color signifying it's a special character. Is there to get this behavior in notepad++? It's an especially nice feature of vim to highlight some of the stranger printf syntax like '% 5.3s' or '%%'

If you don't mind editing some xml, I'm sure you could make the appropriate settings in stylers.xml where all syntax highlighting settings for Notepad++ are saved. It is usually located in %APPDATA%\Notepad++\
Here is the wiki:
http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Editing_Configuration_Files
Otherwise, you could try to find a theme online and import it with settings->import->import theme

Related

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

Text editors and IDE cannot write properly ɑ̃ ɛ̃ ɑ̃ ɔ̃ œ̃ character

I tried many IDE: Sublime Text, PhpStorm, Notepad++
When I paste the ɑ̃ character I got a^ (2 chars)
Same happens with other chars such as ɛ̃ ɑ̃ ɔ̃ œ̃
I tried to change UTF-8, UTF18, ISO etc... All IDE did change the ɑ̃ into 2 chars !
Any idea ?
In my case it works fine:
(Indeed, it's treated as two characters, like you can delete only the first/second "part" by backspace, but it's displaying correctly)
I think it's the problem of font. You may try my fallback font Inziu Iosevka which may probably support those characters better.
Other characters test:
Fine.
My complete font setting (IntelliJ IDEA Ultimate):
Hope it help.

Format TSQL onto one line

Our company uses an old app which reads TSQL from a .INI file. Due to how the app process the INI file the TSQL has to be all on one line. I use Poor Mans TSQL Formatter to get everything nice and tidy for things like SPs, but am wondering if there's something out there to do the reverse - take nicely formatted TSQL and shove it all onto one line (removing carriage returns , line breaks etc).
I'm working in SSMS but also use Notepad++, and will happily use some other editor if it has the functionality.
Using Notepad++ (Without any plugin)
After lot's of googling I found that there are no plugins like TextFX and PoorMansTSqlFormatter are available in x64 bit version of notepad++ even not needed.
Notepad++ --> Write Query --> Edit --> Blank Options --> Remove Unnecessary Blank and EOL.
That's it.
Using Notepad++
Select the statement that is over multiple lines then on the menu: TextFX>TextFX Edit>Unwrap Text
And for even greater ease you can assign it to a keyboard shortcut using the shortcut mapper (Settings>Shortcut Mapper)
You can use the minify comment to remove all the unnecessary space in the Poor Mans TSQL Formatter
[minify]
[/minify]
I like Martin's answer and that is probably the way to go. But I'll point out that you can just use string manipulation to turn carriage returns and line feeds into spaces. This is particularly easy in the later versions of SSMS that enable limted use of regex in the find/replace dialog.
In SQL Server 2012:
Highlight the selected text and use 'Find and Replace' (ctrl + h)
Check: use Regular Expressions
Find: \n
Replace with: LEAVE BLANK