jalvesaq / Nvim-R

Vim plugin to work with R
GNU General Public License v2.0
968 stars 125 forks source link

add elvish support #750

Closed WERDXZ closed 1 year ago

WERDXZ commented 1 year ago

I'm using elvish as shell and trying to use tmux for split r cli, but its not working, so I made a little change( its not that elegant i think)

jalvesaq commented 1 year ago

I use fish shell, but this isn't relevant because I interact with R and not with the shell in the external terminal. Why can't you use sh as your shell in the external terminal?

WERDXZ commented 1 year ago

i think although /bin/sh interpret everything in bash but when you pass a command as a param to tmux it is interpreted as your default shell, in my case, the default shell is set as elvish in my environment variable, and it is giving the error:

Deprecation: the legacy temporary assignment syntax is deprecated; use "tmp" instead
  code from -c:1:1: TERM=screen-256color NVIMR_TMPDIR=/var/folders/qy/3l36x60n2zs1kw421gd3_2r00000gn/T/Nvim-R-werdxz NVIMR_COMPLDIR=/Users/werdxz/.cache/Nvim-R NVIMR_ID=3693838044 NVIMR_SECRET=2372643042 NVIMR_PORT=10101 R_DEFAULT_PACKAGES=datasets,utils,grDevices,graphics,stats,methods,nvimcom R

:) thank you very much

jalvesaq commented 1 year ago

Could you try adding this to R/external_term.sh?

        if executable('/usr/bin/sh')
            let cnflines += ['set-option -g default-shell "/usr/bin/sh"']
        endif
WERDXZ commented 1 year ago
if executable('/bin/sh')
      let cnflines += ['set-option -g default-shell "/bin/sh"']
endif

I added this to the R/external_term.vim and it is working now. It is definitely a better to do the things above. thank you!

jalvesaq commented 1 year ago

Thank your for reporting the issue and for the feedback! The problem is fixed now.

WERDXZ commented 1 year ago

In elvish we use ; instead of && So in the script R/external_term.vim replace 125~130 with

    let send = "tmux -L NvimR paste-buffer -t " . g:rplugin.tmuxsname . '.' . TmuxOption("pane-base-index", "window")
    if a:0 == 2 && a:2 == 0
        let scmd = "tmux -L NvimR set-buffer '" . str . "'"
    else
        let scmd = "tmux -L NvimR set-buffer '" . str . "\<CR>'"
    endif
    let rlog = system(scmd) . system(send)

and in R/tmux_split.vim 101~106:

    let send = "tmux paste-buffer -t " . g:rplugin.rconsole_pane
    if a:0 == 2 && a:2 == 0
        let scmd = "tmux set-buffer '" . str . "'"
    else
        let scmd = "tmux set-buffer '" . str . "\<CR>'"
    endif
    let rlog = system(scmd) . system(send)
jalvesaq commented 1 year ago

Thanks! I made the changes since they work with sh too.