Git Product home page Git Product logo

Comments (9)

jalvesaq avatar jalvesaq commented on August 18, 2024 2

Thanks for the feedback, @matchbook-o! I will let @PMassicotte close the issue if he doesn't want to investigate it further.

from r.nvim.

matchbook-o avatar matchbook-o commented on August 18, 2024 1

@PMassicotte : I have figured out the issue.

In order for treesitter to work, I had to install the nodejs dependency. Once I had that I had to run :TSInstall r.

Now everything works using R.nvim!

I will close the issue, thanks for taking a look.

from r.nvim.

PMassicotte avatar PMassicotte commented on August 18, 2024

What do you mean with \d or \l?

from r.nvim.

jalvesaq avatar jalvesaq commented on August 18, 2024

@PMassicotte, <LocalLeader>d is the default key binding to send the current line and go to the next line, and <LocalLeader>l is the default key binding to send the current line and stay put.

I can't replicate the reported issue. I can send new lines with no need to save the file. However, looking at line 95 of lua/r/send.lua it's clear that the bug is related with treesitter. I even get a warning that "need check nil":

image

@matchbook-o, do you have nvim-treesitter installed?

from r.nvim.

PMassicotte avatar PMassicotte commented on August 18, 2024

Maybe we could use this:

R.nvim/lua/r/send.lua

Lines 694 to 700 in 4d7a966

local has_treesitter, _ = pcall(require, "nvim-treesitter")
if not has_treesitter then
vim.notify(
"nvim-treesitter is not available. Please install it to use this feature."
)
return
end

from r.nvim.

PMassicotte avatar PMassicotte commented on August 18, 2024

But I wonder why it works before adding new lines

from r.nvim.

matchbook-o avatar matchbook-o commented on August 18, 2024

@jalvesaq : I do have treesitter installed.

For more info: I didn't have this issue until I had to reinstall Fedora 39 on my machine (but I am unsure this is related)

Edit: if it helps, I can post my init file. Let me know!

from r.nvim.

matchbook-o avatar matchbook-o commented on August 18, 2024

This is my init file:

(EDIT: I still get this issue with a bare-bones init file)

" General Settings
set number
set clipboard=unnamedplus
set autoindent
syntax enable

" Plugin Management
call plug#begin('~/.vim/plugged')
Plug 'R-nvim/R.nvim'
Plug 'R-nvim/cmp-r'
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
Plug 'nvim-treesitter/nvim-treesitter'
" For vsnip users.
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
call plug#end()

" CMP Setup
lua <<EOF
  -- Set up nvim-cmp.
  local cmp = require'cmp'

  cmp.setup({
    snippet = {
      -- REQUIRED - you must specify a snippet engine
      expand = function(args)
        vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
        -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
        -- require('snippy').expand_snippet(args.body) -- For `snippy` users.
        -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
        -- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
      end,
    },
    window = {
      -- completion = cmp.config.window.bordered(),
      -- documentation = cmp.config.window.bordered(),
    },
    mapping = cmp.mapping.preset.insert({
      ['<C-b>'] = cmp.mapping.scroll_docs(-4),
      ['<C-f>'] = cmp.mapping.scroll_docs(4),
      ['<C-Space>'] = cmp.mapping.complete(),
      ['<C-e>'] = cmp.mapping.abort(),
      ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
    }),
    sources = cmp.config.sources({
      { name = 'nvim_lsp' },
      { name = 'vsnip' }, -- For vsnip users.
      -- { name = 'luasnip' }, -- For luasnip users.
      -- { name = 'ultisnips' }, -- For ultisnips users.
      -- { name = 'snippy' }, -- For snippy users.
    }, {
      { name = 'buffer' },
    })
  })

  -- Set configuration for specific filetype.
  cmp.setup.filetype('gitcommit', {
    sources = cmp.config.sources({
      { name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
    }, {
      { name = 'buffer' },
    })
  })

  -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
  cmp.setup.cmdline({ '/', '?' }, {
    mapping = cmp.mapping.preset.cmdline(),
    sources = {
      { name = 'buffer' }
    }
  })

  -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
  cmp.setup.cmdline(':', {
    mapping = cmp.mapping.preset.cmdline(),
    sources = cmp.config.sources({
      { name = 'path' }
    }, {
      { name = 'cmdline' }
    }),
    matching = { disallow_symbol_nonprefix_matching = false }
  })

  -- Set up lspconfig.
  local capabilities = require('cmp_nvim_lsp').default_capabilities()
  -- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
  require('lspconfig')['r_language_server'].setup {
    capabilities = capabilities
  }
EOF

" LaTeX Compilation
"au FileType tex nmap <leader>ll <Plug>Tex_Compile
"au FileType tex nmap <leader>lv <Plug>Tex_View

" Text Wrapping "
:set linebreak

" Appearance
set background=dark 

" Line Numbers & Indentation
set backspace=indent,eol,start
set ma
set expandtab
set smarttab
set autoindent
set si
set wrap

" Search
set ignorecase
set smartcase
set hlsearch
set incsearch
set magic

" Brackets
set showmatch
set mat=2

" Errors
set noerrorbells

" Color & Fonts
set encoding=utf8
if $COLORTERM == 'gnome-terminal'
    set t_Co=256
endif

from r.nvim.

matchbook-o avatar matchbook-o commented on August 18, 2024

@jalvesaq : I have managed to fix this issue by using your NvimR plug in (the old one) instead of this new one. Everything there works fine with the init file above.

Feel free to close this ticket, although I hope the bug report has some value.

from r.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.