R-nvim / R.nvim

Neovim plugin to edit R files
GNU General Public License v3.0
128 stars 15 forks source link

How to configure R console to always open in the bottom taking height of 20 #137

Closed h3ndry closed 1 month ago

h3ndry commented 1 month ago

I would like to configure the r window to always open in bottom... Please help me

PMassicotte commented 1 month ago

What have you tried?

Have you looked at

:h objbr_place
jalvesaq commented 1 month ago

Please, read section 6.15 (Control of R window) from R.nvim documentation. And, please, reopen the issue if something is not working according to the documentation.

h3ndry commented 1 month ago

Thank you. That help, I should have started by reading the manual instead of googling

h3ndry commented 1 month ago

I don't know what I am doing wrong

      -- min_editor_width = 72,
      -- rconsole_width = 78,
      objbr_place = 'console,bottom',
      disable_cmds = {
        'RClearConsole',
        'RCustomStart',
        'RSPlot',
        'RSaveClose',
      },
    }
    -- Check if the environment variable "R_AUTO_START" exists.
    -- If using fish shell, you could put in your config.fish:
    -- alias r "R_AUTO_START=true nvim"
    if vim.env.R_AUTO_START == 'true' then
      opts.auto_start = 1
      opts.objbr_auto_start = true
    end

    -- objbr_place = 'script,right'
    -- objbr_place = 'console,left'
jalvesaq commented 1 month ago

Try this:

                rconsole_width = 0,
                rconsole_height = 20,

This is what I infer from the documentation. If it works, the documentation should be improved, and a pull request for this would be welcome.

h3ndry commented 1 month ago

Thank you this config work

return {
  'R-nvim/R.nvim',
  lazy = false,
  opts = {
    R_args = { '--quiet', '--no-save' },
    hook = {
      on_filetype = function()
        vim.api.nvim_buf_set_keymap(0, 'n', '<Enter>', '<Plug>RDSendLine', {})
        vim.api.nvim_buf_set_keymap(0, 'v', '<Enter>', '<Plug>RSendSelection', {})
      end,
    },
    rconsole_width = 0,
    rconsole_height = 15,
    disable_cmds = {
      'RClearConsole',
      'RCustomStart',
      'RSPlot',
      'RSaveClose',
    },
  },
}

I will create a merger create improve docs... just don't know how to word it at the moment