In Etherpad, are there any shortcuts for other actions than bold, italic and underline (strike, bullet point, ...)? - keyboard-shortcuts

Well, pretty much everything is in the title: are there any shortcuts to perform something else than making text bold, italic or underlined ? Or any plugin allowing to do so ?
According to a colleague of mine, the source code doesn't seem to contain such things, but maybe we've missed something ?

Etherpad contains an embedded rich-text editor called ACE2 (originally AppJet Code Editor), that seems to be responsible for the keyboard shortcut handling.
The ace.js file that is embedded by default used to be minified and therefore hard to read in older version of Etherpad, but you can read the original source files directly in the infrastructure/ace part of the source code, from which the minified version is produced. For more info about that have, a look at ACE2's README.
More recent versions (at least the etherpad.org ones) seem to include the normal ACE2 JS source.
The keyboard shortcut handling code is located in ace2_inner.js, inside the handleKeyEvent() function. Based on this, it looks like the keyboard shortcuts supported out-of-the-box are the following (on top of the browser's shortcuts like Cut/Copy/Paste):
Enter - special etherpad carriage return
Tab or Shift+Tab - indent or outdent bullet lists
Ctrl+Z - special etherpad undo
Ctrl+Y - special etherpad redo
Ctrl+B - bold
Ctrl+I - italics
Ctrl+U - underline
Ctrl+H - delete
Ctrl+S - Save a Revision
Nothing for strikethrough or bullet lists indeed, and nothing that looks like an easy extension mechanism for shortcuts, so you may need to get your hands dirty ;-)
If you have your own deployment of Etherpad the easiest might be to modify the source code of ACE2 to handle additional shortcuts, then re-build the ace2.js minified version (according to the instructions in the README) if needed.
Here's an example of how to handle Ctrl+S shortcut for strikethrough toggle, and Ctrl+L for bullet list toggle. The strikethrough shortcut disables the builtin browser Save As... shortcut, which I find is a bonus, but if you don't like that you can always opt for another key than S.
Insert the following snippet in ace2_inner.js in between similar-looking blocks that handle other shortcuts, around line 3200:
/* Ctrl+S toggles striketrough, and prevents triggering the browser's Save dialog */
if ((!specialHandled) && isTypeForCmdKey &&
String.fromCharCode(which).toLowerCase() == "s" &&
(evt.metaKey || evt.ctrlKey)) {
// ctrl/cmd-s (strikethrough toggle)
fastIncorp(13); // don't ask me ;-)
evt.preventDefault();
toggleAttributeOnSelection('strikethrough');
specialHandled = true;
}
if ((!specialHandled) && isTypeForCmdKey &&
String.fromCharCode(which).toLowerCase() == "l" &&
(evt.ctrlKey)) {
// ctrl/cmd-L (bullet list toggle)
fastIncorp(9); // seriously, don't ask me ;-)
evt.preventDefault();
doInsertUnorderedList();
specialHandled = true;
}
If you can't rebuild the minified version you can also try to directly patch it using the minified names. Here's the minified version of the above snippet for me, though YMMV, I didn't check if the minification is stable and reuses the same shortened names every time. Search for "y" (with the quotes) to locate the minified version of handleKeyEvent() inside ace.js:
if ((!Cp)&&Cu&&String.fromCharCode(Ct).toLowerCase()=="s"&&(i.metaKey || i.ctrlKey)){G(13);\\ni.preventDefault();c("strikethrough");Cp=true;}if((!Cp)&&Cu&&String.fromCharCode(Ct).toLowerCase()=="l"&&(i.metaKey||i.ctrlKey)){G(9);\\ni.preventDefault();As();Cp=true;}
Finally, if you don't control the etherpad deployment you could perhaps implement something similar using an in-browser GreaseMonkey script that patches the default handleKeyEvent() function. As a starting point for hooking into the editor, try inspecting the window.pad* objects, such as window.padeditor. For instance select some text in the editor and try the following in the console:
> window.padeditor.ace.execCommand('bold')
> window.padeditor.ace.execCommand('insertunorderedlist')

Related

PhpStorm AutoComplete code is not working

I'm using PhpStorm over 3 months and it's a good IDE. I do not know what I've clicked yesterday but since yesterday I have issue with code completion in CSS mainly.
On the screen I have VS Code and PhpStorm and also I've opened the same project.
In VS Code it works perfectly. In PhpStorm it doesn't. I tried some Google First Aid like clear cache, update the IDE, turn On/Off Safe mode etc. but nothing changed.
My Code Completion settings:
Based on your PhpStorm editor area screenshot (many thanks for that BTW: not many people do post it even if asked), all your CSS files are treated as a Plain Text. It's rather unlikely to be a glitch, more like accidental settings change.
Settings/Preferences | Plugins -- make sure that CSS plugin is enabled. If not -- enable and restart the IDE.
If still the same: Settings/Preferences | Editor | File Types -- locate "Cascading style sheet" entry and make sure that it has *.css pattern there.
If not there -- it's possible that you have somehow reassigned it to "Text" file type. If it's there -- just add *.css to Cascading style sheet patterns (it will remove it from Text when doing that).
If still nothing: you would need to provide more/new screenshots.

Multiple "right margins" or guides in PHPStorm

