Any keyboard shortcut in Sublime Text 2 to select the string in quotation marks:
<input type="text" value="i want to select these texts ..." />
alert("i want to select these texts ...");
Under the Selection menu is an option Expand Selection to Scope, which should be what you're looking for, since strings enclosed in quotes are defined as a separate scope in most languages, including the default HTML that comes with ST2.
I tested several languages, including HTML, JavaScript, JSON, Ruby, Perl, and Python, and all except Python selected the quotes along with the text. If you want to change that behavior you'll have to dive into Packages/Python/Python.tmLanguage, figure out the regexes involved, and transfer them to the .tmLanguage file(s) of your language(s) of choice.
Try the BracketHighlighter plugin. Use the command palette command Select Bracket Content. I believe that is what you are looking for. If it is, you can create a keymap with the following command (got this from logging the command, but you can also see it by looking through the sublime-commands file)
"keys": ["<you choose keys>"],
"command": "bh_key",
"args": {"lines": true, "plugin": {"command": "bh_modules.bracketselect", "type": ["__all__"]}}
Related
I am writing markdown files in Obsidian.md and trying to convert them via Pandoc and LaTeX to PDF. Text itself works fine doing this, howerver, in Obsidian I use ==equal signs== to highlight something, however this doesn't work in LaTeX.
So I'd like to create a filter that either removes the equal signs entirely, or replaces it with something LaTeX can render, e.g. \hl{something}. I think this would be the same process.
I have a filter that looks like this:
return {
{
Str = function (elem)
if elem.text == "hello" then
return pandoc.Emph {pandoc.Str "hello"}
else
return elem
end
end,
}
}
this works, it replaces any instance of "hello" with an italicized version of the word. HOWEVER, it only works with whole words. e.g. if "hello" were part of a word, it wouldn't touch it. Since the equal signs are read as part of one word, it won't touch those.
How do I modify this (or, please, suggest another filter) so that it CAN replace and change parts of a word?
Thank you!
this works, it replaces any instance of "hello" with an italicized version of the word. HOWEVER, it only works with whole words. e.g. if "hello" were part of a word, it wouldn't touch it. Since the equal signs are read as part of one word, it won't touch those.
How do I modify this (or, please, suggest another filter) so that it CAN replace and change parts of a word?
Thank you!
A string like Hello, World! becomes a list of inlines in pandoc: [ Str "Hello,", Space, Str "World!" ]. Lua filters don't make matching on that particularly convenient: the best method is currently to write a filter for Inlines and then iterate over the list to find matching items.
For a complete example, see https://gist.github.com/tarleb/a0646da1834318d4f71a780edaf9f870.
Assuming we already found the highlighted text and converted it to a Span with with class mark. Then we can convert that to LaTeX with
function Span (span)
if span.classes:includes 'mark' then
return {pandoc.RawInline('latex', '\\hl{')} ..
span.content ..
{pandoc.RawInline('latex', '}')}
end
end
Note that the current development version of pandoc, which will become pandoc 3 at some point, supports highlighted text out of the box when called with
pandoc --from=markdown+mark ...
E.g.,
echo '==Hi Mom!==' | pandoc -f markdown+mark -t latex
⇒ \hl{Hi Mom!}
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
When I select some text, for example form-col and press [ I want to get [form-col] but WebStorm replace selected text with [. Is there a way to configure it?
I don't think that functionality exist. However you can use the Live template functionality. It's very useful and it does pretty much the same thing.
To do this, go on : [File]->[Settings]->[Editor]->[Live Templates]->user, Click button + and add a live template like:
In you html file when you write the abbreviation what you are added, press Tab and it generate you [] and place the cursor after the first [and now you can write your html tag [form-col]
Settings/Preferences
Editor | General | Smart Keys
Ensure that Surround selection on typing quote or brace option is enabled
In short:
with iWork rich text objects, breaking the text up in words goes from:
"This... he said, is a sentence!"
to:
["This", "he", "said", "is", "a", "sentence"]
So: periods, comma and exclamation point have disappeared.
Similar to the AppleScript situation, but with Javascript for Automation it is unclear to me how to set the text item delimiter (plus: I am hoping it can be simpler than in the old days).
In detail:
I would like to modify rich text like:
testing [value] units <ignore this>
>>>
also ignore this
<<<
etc.
The text can contain variations in size/color/weight, which should be kept.
The result should be e.g.:
testing 123 units
etc.
When I go through the words (in my case: presenter notes in Keynote), I get:
["testing", "value", "units", "ignore", "this", "also", "ignore", "this", "etc"]
instead of:
["testing", "[value]", "units", "<ignore", "this>", ">>>", "also", "ignore", "this", "<<<", "etc."]
So: characters like ., [, and > don't show up, which makes it impossible to search/replace.
To get the words, I use:
words = Application("Keynote").documents[0].slides[0].presenterNotes.words
I also tried using whose() in combination with ignoring/considering (case, hyphens, punctuation), but the result is the same.
How can I get a list of words that include the non-alphanumeric characters?
To get the full text of a slide's notes, use the presenterNotes() method:
note = Application("Keynote").documents[0].slides[0].presenterNotes()
It's not exactly intuitive for me, but it works fine.
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.