R-nvim / R.nvim

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

Code optimization #56

Closed jalvesaq closed 4 months ago

jalvesaq commented 4 months ago

Replace utils.get_current_line() with vim.api.nvim_get_current_line() Replace vim.api.nvim_win_get_buf(0) with vim.api.nvim_get_current_buf() Replace vim.fn.line(".") with vim.api.nvim_win_get_cursor() Replace vim.fn.line("symbol") with vim.api.nvim_buf_get_mark() Replace vim.fn.line("$") with utils.get_last_line_num() Replace vim.fn.bufloaded() with vim.api.nvim_list_bufs() + vim.api.nvim_buf_get_name()

jalvesaq commented 4 months ago

These changes use more vim.api functions and fix some lua_ls warnings. The command to send Vim motions is not working, but I have not tested it before, and it's something that I have never used. We already have many different commands to send code to R.

jalvesaq commented 4 months ago

We still have many vim.fn functions, but they work without warnings. So, I don't plan to replace them.

PMassicotte commented 4 months ago

I spent the last hour using this commit while working on a project, and so far so good! I looked at the proposed changes and is it pretty good. Good job!

jalvesaq commented 4 months ago

Thank you!.