Skip to content

Commit

Permalink
patch for %SnipRun
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelb committed Apr 24, 2021
1 parent 2ddc9a2 commit edaea3c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/sniprun.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function M.configure_keymaps()
vim.cmd("function! ListInterpreters(A,L,P) \n let l = split(globpath('"..sniprun_path.."/doc/', '*.md'),'\\n') \n let rl = [] \n for e in l \n let rl += [split(e,'/')[-1][:-4]] \n endfor \n return rl \n endfunction")
vim.cmd("command! -nargs=* -complete=customlist,ListInterpreters SnipInfo :lua require'sniprun'.info(<q-args>)")

vim.cmd("function! SnipRunLauncher() range \n if a:firstline == a:lastline \n lua require'sniprun'.run() \n else \n lua require'sniprun'.run('v') \n endif \n endfunction")
vim.cmd("function! SnipRunLauncher() range \nif a:firstline == a:lastline \n lua require'sniprun'.run() \n elseif a:firstline == 1 && a:lastline == line(\"$\")\n lua require'sniprun'.run('w') \n else \n lua require'sniprun'.run('v') \n endif \n endfunction")
vim.cmd("command! -range SnipRun <line1>,<line2>call SnipRunLauncher()")


Expand Down Expand Up @@ -165,6 +165,9 @@ function M.get_range(mode)
if not mode then
line1 = vim.api.nvim_win_get_cursor(0)[1]
line2 = line1
elseif mode:match("[w]") then
line1 = 1
line2 = vim.fn.eval("line('$')")
elseif mode:match("[n]") then
line1 = vim.api.nvim_buf_get_mark(0, '[')[1]
line2 = vim.api.nvim_buf_get_mark(0, ']')[1]
Expand Down

0 comments on commit edaea3c

Please sign in to comment.