mirror of
https://github.com/dwinkler1/nvimConfig.git
synced 2026-08-22 17:43:13 -04:00
- lua/keymap/repl.lua
- Replace non-existent `:SlimeSendCurrentLine` with synchronous
`vim.fn["slime#send"](line .. "\n")` fallback.
- Support both modern `r.send` and older `r.run` R.nvim Lua APIs,
falling back to `<Plug>` mappings if neither module is available.
- lua/nix_smart_send.lua
- Refactor `send_repl()` to extract Tree-sitter node text and send it
directly via `slime#send`, eliminating the `feedkeys(..., "x", true)`
race between visual selection and cursor movement.
- Replace internal `slime#send_op` call in `slime_send_region()` with the
public `<Plug>SlimeRegionSend` mapping.
- Improve `move_to_next_non_empty_line()` to walk up the AST when a
node has no next sibling, so the cursor escapes nested blocks.
- plugin/03_terminal.lua
- Set `vim.g.slime_target = "neovim"` at the top of the module so the
target is guaranteed before any slime send.
- plugin/21_datascience.lua
- Remove duplicate `vim.g.slime_target = "neovim"` now that the
terminal module owns the setting.
120 lines
3.1 KiB
Lua
120 lines
3.1 KiB
Lua
local now = MiniDeps.now
|
|
local now_if_args = Config.now_if_args
|
|
local later = MiniDeps.later
|
|
local add = Config.add
|
|
local nix = require('config.nix')
|
|
|
|
if not Config.isNixCats then
|
|
local add = MiniDeps.add
|
|
|
|
now(function()
|
|
add({ source = "R-nvim/R.nvim" })
|
|
end)
|
|
|
|
now_if_args(function()
|
|
add({ source = "jmbuhr/otter.nvim" })
|
|
end)
|
|
|
|
later(function()
|
|
add({ source = "jpalardy/vim-slime" })
|
|
end)
|
|
end
|
|
|
|
-- terminal
|
|
later(function()
|
|
vim.g.slime_no_mappings = true
|
|
add("vim-slime")
|
|
vim.g.slime_cell_delimiter = vim.g.slime_cell_delimiter or "# %%"
|
|
vim.g.slime_bracketed_paste = Config.opt_bracket
|
|
vim.g.slime_input_pid = false
|
|
vim.g.slime_suggest_default = true
|
|
vim.g.slime_menu_config = false
|
|
vim.g.slime_neovim_ignore_unlisted = false
|
|
|
|
-- Define standard slime mappings
|
|
vim.keymap.set("v", "<CR>", "<Plug>SlimeRegionSend", { noremap = true })
|
|
vim.keymap.set("v", "<localleader><localleader>", "<Plug>SlimeRegionSend", { noremap = true })
|
|
vim.keymap.set("n", "<localleader><localleader>", "<Plug>SlimeLineSend", { noremap = true })
|
|
-- Standardize on C-c C-c as well (common convention)
|
|
vim.keymap.set("v", "<C-c><C-c>", "<Plug>SlimeRegionSend", { noremap = true })
|
|
vim.keymap.set("n", "<C-c><C-c>", "<Plug>SlimeParagraphSend", { noremap = true })
|
|
end)
|
|
|
|
-- r
|
|
now(function()
|
|
if nix.get_cat("r", false) then
|
|
vim.g.rout_follow_colorscheme = true
|
|
require("r").setup({
|
|
-- Create a table with the options to be passed to setup()
|
|
R_args = { "--quiet", "--no-save" },
|
|
auto_start = "no",
|
|
objbr_auto_start = false,
|
|
objbr_place = 'console,below',
|
|
rconsole_width = 120,
|
|
min_editor_width = 80,
|
|
rconsole_height = 20,
|
|
nvimpager = "split_h",
|
|
pdfviewer = "",
|
|
-- Use R.nvim's built-in rnvimserver-backed language server. Do not
|
|
-- configure the external R languageserver through plugin/25_lsp.lua.
|
|
r_ls = {
|
|
completion = true,
|
|
hover = true,
|
|
signature = true,
|
|
definition = true,
|
|
references = true,
|
|
implementation = true,
|
|
document_symbol = true,
|
|
workspace_symbol = true,
|
|
document_highlight = true,
|
|
rename = true,
|
|
},
|
|
})
|
|
end
|
|
end)
|
|
|
|
|
|
-- Quarto
|
|
now(function()
|
|
if nix.get_cat({ "r", "markdown" }, false) then
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
pattern = { "quarto" },
|
|
callback = function()
|
|
require("otter").activate()
|
|
end,
|
|
})
|
|
|
|
require("otter").setup({
|
|
lsp = {
|
|
diagnostic_update_events = { "BufWritePost", "InsertLeave" },
|
|
},
|
|
buffers = {
|
|
set_filetype = true,
|
|
write_to_disk = true,
|
|
},
|
|
})
|
|
end
|
|
end)
|
|
|
|
later(function()
|
|
if nix.get_cat({ "r", "markdown" }, false) then
|
|
require("quarto").setup({
|
|
lspFeatures = {
|
|
enabled = true,
|
|
chunks = "curly",
|
|
languages = { "r", "python", "julia" },
|
|
diagnostics = {
|
|
enabled = true,
|
|
triggers = { "BufWritePost" },
|
|
},
|
|
completion = {
|
|
enabled = true,
|
|
},
|
|
},
|
|
codeRunner = {
|
|
enabled = true,
|
|
default_method = "slime",
|
|
},
|
|
})
|
|
end
|
|
end)
|