Emulate codePen twilight theme - themes

I'm trying to make sublime text to look like codepen.io twilight theme. I was able to copy it besides for some categories. I don't know what the name of the scope is. Here's an image with the different words I want to change.
(The text from the image is JavaScript.)
I want to change the purple underlined words to purple, and yellow to yellow. What are the keywords (scope names) for the words?

The yellow underlined items in your example are class names (a special case of variable name in JavaScript (and most languages).
I don't believe a syntax scope exists in JS for class names. It seems they are scoped as simple variables. Assuming I am right you are going to need to define your own syntax scope, perhaps calling it 'className' or similar. The defining characteristic seems to be a leading Uppercase followed by a lowercase.
Then you'll need to reference that new name in the color scheme and make it yellow (#FFF000) http://htmlcolorcodes.com/.
The same goes for the purple where you might have a member or a property or anything accessible through dot notation (based on your example). Again I think you are going to need to add your own syntax definition to the syntactic definition file for the languages you want to use it in. The regex seems to be any alphanumerics following a dot (.) ending at the next dot found. The name might be 'dotValue' or similar. Then you'll need to add that new syntax to the color theme to make 'dotValue's purple (#9700FF).
Before you start doing any of the playing about required to get where you want to be by trial and error make very sure you have backups of the syntax and color themes in a known good state so you are able to get back to a safe state at any point you might go off the rails.

You can find the scope name for any part of a document in Sublime Text 3 by placing the cursor immediately to the left of it and then using Tools menu -> Developer -> Show Scope Name, which will pop up a little window showing the scope, along with a button to copy it to the clipboard. This functionality is also available through Ctrl+Alt+Shift+P.

Related

Sublime Goto anything using dot notation

When using Sublime 3, I'd like to search for a file using the "Dot notation", i.e. file names using . as the separator.
E.g. if I press CtrlP (Goto Anything) and type frontend/banks/index it will find, for example, frontend/banks/index.php
But I want to type frontend.banks.index, which are used in Laravel's views.
How do I achieve this? Is this a sublime setting or a package?
This doesn't directly answer the question, and it makes an assumption for Sublime users: that you want/need this functionality to easily find view files in Laravel code, probably blade templates, based on the the de facto dot notation for view paths, eg.
return view('frontend.banks.index');
PhpStorm users will know about (and rub your nose in) the functionality it offers when hovering over the view path. It will give you a pop-up with a list of files whose path matches the pattern.
The workaround I use for Sublime though is to use slash notation instead of dot notation, eg.
return view('frontend/banks/index');
It's not well known that this works and I haven't seen it documented but it functions identically.
The downside to this is it breaks PhpStorm's above mentioned functionality. I recently got into a debate with a coworker over it. Since PhpStorm is more prevalent in the Laravel world, he won out. For my personal/solo projects, I use this syntax, and newcomers to the project using PhpStorm can suck it.
So, to wrap up my longwinded rant, here's my workflow to find a Laravel view in Sublime Text:
Prerequisite: write all view paths using slashes instead of dots in my codebase.
Highlight the view path
Copy to clipboard
cmd+p (or super+p, ctrl+p, based on your OS) to open the fuzzy file finder, whatever it's called
Paste
Open the desired file (if multiples match, otherwise just hit enter)
It's decent enough and doesn't require a mouse, like half of PhpStorm's best functionality. 😜
PhpStorm functionality mentioned above:
(Edit: apparently this PhpStorm tooltip is just for auto-complete, which is nice, but to actually open the file, F12 should work with the cursor on the path string. Also, according to my coworker, F12 also works with slash notation, so that's very nice for PhpStorm users obviously. All said an done, I think slashes should be used for views in Laravel projects.)

How do I tell PowerPoint to map two placeholders when switching slide layouts?

I start with a working example:
Open PowerPoint with a blank presentation.
Right-click the title slide and choose "Layout - Title and Content".
You see "• Click to add text"? Click and add some text.
Right-click the slide again and choose "Layout - Two Content".
See how smart PowerPoint can be?
The text you entered in the single placeholder before is now in one the of two placeholders.
Specifically, the left one.
My questions:
Why? (And not in an extra one?)
Why? (And not in the right one?)
My questions arises because I have received a set of master slides in which the above is not working, and I am trying to repair it without having to regenerate everything.
This is a site for programming issues, but the background behind this issue might be sufficiently complex. Modern PowerPoint files are XML. In the XML for each slide layout, each placeholder has an idx reference number. PowerPoint uses these on numbers to decide where to place content.
Lazy Designer Syndrome is the cause of what you're seeing. Instead of creating new placeholders in order, so the idx numbers would increment in a logical order, the designer has copied and pasted placeholders to avoid extra formatting work. The pasted placeholders all have the same idx number. As a result, PowerPoint has no idea of placeholder order and inserts content randomly.
This isn't always easy to solve without editing the XML, but you can try deleting all but the leftmost placeholder. Then create new placeholders by inserting them one at a time and reformatting them manually to match the first.
At first my attempts to follow the above failed, but now I got it working as well.
There are two different, but similar tags, id="" and idx="".
All objects in the slide has an id="" tag, this is not the tag to solve this problem.
The idx="" tag is only on Placeholder objects, except the those of Type=Title.
As described above you can set it to an integer value 1 and greater (I assume).
Make a plan for what Placeholder objects should be replaced across your layouts. I think of these as "groups" or "families", then assign the idx-values consistently throughout your slide layouts.
These "groups" or "families" of placeholders needs to be compatible for this to work, i.e. matching Type. The absence of Type means the placeholder is a general Content Type and match all Types.
During layout change, if Placeholders has incompatible Type while having the same idx-tag, PPT will look for the next Placeholder with matching Type.
#JohnKorchok's accepted answer provides the technical details for the procedure described here. Note that I only had "Content Placeholders" in my presentation.
Install 7-Zip and your favorite text editor (you can use one with an XML formatter, which will simplify things, but it's not required).
Open your file.pptx in 7-Zip (no need to rename to .zip, just right-click and "Open Archive")
Navigate to ppt/slideLayouts.
See a list of slideLayout....xml files.
Identify the ones you want to edit, e.g., by opening each one and looking for <p:cSld name. (The numbers may be indicative only of the order the layouts have been created, not of the order in which they are now shown in PowerPoint - although saving a .pptx files in PowerPoint 2016 does modify the slide layouts for me so that the display order matches the file name numbers.)
Look for <p:ph until you find the ones you want to edit. You probably want to ignore the ones with type="title", type="ftr", type="sldNum".
Change the idx of all other placeholders to 1, 2, ... in the order in which you want them filled (use the <p:cNvPr ... name= to identify the placeholders).
Save the .xml files, close your editor, and be asked by 7-Zip to update the archive. Answer "Yes".
So I set the idx to 1 for the one placeholder in my 1-content layout, to 1 for the left placeholder in my 2-content layout, and to 2 for the right placeholder in my 2-content layout.

Does an Indesign syntax highlighter exist?

Does anybody know of a non-manual method of highlighting syntax when pasted in InDesign?
I'm trying to show code of a project in an InDesign documentation but don't want to have to manually highlight the code, and preferably add numbered rows too.
Is there a plugin to achieve this?
This is the style in which I'd like to format the code.
Cheers
Not sure if you worked out an answer to this, but there's no magic button that will solve your problem.
However, InDesign does have a facility in each Paragraph style called GREP that can do what you're looking for.
This lets you write 'regex' or 'regular expressions' that are just rules for what to apply a given character style to. Yes, they look about as meaningful as Harry Potter incantations at first glance, but 2 or 3 simple regexes will get you a long way.
For instance:
(\<|<)!--\s*.*?\s*--(\>|>)
Will target HTML comments only.
(?<=").*?(?=")
This will target anything wrapped in straight double quotes.
(?<=\().*?(?=\))
This will target any text inside parentheses ().
There's an '#' symbol button in that GREP style next to where you type the regex - that gives you a drop-down menu that is almost like a 'Regex Wizard'. Try that too.
When you've got a regex that works, create a new character style for the text color and select it in the 'Apply Style' input.
Regexr.com has a tool that is good for testing this stuff. Paste your code sample in the bottom panel and your line of regex in the top. The bits that it targets will turn blue.
There is a searchable community panel on the left where people have probably already written expressions like the one you need.
I'm working out a JavaScript highlighter at the moment. It's a shame there's no communal 'Indesign style sharing library'.
Best of luck.
If had luck pasting syntax highlighted code into a Rich Text editor like Libre Office and then pasting it into Indesign. Just make sure whatever font your syntax highlighted code is in is also in InDesign because you'll get font missing errors when you pre-flight the book.

How to change multiple entries in config files

I notice in VS2013 that if I highlight text with a view to making a change, the same text is highlighted elsewhere in the file. However, I can't seem to find the option to reflect the change in multiple places when I start typing.
Is this feature just for information only or can I actually do multiple replacements by typing the change once?
This is not supported out of the box.
But there is a nice plugin you can use to enable this, called MultiEditing.
H/T to Scott Hanselman :)
Also note that even in standard VS2013, you can edit multiple lines by "box-highlighting".
This is where you create a "box-selection" either by holding down Alt and dragging a box around the text, or by Alt+Shift+ArrowKeys. Then start typing and the same text will appear on multiple lines.
e.g. with the following text:
Some text to demonstrate
Some info to demonstrate
Some more to demonstrate
...if you Alt+drag a box-selection around all 3 occurrences of the word to, and then type which, it will look like this:
Some text which demonstrate
Some info which demonstrate
Some more which demonstrate
This also works with copy/paste - the pasted text gets applied to all lines within the box-selection.
It's pretty hard for me to describe here, so try it yourself!

How do I add features to a syntax definition in Sublime Text without editing it?

For example, I would like to highlight #param, #type, and #return (i.e. epytext declarations) in my Python docstrings. I have figured out how to do this by simply editing Python/Python.tmLanguage; however, I would really like to put this in its own file, for a couple of reasons:
I don't always want to apply this highlighting. It's only for projects that use epydoc as their documentation tool; in other projects, I would want to highlight reStructuredText instead.
When Sublime Text updates, I'd like to have my own syntax as an overlay onto the included features. there are several features of Python that Sublime's author may choose to include in future versions and I don't want to have to manually figure out what I changed each time an update modifies the base Python syntax definition.
I keep my own editor configuration in version control, but I want that to be my own original stuff; I don't want to be burdened with having to carry copies (possibly proprietary? I don't know, it doesn't seem to have an independent license) of syntax definitions that come with Sublime.
Is there a way to put highlighting rules into a separate file, perhaps to only be applied to a particular scope?
Sounds to me like you want to create your own syntax file, inherit from the Python syntax file (source.python), and make your changes and customizations there. Sublime Text 2 uses the .tmLanguage format for syntax files, which is a bit complex, but fortunately most of the work has already been done for you, just by inheriting from source.python.
What you want to do is set up a regex pattern to match the substrings that you want to highlight, and give that pattern a name; something like punctuation.definition.comment.epydoc, to follow the convention set in Java/JavaDoc.tmLanguage. Then, check your color scheme file (ending in .tmTheme) and make sure there are settings for the scope that you've chosen -- or for one of its parents, since ST2 should use proper scoping rules for this sort of thing.
To use the syntax file you've created, stick it in Packages/User (so that ST2 doesn't overwrite it on upgrades), open a Python file in the editor, and then select your new syntax from the dropdown list in the bottom right corner of the window. If you've set up everything correctly, the epydoc strings should change to be whatever color you've set in your color scheme.
Good luck! And post a link somewhere when you've got a syntax file that works, so others can see and use it, as well!

Resources