r - Rstudio up arrow key does not display the last run command on console - Stack Overflow

admin2025-05-01  0

Sorry if this is a duplicate question: Since updating Rstudio, pressing the up arrow key while the cursor is in the console no longer returns the last run command. Sometimes it does, but most of the time it does not. Is there a way to revert to the previous behaviour? I have to keep pressing ctrl + up_key and its not efficient as the cursor goes back to the start of the previous command instead of the end etc quite literally cumbersome

sessioninfo::platform_info()

 setting  value
 version  R version 4.4.2 (2024-10-31 ucrt)
 os       Windows 11 x64 (build 22631)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  English_United States.utf8
 ctype    C
 tz       America/Los_Angeles
 date     2025-01-02
 rstudio  2024.12.0+467 Kousa Dogwood (desktop)

Sorry if this is a duplicate question: Since updating Rstudio, pressing the up arrow key while the cursor is in the console no longer returns the last run command. Sometimes it does, but most of the time it does not. Is there a way to revert to the previous behaviour? I have to keep pressing ctrl + up_key and its not efficient as the cursor goes back to the start of the previous command instead of the end etc quite literally cumbersome

sessioninfo::platform_info()

 setting  value
 version  R version 4.4.2 (2024-10-31 ucrt)
 os       Windows 11 x64 (build 22631)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  English_United States.utf8
 ctype    C
 tz       America/Los_Angeles
 date     2025-01-02
 rstudio  2024.12.0+467 Kousa Dogwood (desktop)
Share Improve this question edited Apr 20 at 10:27 Waldi 41.5k6 gold badges36 silver badges89 bronze badges asked Jan 2 at 20:02 OnyambuOnyambu 79.6k3 gold badges28 silver badges63 bronze badges 6
  • 1 FWIW, I found this related issue (which should be fixed for your build, though). – I_O Commented Jan 3 at 8:31
  • This is happening to me, too on RStudio 2024.12.0 Build 467. The "up" brings up a somewhat old command. Then, later, after executing several commands, the "up" brings up a long set of about 5 previous commands all at once. – Arthur Commented Mar 31 at 13:02
  • @Arthur you need to get a different(latest) version of Rstudio. Just download the +563 version. I believe it should be fixed in that version – Onyambu Commented Mar 31 at 16:26
  • I found this answer which might be useful. Also, this issue is related. – Tim G Commented Apr 18 at 12:17
  • @TimG that solution had been shown not to work. – Onyambu Commented Apr 19 at 14:07
 |  Show 1 more comment

1 Answer 1

Reset to default 0

This is a known bug (see RStudio issue #7945) introduced in 2024.12.0 (Build 467) where the Up/Down arrows no longer reliably walk your console history. It was fixed in the very next point release (2024.12.1+563 “Kousa Dogwood”), so the simplest way to get the old behavior back is to upgrade to RStudio with minimum version of 2024.12.1+563.

I would recommend you to install latest version: https://dailies.rstudio.com/version/2025.04.0+491.pro2/

Once you’re on that release the Up/Down arrows in the console will once again recall the last-executed commands as before.

Temporary keyboard‐shortcut workaround:

If you can’t upgrade right away, you can rebind the Up/Down arrows to history navigation:

  1. In RStudio go to Tools → Modify Keyboard Shortcuts.
  2. In the “Filter…” box type history.
  3. Find Console: Previous Console History and click its “Shortcut” field.
  4. Press the Up ↑ key; click Apply.
  5. Likewise bind Console: Next Console History to Down ↓.
  6. If that leaves your cursor‐motion commands unmapped, search for Console: Move Cursor Up and clear its Up shortcut (so it doesn’t conflict).

After that, plain Up/Down in the console will walk your history list again.

转载请注明原文地址:http://anycun.com/QandA/1746099199a91653.html