change nvimr to ironrepl because its more stable.

This commit is contained in:
hollorol 2024-08-14 11:32:02 +02:00
parent e5970bbea4
commit 1cc3527bb4
2 changed files with 24 additions and 4 deletions

View File

@ -22,7 +22,7 @@ return {
},
-- How the repl window will be displayed
-- See below for more information
repl_open_cmd = require('iron.view').split.below(80),
repl_open_cmd = 'belowright 20split' --require('iron.view').split.below(80),
},
-- Iron doesn't set keymaps by default anymore.
-- You can set them here or manually add keymaps to the functions in iron.core

View File

@ -23,11 +23,29 @@ vim.api.nvim_create_autocmd({"BufNewFile", "BufRead"}, {
command = "set filetype=r"
})
local function IronQuiteSend(opts)
-- Get the current filetype to send to the appropriate REPL
local ft = vim.bo.filetype
-- Concatenate all arguments passed to the command
local command = table.concat(opts.fargs, " ")
-- Send the command to the REPL
require('iron.core').send(ft, command)
end
-- Create the primary command in Neovim
vim.api.nvim_create_user_command('IronQuiteSend', IronQuiteSend, {
nargs = '+', -- Allows for multiple arguments
})
-- Map <C-c>wd to send devtools::document command in R
vim.api.nvim_create_autocmd("FileType", {
pattern = "r",
callback = function()
vim.api.nvim_set_keymap('n', '<C-c>wd', ':RSend devtools::document("' .. DevtoolsPath() .. '")<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<C-c>wd', ':IronQuiteSend devtools::document("' .. DevtoolsPath() .. '")<CR>', { noremap = true, silent = true })
end
})
@ -35,14 +53,16 @@ vim.api.nvim_create_autocmd("FileType", {
vim.api.nvim_create_autocmd("FileType", {
pattern = "r",
callback = function()
vim.api.nvim_set_keymap('n', '<C-c>wi', ':RSend devtools::install("' .. DevtoolsPath() .. '", quick = TRUE, keepSource=TRUE, upgrade = "never")<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<C-c>wi', ':IronQuiteSend devtools::install("' .. DevtoolsPath() .. '", upgrade = "never")<CR>', { noremap = true, silent = true })
end
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "r",
callback = function()
vim.api.nvim_set_keymap('n', '<C-c>i', ':RSend install.packages("")<Left><Left>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<C-c>i', ':IronQuiteSend install.packages("")<Left><Left>', { noremap = true, silent = true })
end
})