Custom keyboard shortcuts in Powershell ISE - powershell-ise

Can I configure custom keyboard shortcuts for the PowerShell ISE without adding them to the AddOnsMenu?
I'm referring to keyboard shortcuts such as 'Ctrl-M' (which expands/collapses outlining in the ISE Editor). I'm using PowerShell ISE Host 5.1.
The keyboard shortcuts I have in mind would do things like select and manipulate text in the editor based on caret position. Nothing as elaborate as PSReadline, just a few keyboard shortcuts to automate basic tasks.
I understand I can do this:
$Display = "Select Current Line"
$Action = { $psise.CurrentFile.Editor.SelectCaretLine() }
$Shortcut = "Ctrl+L"
$psise.CurrentPowerShellTab.AddOnsMenu.Submenus.Add($Display,$Action,$shortcut)
But I don't want to add anything to the AddOnsMenu. I'd prefer to have my shortcuts specific to my ISE $profile and/or session. Is this possible?

The code posted can be added to the ISE profile. The collection of submenu items added to the AddOnsMenu are removed when you close the ISE.

Related

Command Palette shortcut not working in Sublime Text3

I am using Sublime Text 3 and am trying to access the command palette using ctrl-shift-P. This shortcut is not working. I am running Ubuntu 16.04. Any help to fix this would be greatly appreciated.
The two main reasons for this sort of situation (regardless of the key sequence in question) are:
A user installed plugin or custom key binding is bound to the same key, which is taking precedence and stopping the action that you expect from happening
Some external process is eating the keystroke before Sublime even gets to see it.
In order to diagnose which it might be, you can open the Sublime console with View > Show Console or by pressing Ctrl+`, then enter the following commands:
sublime.log_commands(True)
sublime.log_input(True)
Once you've done that, press the key sequence in question and check the output in the console. In your specific case, you should see this:
key evt: shift+control+p
command: show_overlay {"overlay": "command_palette"}
Not seeing the command that you expect indicates that some other action is bound to the key in question, and usually the command will lead you to what's causing the problem.
Not seeing the key event means that some external process is eating the key. This could be some global program or it could be something in the OS doing it (in the case of Linux, the window manager).
It's also possible that you see a different key event entirely, which indicates that your keyboard layout is not what Sublime expects.
Depending on the situation you may be able to disable whatever is eating the key. Presuming you can't find what that is or otherwise don't want to disable it, or if the event shows that Sublime is seeing a different key, the solution is to change the key binding.
The procedure for this is to find the binding that's not working and copy it to your custom key bindings, changing the key as appropriate to something that Sublime can see.
For core Sublime key bindings, look in Preferences > Key Bindings to find the key in question. For packages, that's generally in Preferences > Package Settings > PACKAGENAME > Key Bindings.
In your case, the setting is a default key binding, so looking in the default key bindings yields the following binding, which you can put in your custom key bindings and change as needed:
{
"keys": ["ctrl+shift+p"],
"command": "show_overlay",
"args": {"overlay": "command_palette"}
},
Something that I found:
Weirdly my Sublime Text 3 doesn't recognise the command if I use LCTRL abd LSHIFT. Using RCTRL+RSHIFT+p opens the command palette, so try that.
In my case it was an app called https://noiz.io which had stolen this shortcut. It can take a bit of time as there isn't (AFAIK) a way to find the application which is bound to a shortcut.
In my case a Pomodoro app I just installed had a command for starting clock defined with the same shortcut and it was stealing the event from Sublime. Just removed the shortcut assignment and it works now.

"Completion type" for IPython Console in Spyder

I'm a new Python user and I'm just playing around with customizations in Spyder. This question is just out of curiosity.
I saw that when I go to Tools > IPython console > Display there's a drop down menu under "Completion Type" that allows the user to "Decide what type of completion to use", and gives 3 available choices (Graphical, Terminal and Plain).
I googled around and tried switching between the 3 of them but I can't get a hang of what are the differences between the 3 of them. Any insight?
They relate to how suggestions are displayed when you press tab. e.g. I type keras.layers. then press tab, it'll show the possible completions, the completion type refers to how these suggestions are displayed
Based on my observations,
Graphical = a box that you can scroll through
Terminal = text style (displayed below code) that cutoffs at some point
Plain = text style that does not cutoff
Note: You need to restart your IPython consoles to see the changes.

Is there any editor or popular editor extension that automatically remove quotes/brackets?

There are too many text editors, which have the function, that if I just select a piece of the code and press the quote/bracket key, the selected code becomes wrapped into the type of the quotes/brackets I pressed. But do you know any or are you using any, which has also the function, that if I select the piece of the code wrapped into the quotes/brackets and press the same quote/bracket key or some key combination, that piece of code becomes unwrapped?
Also if you know any editor or popular editor extension that automatically remove all quotes/brackets from the code, please write it too. Everything would be helpful.
We are doing some research and this question is still unanswered. Please help us if you know anything about.
I create a simple Zeus (Windows) Lua script that does this for the quote case (i.e. the macro wraps any marked area in quotes).
In a similar fashion another script could be written for the brackets case.
Also as this simple script shows, this should be possible in any scriptable editor.
The script can be found here: http://www.zeusedit.com/zforum/viewtopic.php?t=7148
SynWrite editor (Windows) can do scripting for u. You can write Python plugin in 10min, and assign it a hotkey, so selection (or all text) will dequote, or what ever.
Finally, I've made it by writing my own extension to my favourite editor.

Applescript code completion shortcut

I'm new with applescript and this may seems dumb... but I have no clue at how to auto complete the code completion in the editor!?
I checked the option Use Script Assistant in the preferences.
For exemples When I create a new variable then I start to write it later in the code I can see in light grey color the word I want to auto complete.
But what is the shortcut to auto complete it? I tried spacebar, enter, shift + arrows... and so on
but have no clue
thanks for your help :P
You can use Script Assistant's Auto-Completion with the Option + Esc key.
It probably changed whith sierra or High-Sierra :
It's now option + escape keys.
Personally, I don't like the Escape key to auto-complete.
To add your own key to auto-complete, go to
System Preferences > Keyboard > Shortcuts > App Shortcuts
and add an entry for Script Editor (select "Other" and then go to Utilities in Finder) named Complete. You can then choose your own shortcut to auto-complete in the Script Editor.
Here's a screenshot for Ctrl + Space.
The menu shows option + esc will auto-complete and it seems that just esc will as well but, the esc key to me is "escape", meaning "stop current computer operation" so it feels like I am trying to not accept auto-complete!
Instead, using the keyboard shortcuts and adding a shortcut of command+return to accept the auto-complete feels natural during typing...
Here is a visual setup:
(in Big Sur, same action, different look in earlier macOS versions)

Does Texniccenter or any other tex editor auto-complete references in Latex?

I want to use a latex editor that has auto completion feature for existing references in a latex file. Do you know any good ones? I am trying to find this feature in texniccenter, but I guess it doesn't exist or I could't find it yet.
Update:
Ok, I found how to enable auto completion in Texniccenter. I needed first create a project. Then open the file in this project (or copy its text). Now Ctrl-Space inside a \ref{} tag completes the reference automatically.
Texlipse does this, also with Ctrl+Space.
Inlage includes such a function, too. New commands and new environments will also appear in the auto completion list. If you use extern BibTex files the \cite{} command will open a list with your articles and books from you .bib file.
Ok, I found it. I needed first create a project. Then open the file in this project (or copy its text). Now Ctrl-Space inside a \ref{} tag completes the reference automatically.
Kile has reference completion. If you type Ctrl+Space inside of a \ref{}, you get a list of all the references (that existed last time you compiled, of course).
LEd presents a click list of them when in a \ref{}
The RefTeX mode for Emacs will do what you're asking for: the shortcut C-c ) activates the "insert a \ref" mode (of course, you can customize which type of reference: fancyref, hyperref, etc) and pressing TAB will allow you to start typing and autocomplete by tabbing again after typing some characters.
It also figures out (or asks if it can't) what sort of ref you're inserting and shows a list of all the defined \labels in your document, selectable with the arrow keys or C-n / C-p.
Now we just need a Vi user to come along and tell us how to do it there...
Now texmaker does, not need any special key.

Resources