PHPStorm has a vertical line on what they call the "right margin" which is set by default to 120 characters or columns...
Given that PSR standards state There MUST NOT be a hard limit on line length; the soft limit MUST be 120 characters; lines SHOULD be 80 characters or less., it'd be nice if I could get another visual indicator at the 80 character mark...
I'm well aware that it says what line/column you're on in the status bar, but I typically hide most panels (status bar included) while coding.
Therefore, is there a way (feature or plugin) that would allow me to add a 2nd vertical line to indicate the 80th column?
It is not currently possible .. and no plugin comes into my mind.
https://youtrack.jetbrains.com/issue/IDEA-99875 -- star/vote/comment to get notified on progress.
P.S. Considering that this is rather PHP/Python specific (other languages do not care about this) .. I would not expect JB to have it implemented in nearest future...
I suggest the following workaround, it works for me on PhpStorm 9.0:
Open Settings page (usually Ctrl+Alt+S), go to Plugins -> Browse Repositories
Find and install BackgroundImage plugin
Restart IDE, it may output an error, something like "unknown protocol d" - don't worry, go forth
Make an image with height=1px, and width=(desired width of additional margin). Give it, say, white background and paint one rightmost pixel to say, black. I took a screenshot of an editor and cropped it in PS, to avoid annoying search and adjustment of the image width. Every change of background image requires to restart PhpStorm.
Open Settings again, goto Other settings -> BackgroundImage
Set Enabled checkbox, browse your created image, and check the FileSystem radio button
Restart IDE again and change the margin and you will get two margins
The image is left-aligned, so when you resize an editor on x-axis (move the splitter between Editor and Project View or File System View, etc.), the margin will remain truthy.
Some side-effects - it appears also on console window, event log, perhaps somewhere else.
If the plugin doesn't work, check out this page (there said that most JetBrains plugins should work on all products on IntelliJ Platform, and some workaround if they does not): http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
ADDED: Doesn't work with scaling an editor (Ctrl + MouseWheel) - the scale of the image (fake margin), remains the same and the margin becomes not truthy.
In the latest PHPStorm, this is now possible. This would be PHPStorm 2017.3. The instructions on the ticket mentioned in the accepted answer explains it quite well:
Will be available in the next EAP build. You can set it up at
Settings|Editor|Code Style|Visual guides for all languages or on
"Wrapping and Braces" tab for a specific language ("Other" tab for
XML/HTML). You can change the visual indent guide color at
Settings|Editor|Color Scheme|General|Guides|Visual guides. Please
submit separate reports if you find any problems.
I personally found the setting in Settings|Editor|Code Style|PHP|Wrapping and Braces|Visual guides. It should be there for every language.

IntelliJ keeps folding my code by default

When I open up any code file .java or .html IntelliJ (12.x) keeps the code folded and I always have to expand everything.
How do I make code expand by default?
In the preferences (ctrl+alt+s on my machine), under Editor, you will find an entry called Code Folding. In there you can choose what's folded by default. In your case, you'll probably want to remove all the defaults.

IntelliJ IDEA 13.1.2 javadoc and tabs

I hate to ask such simple questions, but nothing I found so far helped me...
So, I've recently started using IntelliJ instead of Eclipse and there are 2 things that really bothers me...
1.) size of javadoc popup window - ok, so I finally get this little guy to pop-up whenever I need it, but it's so small I have to use scroll every single time... and that's pretty anoying when I'm working with unknown libraries...
2.) tabs == spaces - maybe some of you like this, but I don't... Eclipse was treating tabs as tabs and not spaces... I tried to change settings but with no result... or is that maybe connected with project I'm working on? (meaning, if, at the start of a project, setting were such that tabs == spaces and now changes are not applied to it)
Sorry for stupid question but, as I said, nothing I found so far helped me...
1) Just resize the window with your mouse. It will retain the size the next time it opens. You can also click on the gear icon in the upper right corner and adjust the font size. Again, it will retain the size on subsequent use.
2) I'm assuming you make the change to the "Use Tab Character" option on the "Tabs and Indents" tab for all file types and saved the Code Style. After that, you need to run the Reformat Code action (Ctrl+Alt+L or Code > Reformat Code from the menu or Reformat Code from the context menu (i.e. right-click) in The Project Tool window or Navigation Bar). IDEA retains the previous formatting (so spaces in this case) until you run a reformat on the project (or a part of it).
If you have multiple projects already created, for each one, you will need to go into File > Settings > [Project Settings] > Code Style and set the Scheme (and then do a reformat). While the Scheme definition is saved IDE wide, the scheme to use is set per project (which makes sense since an Apache Open Source project you are working on may have different code style requirements than the projects you do at work vs the ones you do for fun).
Finally, you will also want to go into File > Other Settings > Default Settings > [Template Project Settings] > Code Style and make sure your saved code style scheme (with the use tab option) is set so that new projects use that scheme when they are created.

Disable apostrophe t space Intellij IDEA

When I type in a comment (JavaDoc or line comment) IntelliJ automatically inserts a tag when I type something like // don't and I hit the spacebar after the 't I see // don'< ></> with my cursor ready to type in the first tag. Does anyone know how to disable this behavior? I've tried google searching and searching through the settings with no avail. I'm using IntelliJ IDEA 13.0.1 community edition.
It sounds like a live template is being activated via the sequence tspace, although to the best of my knowledge this is not a default one. Go to File > Settings > [IDE Settings] > Live Templates. Search for a template that has t as its shortcut and inserts tags. Either delete it, or change its activation from space to tab (in the lower right). You may also want to check (and possibly change) the "default expand with" setting at the top.