Keybindings don't work until I've switched to the R terminal window and back #85
-
I have auto-start enabled so whenever I open a Quarto document or R script, I get the R terminal window as well. However, none of the R.nvim keybindings work until I've manually switched to the R window once and then back. Is this expected behavior or am I missing something? |
Beta Was this translation helpful? Give feedback.
Replies: 19 comments 7 replies
-
With lazy.nvim and lazy=false on Linux, the keybindings are immediately
available.
… |
Beta Was this translation helpful? Give feedback.
-
I'm using lazy too and do have return {
'R-nvim/R.nvim',
dependencies = {
{
'R-nvim/cmp-r',
config = function()
require('cmp_r').setup {
fun_data_1 = {
'select',
'rename',
'mutate',
'filter',
'relocate',
'summarise',
},
}
end,
},
},
lazy = false,
config = function()
local opts = {
auto_start = 'always',
active_window_warn = false,
}
require('r').setup(opts)
vim.g.rout_follow_colorscheme = true
-- Keybinding to view R tables using DT
local function show_table()
local node = vim.treesitter.get_node { ignore_injections = false }
local text = vim.treesitter.get_node_text(node, 0)
local cmd = [[call slime#send("DT::datatable(]] .. text .. [[)" . "\r")]]
vim.cmd(cmd)
end
vim.keymap.set('n', '<leader>dt', show_table, { desc = '[D]ata [T]able' })
-- Keybinding to insert pipe
vim.keymap.set('i', '<m-m>', ' |>')
end,
} This is my config for R.nvim. Is there something I'm doing wrong? |
Beta Was this translation helpful? Give feedback.
-
I replaced my config with yours, and it works as expected: the key bindings are immediately active. I don't have |
Beta Was this translation helpful? Give feedback.
-
I tried again with Slime uninstalled and still can't get it to work without switching over to the R window. I am guessing it must be something elsewhere in my config that's causing the issue then? |
Beta Was this translation helpful? Give feedback.
-
Update! The keybindings do work! They just don't show up with which-key until I've switched to the R window once. I have to hit
If I've switched to the R window once though, it actually brings up the which-key panel after I've pressed Is this the behaviour that you too are describing? |
Beta Was this translation helpful? Give feedback.
-
You have to press the next letter: |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I get the panel before starting R and immediately after starting R. No need to move the cursor. |
Beta Was this translation helpful? Give feedback.
-
I noted that |
Beta Was this translation helpful? Give feedback.
-
I am seeing similarly odd behaviour but that does not seem to be fixed by context switching: BTW @lokesh-krishna , thanks for this helpful bit: |
Beta Was this translation helpful? Give feedback.
-
@srearl I think you are using an old version. For example, there are only 3 keymaps for sending function: -- Function
create_maps("nvi", "RSendAllFun", "fa", "<Cmd>lua require('r.send').funs(0, true, false)")
create_maps("nvi", "RSendCurrentFun", "fc", "<Cmd>lua require('r.send').funs(0, false, false)")
create_maps("nvi", "RDSendCurrentFun", "fd", "<Cmd>lua require('r.send').funs(0, false, true)") |
Beta Was this translation helpful? Give feedback.
-
The link for the "new docs" refers to Nvim-R, not R.nvim. |
Beta Was this translation helpful? Give feedback.
-
@srearl please look at https://github.com/R-nvim/R.nvim#transitioning-from-nvim-r |
Beta Was this translation helpful? Give feedback.
-
The reference is wrong in the README! I will fix it. Thank you for reporting! |
Beta Was this translation helpful? Give feedback.
-
Somehow this has worsened to which-key panel not showing up even on context switching and the keybinds only working if I do them very rapidly. Would really appreciate any help in troubleshooting this. |
Beta Was this translation helpful? Give feedback.
-
What happens if you present the leader key before. This should do the trick. |
Beta Was this translation helpful? Give feedback.
-
That is a good question, I have noted that I needed to do it also. I will investigate and report if I find something. |
Beta Was this translation helpful? Give feedback.
-
Upgraded to which-key 3.5 and this issue seems to have fixed itself. Not sure how but keybinds now work right off the bat whenever I open a R file. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback! |
Beta Was this translation helpful? Give feedback.
What happens if you present the leader key before. This should do the trick.