Tool to Surround or Wrap Highlighted Text - ide

StackOverflow's WYSIWYG has the ability to quickly surround highlighted text through keyboard shortcuts.
For example, when I push Ctrl+B on some highlighted text, it would bold the text or surround it with two stars.
I am looking for a tool that will give me this function but with "custom-input". That is... instead of bolding the word, I could surround it with a <div> tag or... in my case, I need to localize my Wordpress Plug-in, thus __("Surrounded Text").
I am currently using Notepad++ but I can't find any way to create this function.
Can this be done in Notepad++?
If it can not, I would like some suggestion for a IDE that can.
Thank you.

If you've never used an "optimized" text editor, Vim would be a sea change, but it does have a great surround.vim plugin.
Emphasize hello: ysiw<em>
<em>Hello</em> world!
Finally, let's try out visual mode.
Press a capital V (for linewise visual
mode) followed by S<p
class="important">.
<p class="important">
<em>Hello</em>> world!
</p>
Alternatively, you could probably get a fair bit of the functionality for which you are looking with an AutoHotkey script, but at best I think you'd have to do the highlight-first thing like the StackOverflow WYSIWYG editor.
Still, this would probably allow you to keep using Notepad++.

You can do this in VIM using the surround plugin

Related

Fold HTML tag attributes feature similar to Sublime Text

One feature I've found really useful in Sublime Text is the ability to fold HTML tag attributes. Is there a way to do this with VSCode that I'm missing?
I don't think there's a built-in way to do this. Also, it seems the extension API currently doesn't have a way of hiding characters, see this open feature request (except for a hack mentioned by the second comment).
Extensions also can't customize the built-in folding yet, see #3422.
To fold individual attributes just move your mouse pointer to the left of the editor, in the empty space on the right of the line numbers. Small - icons will appear. Click on the ones you want to fold items.
Keyboard shortcut is CTRL+SHIFT+].
You can get the full list of key bindings there: https://code.visualstudio.com/docs/getstarted/keybindings

How to force indentation in Intellij IDEA?

I'm using the Community Edition of Intellij IDEA. I'm a little annoyed at how it restricts the way I use indentation in some areas. For example, it's hard to format the multi-line String below using tab key:
def text = """
This is a multi-line comment.
I want this indented.
And this too.
"""
I've been looking at the code style options but I can't figure out which one to configure.
I don't know of any configuration for multi line strings. I guess formatting the contents of Strings is in itself a bit dangerous. I expect auto format to change the format of my code, not the semantics of my code.
The following might ease your pain a bit if you find yourself doing custom formatting not supported by auto format:
Turn on Markers for turning on and off formatters. This allows you to specify comments that will define areas of your code that auto format won't touch. Look for the checkboxes in Editor -> Code Style under "Formatter Control"
If you mark multiple lines and press [TAB], IntelliJ will indent all of lines.
You can write your string without indentations and then use multi line edit (multi cursor) to indent all the lines you want at the same time.
More on that feature in the link below (and also a short video demo):
http://blog.jetbrains.com/idea/2014/03/intellij-idea-13-1-rc-introduces-sublime-text-style-multiple-selections/

Finding the regular expressions search in jEdit

I am not a programmer, I am a book editor, and need to automate a task. I need to be able to load my entire book into a program to add <p> before every paragraph, and </p> after each one. Currently I have to go through and entire book on notepad and manually do it.
Guido Henkel in his book "Zen of eBook Programming" describes it like this:
Copy your whole book's text into the text editor.
Run a regular expressions search and replace.
Where do I go to do a "regular expression search and replace" in the jEdit program? Does jEdit need to be set up or have plug-ins installed?
The top of the search box says "find" I have the code I am supposed to use; it's just that when I opened the program, I experienced the shock of being in a strange country. Anyone help me out?
I assume you are using jEdit editor http://www.jedit.org . No plugins are needed to just replacing text by regular expressions.
Open the Search And Replace dialog via click Search in the menu bar and select Find...
Turn on Regular Expressions, put .+ to the Search for box, put <p>$0</p> to the Replace with box then press Replace All

Is there a text editor or ide that will do this things?

Is there a text editor that will let me shade certain code blocks with specific colors so I can easily find them later? Bookmarks are great, but I also wanted to shade with the same color all code blocks which are somehow related to each other.
and
When my current text editors autocreate curly braces or parentheses for me and I type what I want in between them, are there any that let me either jump to the end of the line to put a semicolon there, or "return" to type the next line, or do I always have to use the arrow key to get out of the curly braces? Perhaps there is a shortcut I'm missing?
I think about every code editor, including Notepad++, has bookmarks. If you're looking for a more complete IDE, it probably depends on the language you're using. For .NET languages that is Visual Studio, but you probably would have known that. For PHP, Javascript and HTML/CSS, you can use Netbeans for PHP. Netbeans is also available for Java. It is a rich editor, and I think one of the best free general purpose IDE's available.
Marking pieces of code in colors is unknown to me. I've never seen an editor that supports this. You would also need a project in which to store the start and end points of these blocks, unless you would save them as comments or so in the file itself.
Visual Studio knows regions which you can define by a start tag and an end tag. You can collapse and unfold an entire region at once, making it quite easy to navigate through larger files.
But these regions are actually part of the code file, so you cannot use this for any file, because those region markers will probably make the file invalid.
I'm still wondering why any other shortcut key would be easier or more convenient than 'arrow down'..

Is there an IDE or plugin which allows separation of code from layout?

I'm looking for something like CSS for code. Does it exist either in an IDE, or as a plugin?
The compiler often doesn't care how many more spaces or tabs or newlines you have between tokens in your code, but people do care.
I want to specify in my "style sheet" that braces always live on a seperate line, commas are always followed by spaces, and spaces always surround operators.
Somebody else could then take my code and in their style sheet, specify that no unnecessary spaces should be visible, braces should always be on the same line as their predecessor, and functions should always be separated by 3 line breaks. But the code itself should not actually change.
Is there such a tool?
I don't think such a thing exists, the best solution is to have a custom style for local coding (most IDE's allow this) and then use a tool to reformat your source code (like Jalopy for Java) when you commit it centrally.
That way you have something that's common centrally, but can still style how you want locally.
I don't know of any tool that can arbitrarily apply a style to code without actually modifying the text itself. Since you need to edit the code, that seems impractical.
This is called code formatting and if you google "code formatter" and your language of choice you should get a list of available options.
Try some eclipse based IDE (Aptana) or eclipse itsefl and and from there you can configure how the formatting works :)