mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
refactor: r
This commit is contained in:
parent
4f1b02ea02
commit
c73fa99786
1 changed files with 7 additions and 17 deletions
|
|
@ -16,16 +16,11 @@ return {
|
||||||
-- This function will be called at the FileType event
|
-- This function will be called at the FileType event
|
||||||
-- of files supported by R.nvim. This is an
|
-- of files supported by R.nvim. This is an
|
||||||
-- opportunity to create mappings local to buffers.
|
-- opportunity to create mappings local to buffers.
|
||||||
vim.api.nvim_buf_set_keymap(0, "n", "<Enter>", "<Plug>RDSendLine", {})
|
vim.keymap.set("n", "<Enter>", "<Plug>RDSendLine", { buffer = true })
|
||||||
vim.api.nvim_buf_set_keymap(0, "v", "<Enter>", "<Plug>RSendSelection", {})
|
vim.keymap.set("v", "<Enter>", "<Plug>RSendSelection", { buffer = true })
|
||||||
|
|
||||||
-- Increase the width of which-key to handle the longer r-nvim descriptions
|
-- Increase the width of which-key to handle the longer r-nvim descriptions
|
||||||
local wk = require("which-key")
|
local wk = require("which-key")
|
||||||
wk.setup({
|
|
||||||
layout = {
|
|
||||||
width = { min = 20, max = 100 }, -- min and max width of the columns
|
|
||||||
},
|
|
||||||
})
|
|
||||||
-- Workaround from https://github.com/folke/which-key.nvim/issues/514#issuecomment-1987286901
|
-- Workaround from https://github.com/folke/which-key.nvim/issues/514#issuecomment-1987286901
|
||||||
wk.register({
|
wk.register({
|
||||||
["<localleader>"] = {
|
["<localleader>"] = {
|
||||||
|
|
@ -44,20 +39,15 @@ return {
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
pdfviewer = (function()
|
|
||||||
if vim.loop.os_uname().sysname:find("Windows", 1, true) then
|
|
||||||
return "open" -- according to @Aman9das on Github
|
|
||||||
elseif vim.loop.os_uname().sysname:find("Darwin", 1, true) then
|
|
||||||
return "open"
|
|
||||||
else
|
|
||||||
return "xdg-open" -- according to @Aman9das on Github
|
|
||||||
end
|
|
||||||
end)(),
|
|
||||||
},
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("r").setup(opts)
|
||||||
|
require("r.pdf.generic").open = vim.ui.open
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
dependencies = { "R-nvim/cmp-r" },
|
optional = true,
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
opts.sources = opts.sources or {}
|
opts.sources = opts.sources or {}
|
||||||
table.insert(opts.sources, { name = "cmp_r" })
|
table.insert(opts.sources, { name = "cmp_r" })
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue