There's an option in Jupyter Notebooks where you can select some cells, and then hit F, which opens up a Find & Replace feature.
This shortcut doesn't work in Jupyter Lab. It's not in the Commands list and it's not in the Edit Menu (there is only Find -- and Find Next and Find Previous). Nor can I find a global (not specific to a cell selection) Find & Replace feature.
Does this feature exist? I've found old mentions of it on the internet -- has it been removed? I'm using Jupyter Lab version 1.2.3.
The Find & Replace feature was not removed, but the way it is named in the menu (simply Find...) and the UI which requires the user to click on a small arrow to access it may be confusing. Please see the GIF below which demonstrates how to use the search & replace feature:
If you need a slightly more powerful refactoring tool (i.e. distinguishing the variable scopes) you may want to check out my jupyterlab-lsp project which now includes support for the rename action (see here for a demonstration GIF, but please install a newer version, not the tag linked).
I am not sure if the original question was answered correctly. If I were to find and replace in only a selected cell, the top rated solution doesn't seem to work (in JupyterLab). The desired result is obtained by clicking on the ... button in the F&R menu. Check the attached snippet.
It can be easily done using keyboard in Jupyter as well.
Step 1: If you are inside any code block/cell, press Esc.
Step 2: Press F
Related
I'm sharing a small but annoying issue that sometimes pops up when I'm using shortcuts to insert operators while working on a markdown file in R : the operator either does not get written, or even worse gets written on another file.
So let's say I am working on the file "report.rmd", and I want to insert the pipe operator using Ctrl+Maj+M, or the assignment operator using "Alt+-", and I have the file "test.R" opened. Well, I therefore type the aforementioned shortcuts and...nothing happens on my markdown file. But some nice operators that had nothing to do there get written on my test.R file.
The only way I found to solve this problem is to close and reopen RStudio (restarting unfortunately doesn't solve the issue).
While this is quite a minor problem, it's incredibly annoying. Did it ever happen to anyone of you, and if so do you know where it comes from and how to solve it?
Edit:
Although I am still running into this issue (without being able to reproduce it consistently) I came into a somewhat lighter solution. Instead of restarting R, simply closing all tabs (closing just the problematic one doesn't work) solves the problem. I hope this helps narrowing down the possible origins of the problem.
Short Answer
re-define the key combo to Ctrl+Shift+ \ , assuming this does not create a conflict
Background
I've had a similar problem for a while, too. In my case, the shortcut never works. I can not find the source. I even found a conflict with Ctrl+Shift+M assigned to 2 Editor functions.
Image:Screen Capture 2 conflicting hotkey assignments
However, a simple key reassignment of the one that is not the pipe operator ("Expand to Matching")
Image:screen capture showing the hotkey conflict solveddidn't solve the issue in my case.
Solution
Here's what did the job for me
I managed to assign a different combo (that hasn't been assigned yet) and that is comfortable enough in the sense of its location on the keyboard
go to Tools → Modify Keyboard Shortcuts...
In the filter box, write "Pipe"
Direct the cursor to the text box showing the current shortcut, and press the new combo (e.g. Ctrl+Shift+ \ ), then Enter.
Remember to hit Apply
Make sure the new Combo isn't a duplicate of another command, by going back to step 1 and sorting the list by Shortcut, then scrolling down to find your new one. if there is an ovelap, consider changing one of them.
Does JupyterLab support a functionality to jump to previously selected or active cell?
Use case #1: sometimes I accidentally hit "Home" or "End" while in Command mode (thinking that I am in Editing mode) and I jump to the very top of my notebook. Then I need to find the place where I was doing the editing.
Use case #2: Sometimes its convenient to do the above on purpose. Jump to the bottom, run a side calculation and then come back to the previously active cell to continue my main line coding.
It would also be nice to assign a shortcut to this command if it exists. I've looked through this github thread, but have not found an appropriate command.
I want to close the currently foreground file (tab) without closing the other items in this pane (the settings window, other open file)
ctrl-w is bound to pane:close this does not do what i want.
ctrl-shift-t is bound to pane:reopen-closed-item this does the opposite of what I want, but I cannot find the inverse of this
I want a keyboard shortcut equivalent to clicking the small x on the tab.
I have searched quite a bit, and cannot find a package or keybinding that provides this.
by a little search I found this discussion inside of atom forum which says:
If you search in Settings > Keybindings for “pane” you’ll find that ⌘K⌘W is mapped to pane:close. You can either use that mapping or a new one of your own devising to map to pane:close.
this is the link https://discuss.atom.io/t/close-pane-keyboard-shortcut/5701
** ---- update ---- **
I downloaded and installed the atom on my windows and saw the ctrl-w works pretty ok so I looked at the settings and saw it set to core:close command
Anyone know how to set Notepad++ as default text editor for SAS, Stata and R?
I'm having the hardest time finding anything online (particularly for SAS). Looking for ability to run code from Notepad++ as well as setup color coding.
Thanks.
Why not just go the GUI route: right click, e.g., any foo.R file and select "Open with...", then pick Np++ and click the "always open this file type.." button. Rinse, lather, repeat.
BTW, for R, if you don't already have it, get "NppToR" , a little app which lets you execute code directly from the Npp window.
On windows you can either:
manually edit the keys for the file type to set the value of HKEY_CLASSES_ROOT\FILE_TYPE\shell\edit\command where FILE_TYPE is the appropriate one for each of the files extensions you wish to change this is quite hard work or
you can use a program that does it for you such as the free Default Programs Editor
In either case the first thing to do is to back up the registry.
I would seriously suggest looking into using one of the many, some free IDEs as they will automatically include the run from edit environment, syntax highlighting, code completion and, in many cases, debugging as well.
Notepad++ is my favorite editor and I was in the same shoes as you are now.
I am assuming that you are in Windows (Notepad ++ doesn't exist in Mac, saddest thing for me)
Please follow the steps mentioned in the below webpage and do as the author says.
http://hafniumcity.com/notepad_color.php
Now for in-line editing , it may be not be the best choice for SAS. Although I haven't tried it much so not a good person to comment on it.
I'm stuck with a bit of an Xcode puzzle: how can I find and replace either in a selection I've made, or at least just in a single file?
According to the following topic there's a way to hold down the option key and Replace All should change to Replace in Selection:
How can I find and replace inside a selection in Xcode?
This either doesn't happen in Xcode 4.5, or I don't know how to do it. Right now I can bring up the find/replace option in the search navigator on the left, then hit return to search, or hit preview to bring up which files are to be changed.
As a workaround, I can search in a selected group (by right-clicking on a group in the file navigator), but being able to replace in a selection I've made, and in a single file would be extremely helpful.
Thanks in advance ;-)
In Xcode 4.6 (I don't have 4.5 on my system any more to check it), if you are in the editor window and press Cmd-F to bring up the Find view at the top of the editor (as opposed to the global search inspector you are referring to), and use the Replace option in it, holding down the Option key changes "Replace All" to "In Selection". This seems reasonable since the global search inspector is across multiple files while the option to choose "In Selection" really only makes sense when you are referring to a single file.