Is it possible to select text wrapped in quotation marks or other signs in PhpStorm (2016)?
I.e.
"Here is some code"
When I use shortcut I want to select all what is in quotation marks.
This depends on context -- what language it is. It works fine for PHP & JavaScript but does not do anything special in HTML (as " are treated as part of the actual text).
Place caret inside such string
Use Edit | Extend Selection (Ctrl + W on Windows/Linux using Default keymap; on Mac it most likely will be Alt + Arrow Up or similar)
You will need to use that shortcut few times in a row (at least 2 times if there are more than one word in a string) until it selects whole string content as this shortcut works in incremental mode -- first current word, then sentence or other outer code construction and so on.
Related
How can I find and delete all occurrences of an html tag using Visual Studio Code.
As an example, I am trying to parse a page that is riddled with SVG tags. I don't want the tags, nor the contents of those tags in the file.
If you are opening the "Find and Replace" popup in VS-Code (Windows: CTRL + H, Mac ⌥ + ⌘ + F), then inside the "Search" input field there are three icons on the right side.
Press the right one .* in order to activate regular expressions.
After it's activated you can search for SVG tags like so:
<\s*svg[^>]*>(.*?)<\s*\/\s*svg>
Leave the replace input empty and press enter in order to replace it with "nothing" and therefore removing the HTML-Tag and it's inner text.
But be careful, this will really delete everything between those matched tags.
So for example if you are looking for <a> tags, even this String will be completely removed: Some <span>special</span> formatted link
You can find an example with it here: https://regex101.com/r/ewEttF/1
You can use Regex Search and Emmet.
Use regex search to find the start tags: <svg[^>]*>
While the focus is still in the find dialog: Alt+Enter
this will select all matching cases and put focus on the editor
Move cursors after the opening tag: RightArrow
Use Emmet: Balance outward to select content of tag
Use Emmet: Balance outward to select content and tag start and tag end
Delete selected stuff with: Delete
End Multi Cursor with: Esc
I am using Sublime Text 2 and when I double click on word connected with underline like:
this_is_it
it will auto select whole phrase, but when is words connected with break symbol like this:
this-is-it
it will select only one of words, how can I set Sublime Text to select whole phrase?
Modify "word_separators" in user's Preferences.sublime-settings, the default is:
"word_separators": "./\\()\"'-:,.;<>~!##$%^&*|+=[]{}`~?"
Since - is minus in most programming language, it is included as default separator. You better modify syntax specific files (e.g. Plain text.sublime-settings) to suit your need.
http://compscientist.com/post/28272180856/word-separators
I'm new to VS. I've looked around, and can't find anything about this:
When typing an html tag, typing the start of a valid attribute name such as href correctly hints it, but does not add the ="" after the attribute, and I always have to type it myself.
Coming from other editors where it add the equal and quotes and places the editing caret between the quotes, this is annoying.
Am I missing the proper way to do this? Or is there anything I need to do, customization-wise?
I think it has something to do with the way you should use VS, in general you don't have to press enter or tab to complete your keyword(like some of the other editors), you can for example do this:
begin writing href and when you find that it is the one hilighed in the autocompletion window press =
similarly for Tags, begin wirting with < and when you find what you search press > and the requiered tags would be created.
I hope this helps you.
Make sure the 'Insert attribute value quotes when typing' option is selected in Tools -> Options -> Text Editor -> HTML -> Formatting.
Once selected, your attribute name and quotes will automatically be inserted whenever you type the start of an attribute followed by the = key. Your cursor will be positioned within the quotes so that you can type the value.
Example
Type <a hr and press =.
The attribute name will be completed for you, double quotes will be appended, and your cursor will be positioned within them so that you can start typing the value immediately.
Every time I type an opening html tag (like <div>) then press the Enter key, the cursor automatically inserts an indention on the next line. However I don't want it to be indented since I still have to write the closing tag (actually I press the enter twice and write the closing tag in the third line so I can have an empty line in between). Now I have to press the back button to align the cursor with the opening tag.
I am aware of Sublime Text 2's autocomplete like when you type '<' and Ctrl + Space, a list
of available elements would appear. And when you select one item from the list, the editor would
provide you of both the opening and the closing tag. However, I'm not used to that kind of typing.
So is there a way to turn off this annoying feature of Sublime Text 2
You can disable auto-indentation by setting auto_indent to false.
In order to do this for the HTML syntax only, go to Preferences/Settings – More/Syntax Specific – User and insert the following contents:
{
"auto_indent": false
}
This will make the cursor to jump back at column 0 after hitting return.
To make it stay at the column of the opening tag, re-enable auto_indent and tweak the indentation settings in Packages/HTML/Miscellaneous.tmPreferences. If you aren’t into regular expressions, try to get rid of this file completely.
You can also just type the closing </div> tag and sublime text will automatically un-indent it for you.
I am making a small online database that is accessible through the form of checkboxes for download. I was wondering if there was some way to list all of the filenames available for download in Sublime Text 2 and insert the same code around each filename?
Everything is functional, it would just save me a lot of repetitive copy and pasting if there is a faster way to do this.
Use SublimeText Find & Replace. Click the Regex button (it looks like a * to the left of the search box)
In the Find box, insert: (^.*$)
In the replace box: [yourcode]$1[yourcode]
Where [yourcode] is what you want to insert into the box.
So, if you want to make them all <li> then your replace box would be:
<li>$1</li>
Remember to use escape \ characters where they are needed, in case you need to insert restricted characters.
^ - beginning of a new line.
. - wildcard
* - any number of the previous character in the sequence (in this case a wildcard, so any text)
$ - the end of a line
() - denotes a block, it's how the $1 knows what text to put in it's place.
Sublime Text Search and Replace
Use search/replace on a text editor with regular expressions.
^ and $ represent the beginning and end of a line - thus allowing you to easily surround each line with the appropriate text.
Sometimes you can copy the newline character (as in copy the end of one line to the beginning of the next line), and replace that with whatever text you need.
You could always use the regular expression search / replace feature in Notepad++.