Skip to content

Commit

Permalink
Improve readability of viml function in lua (#5)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Tylor <alex@tylor.co.uk>
  • Loading branch information
shadmansaleh and terrortylor authored Mar 28, 2021
1 parent ae5cbfb commit 1c1668d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lua/nvim_comment.lua
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,13 @@ function M.setup(user_opts)

-- Messy, change with nvim_exec once merged
vim.api.nvim_command('let g:loaded_text_objects_plugin = 1')
--luacheck: ignore
local vim_func = "function! CommentOperator(type) abort \n let reg_save = @@\n execute \"lua require('nvim_comment').operator('\" . a:type. \"')\"\n let @@ = reg_save\n endfunction"
local vim_func = [[
function! CommentOperator(type) abort
let reg_save = @@
execute "lua require('nvim_comment').operator('" . a:type. "')"
let @@ = reg_save
endfunction
]]
vim.api.nvim_call_function("execute", {vim_func})
vim.api.nvim_command("command! -range CommentToggle lua require('nvim_comment').comment_toggle(<line1>, <line2>)")

Expand Down

0 comments on commit 1c1668d

Please sign in to comment.