When typing on a German keyboard Atom IDE has trouble to map certain keys to the characters.
I learnt so far editing keymap.cson helps:
'.platform-win32 .editor':
' ctrl-alt-[': 'unset!' # for \
' ctrl-alt-q': 'unset!' # for #
I succeeded to write \ and # but I failed to map "~", which might be helpful in editing package.json. I tried to add:
' ctrl-alt-]': 'unset!' # for ~
but that didn't do anything.
Has someone a better idea, or even a list with all the characters that need mapping?
I understand this problem is relevant for all non-English keyboards.
A Community Package called keyboard-localization solved my problem:
This is a compatibility package for atom text editor which tries to remap keycodes for your given keyboard layout.
Related
Is there a quick way to search old commands which were run in the Julia REPL? Using the up arrow to go back in time seems to have a limit on its history and it is also quite cumbersome.
One of the five REPL models available in Julia is the "Search mode" which allows you to search through previously executed commands from the REPL. You can click "Control" + "r" to open search mode like is shown below:
(reverse-i-search)`':
There is also a forward search available with "Control" + "s". You can read more about Julia's REPL Search mode here: https://docs.julialang.org/en/v1/stdlib/REPL/#Search-modes
In addition to "real" search, you can also enter the beginning of a previous line and scroll up in the history (using ↑ or Ctrl-P) to switch between all previously entered lines starting with the same prefix.
So, if you had previously entered x = some_complicated_expression, you can write x = and go up until the line you were looking for appears.
Checkout: https://kristofferc.github.io/OhMyREPL.jl/latest/features/fzf/#Fuzzy-REPL-history-search
Which will be easier to use than reverse-i-search
When using the up and down arrow in my terminal (iTerm 2 on Mac OS Catalina), I can browse through my last commands using the up and down arrows.
I use ZSH (Oh-my-zsh to be precise) and if I type e.g. vim then press up, it will browse my history for any commands issued starting with vim.
I think it's annoying to have to move my hand to the arrow keys, so i wanted to bind ctrl-j and ctrl-k for browsing up and down.
I looked at bindkey and bound ^j to down-history and ^k to up-history. This allows me to browse my history, but not with the "smart" functionality (i'm not sure of the right terminology here) - It simply goes up and down in my history, without regards to my input.
I've looked through the standard widgets on the Zsh Line Editor manual, but I cannot find the right command for this.
Which command should I bind ^j and ^k to to get my desired result?
After some further digging, i ended up on the The Z-Shell Line Editor page at the section called "Prefix searching".
It revealed that the widget I was after, is called history-beginning-search-backward.
When using that widget, it works almost as I wanted it to, but not jumping to the end of the line.
A quick search lead me to another StackOverflow Question, that states that if you want to jump to the end of the line (as with the up arrow), it should be done as follows;
I had the same question and managed to find the solution with some experimentation.
I added the following to my .inputrc
"\eOA": history-search-backward # Up
"\eOB": history-search-forward # Down
"\C-P": "\eOA\C-E" # Ctrl-P
"\C-N": "\eOB\C-E" # Ctrl-N
This binds two hotkeys to Ctrl-P and Ctrl-N. One for history search, and the other Ctrl-E for end-of-line.
I want to format my Qt code via a shortcut in Qt Creator, just like ctrl + shift + F in Eclipse.
But didn't found one in Qt creator options, nor after searching via google.
So, do there has such a shortcut in Qt Creator? If no, then how to format code?
You can at least indent your code in the following way. First, select the portion of code you want to indent (or Ctrl + A, if you want to indent all source code in the current file) and then Ctrl + i.
If you're on a Mac OS X, use Command instead of Ctrl.
First, install clang-format.
If you're on Ubuntu, you can do it with sudo apt-get install clang-format.
Then go to Help -> About plugins, and check Beautifier.
Then restart Qt creator.
Now, go to Tools -> Options -> Environment -> Keyboard and find where it says "Format Current File" in the middle column, then click on it.
And at the bottom of this window click on record, and record the key sequence that you would like to use to format the current file.
This question might be over-answered but I could not find one. Basically I am using RStudio and the keyboard shortcut cmd + shift + c for inserting comments. Is there an other combination to insert directly the roxygen tags #' ? Or a way to modify RStudio to tell it to add the ' when I press cmd + shift + c?
You could use an RStudio addin, you'll need a fairly recent version of RStudio. I've just created an RStudio addin that comments/uncomments using roxygen2 tags, i.e. works just like code commenting, but with #'. The addin is hosted on github.
Just install and attach a convenient keyboard shortcut.
If you are interested in other available addins, see the addinmanager addin.
This isn't exactly what you're looking for. But you can add an ROxygen2 skeleton for a function by placing your cursor inside the function then pressing ctr+alt+shift+R. Then if you hit enter in the ROxygen2 codeblock it will automatically add the backtick. So an alternate workflow, edit the function, then insert the skeleton and do the documentation that way.
Rstudio find/replace
Select text to comment out, tick regex option and specify:
find: ^(.+)
replace: #' \1
Above means to find all characters (.+) following beginning of the line ^ and replace them by the #' and the first captured group \1.
vim find/replace
I find this option the easiest as I use Rstudio in vim mode. To replace text one only need to:
select text
go to the "command-line mode" by using : key
enter s/^/#' and hit enter.
s/ stands for "substitute", ^ stands for beginning of the line and #' is the text we are inserting.
This is not a default Rstudio option. Make sure you have Keybindings set to "vim" in RStudio "Global Options"
The absolute simplest answer is in the comments on the addins answer above and deserves its own billing (with attribution):
Rstudio does have column selection, to get multiple cursors alt + mouse to select, or ctrl + alt and the arrow keys, then keys move forward and back by words/lines work as expected. – Peter Apr 16 '16 at 23:55
[ETA: On Mac, ctrl + option + arrow keys or option + mouse.]
#Peter nice. in that case you could just make a chunk of cursors at the beginning of the line and and type in #' . I doubt roxygen comments are used enough to warrant a dedicated keyboard shortcut, but it wouldn't hurt to have I guess – rawr Apr 17 '16 at 1:26
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
I want to comment out a block of multiple lines in Jupyter Notebook, but can't find out how to do that in this current version.
It used to be in one of the drop down menus but is no longer there.
How do you comment out multi-line blocks of code at once?
This is not a duplicate because the solution given in the following link doesn't seem to work anymore:
How can I block comment code in the IPython notebook?
Ctrl + / does nothing.
Ctrl + / works for me in Chrome browser in MS Windows. On a Mac, use Cmd + / (thanks Anton K).
Please note, if / did not work out of the box, try pressing the / key on the Numpad. Credit: #DreamFlasher in comments to this question.
I have not yet managed to find the best way possible. Since I am using a keyboard with Finnish layout, some of the answers do not work for me (e.g. user5036413's answer).
However, in the meantime, I have come up with a solution that at least helps me not to comment each and every line one by one. I am using Chrome browser in MS Windows and I have not checked other possibilities though.
The solution:
It uses the fact that you can have multiple line cursors in an Ipython Notebook.
Press the Alt button and keep holding it. The cursor should change its shape into a big plus sign. The next step is, using your mouse, to point to the beginning of the first line you want to comment and while holding the Alt button pull down your mouse until the last line you want to comment. Finally, you can release the Alt button and then use the # character to comment. Voila! You have now commented multiple lines.
Try using the / from the numeric keyboard.
Ctrl + / in Chrome wasn't working for me, but when I used the /(division symbol) from the numeric it worked.
Quick Addition to Top Answer: CTRL + / is nice because it toggles back and forth between adding and removing # at beginning of all selected lines. Didn't see that exact nuance mentioned so just wanted to add it here. (This worked in Firefox Developer Edition 54.0b12 on Windows 7).
On a Finnish keyboard use Ctrl + ' to comment on multiple lines and use the same keys to de-comment.
Ubuntu 14.04 Google Chrome
TL;DR:
Using MacBook Pro with Spanish - ISO Keyboard.
Solution: Ctrl + -
Full story
This is an old post but reading it got me thinking about possible shortcuts.
My keyboard is a Latin Apple MacBook Pro, which is called Spanish - ISO. I tried the changing keyboard distribution to U.S. solution... this works but with this solution I have to switch keyboards every time I want to comment which... sucks.
So I tried ctrl + - and it works. The - is where the / is located in an english keyboard but doing Cmd + - only changes the Chrome's zoom so I tried Ctrl which isn't as used as Cmd in macOS.
My takeaway with this would be: if I have more shortcut problems I might try the original shortcut but using the key where the U.S. keyboard would have it.
Select the lines you want to comment out. Then press:
Ctrl + #
I tried this on Mac OSX with Chrome 42.0.2311.90 (64-bit) and this works by using CMD + /
The version of the notebook server is 3.1.0-cbccb68 and is running on:
Python 2.7.9 |Anaconda 2.1.0 (x86_64)| (default, Dec 15 2014, 10:37:34)
[GCC 4.2.1 (Apple Inc. build 5577)]
Could it be a browser related problem? Did you try Firefox or IE?
Use triple single quotes ''' at the beginning and end. It will be ignored as a doc string within the function.
'''
This is how you would
write multiple lines of code
in Jupyter notebooks.
'''
I can't figure out how to print that in multiple lines but you can add a line anywhere in between those quotes and your code will be fine.
Fn + Cmd + / in Safari browser on MacOS
On MacOS 10.11 with Firefox and a German keyboard layout it is Ctrl + ?
Select the lines on windows jupyter notebook and then hit Ctrl+#.
I add the same situation and went in a couple of stackoverfow, github and tutorials showing complex solutions. Nothing simple though! Some with "Hold the alt key and move the mouse while the cursor shows a cross" which is not for laptop users (at least for me), some others with configuration files...
I found it after a good sleep night. My environment is laptop, ubuntu and Jupyter/Ipython 5.1.0 :
Just select/highlight one line, a block or something, and then "Ctrl"+"/" and it's magic :)
After searching for a while I have found a solution to comment on an AZERTY mac. The shortcut is Ctrl +/= key
I am using chrome, Linux Mint; and for commenting and dis-commenting bundle of lines:
Ctrl + /
For a Dutch keyboard layout (on Debian 9 in Chromium 57) it is Ctrl + °
Another thing to add, in the version I'm using, the code has to be initialized in order to be to comment it out using CTRL and / . If you haven't ran the code and the code isn't colorized it wont work.
If you have a Mac and not a English keyboard:
Cmd-/ is still easy to produce.
Follow the below steps:
Just go into the Mac's System Settings, Keyboard, tab "Input Sources" or whatever it might be called in English
Add the one for English (shows up as ABC, strange way to spell English).
Whenever you want a Cmd-/, you have to change to the ABC keyboard (in your menu row at the top of your screen,if you have ticked it to be shown there in the System Settings - Keyboard tab).
Cmd and the key to the left of the right "shift key" gives you Cmd-/.
P.S: Don't forget to switch back to your normal keyboard.