How to write a key binding to replace specific character to another one?
For example I want to replace "[" and "]" to empty string "".
Unfortunately, to make a custom key binding you would need to write a plugin in Python to do the finding and replacing, as there are no built-in commands for doing so. However, what you want to do is easily accomplished using the Find -> Replace... dialog. Make sure the regular expressions button is selected, then put \[|\] in the Find What: box, and nothing in the Replace With: box (it's best to put your cursor in there and delete everything, just in case there are invisible characters such as spaces or tabs there). Hit Replace to replace characters one at a time, or Replace All to replace all of them in one go.
Related
I am using visual studio code Version 1.19.3, and I have 174 occurrences of a specific json object which I would like to replace with a different object. Is there an easy way to do this in visual studio code? find and replace doesn't work because of the tabs.
You can search and replace tabs in vscode but perhaps you have your tabs converted to spaces as your default indentation. If you try Ctrl-Shift-P and "Convert Indentation to Tabs" then search and replace for \t will work as you expect (with the Use Regular Expression button clicked).
Then you could back to indentation with spaces by Ctrl-Shift-P and "Convert Indentation to Spaces" if you wish when you are done.
In Sublime Text, I have installed Emmet so that I can do zen coding. Now, the problem is that when I'm typing, and get an autocomplete suggestion, as soon as I accept that autocomplete suggestion (either by entering tab, enter, or even pressing space bar), the suggested tag is expanded; this causes me not to be able to continue the zen coding.
To give you an example, say I want to insert a <select> with 6 <option> child elements. If I enter select>opt, then autocomplete suggests option, but as soon as I accept option, that expands to select<option></option>.
What I want is to accept option, but that it won't expand to <option></option>.
Is there anyway to accomplish this?
Actually, the answer is very simple. In your example, when you get the autocomplete suggestions for option, you will get 2 of them. One is the tag, the other is text. Use Ctrl+Space to go through all the suggestions, and select the text version of option and not the tag version.
In Sublime Text completions consists of a 2-tuple containing the showed string and the inserted characters/snippet. I don't think know whether it is possible to just insert the showed string. However if you search for any way, there is a way to establish: modify the source code of the html tag completion file.
Install PackageResourceViewer, then press ctrl+shift+p write PackageResourceViewer: Open Resource. Select HTML >>> html_completions.py.
If you save the file it will shadow (not overwrite) the original completions file. Hence just remove it to get the original behavior.
In this file:
in line 15 replace return (tag + '\tTag', tag + '>$0</' + tag) by return (tag + '\tTag', tag).
in line 245 replace completion_list = [(pair[0], '<' + pair[1]) for pair in completion_list] by completion_list = [(pair[0], pair[1]) for pair in completion_list]
Now it should insert the tag names instead of the whole tags.
The replace all option messes up the lower-case formation in Sublime Text 2. For example:
When I want to replace all the classes named "example1" to "hidethis"
I get "hideThis".
This is getting annoying, especially when I am going to do this procedure to URLs.
Is there any way to disable that option?
I need to combine multiple bookmarks files and reduce the size, but I don't know how to use regular expression.
I want to:
Delete every line that starts with <DD>
Delete the following HTML tags and the (unknown) text between the
qoutes: ICON_URI="...", ICON="...", and LAST_CHARSET="..."
Replace the text between > and </A>
Delete duplicate lines
Sort lines alphabetically
Tested in Notepad++, for other tools it may not work. Also for some strange cases it could not work in Notepad++ as well
1. ^<DD>.*?$ - replace with empty string
2.ICON_URI="[^"]*" - replace with empty string
3.(<a[^>]+>).+?</a> - replace with \1 </a>
4. This is hard to do with regex, you can use grouping and repetition, but I'm not advanced in that
5. Use excel or other similar tool and order there, much easier
I have a simple question.. I want to know what a style of searching is referred to as, like how may I refer to this style of searching when I am researching it.
In Sublime Text 3 when you hit Ctrl+ Shift + P the command pallette pops up, and you are able to type in a search query... Now, the special thing about this Sublime Text find box is that it will find search results based on the number of matched characters in sequence, rather than the strict name of the file. So, something like "packcon" will bring up "Package Control" and then something like "synrub" will bring up "Syntax: Ruby".
What is this style of string matching called?
Fuzzy Matching is the common name but more correctly referred to as Approximate String Matching.
More to read here : http://en.wikipedia.org/wiki/Approximate_string_matching