Skip to content

Instantly share code, notes, and snippets.

@nocd5
Created June 24, 2015 12:49
Show Gist options
  • Save nocd5/2f2e99f32785482f4589 to your computer and use it in GitHub Desktop.
Save nocd5/2f2e99f32785482f4589 to your computer and use it in GitHub Desktop.
ptしてpecoってvimるnyagosのlua
nyagos.alias.ppt = function(args)
local sel = nyagos.eval('pt /column ' .. table.concat(args, ' ') .. '| peco')
if (#sel == 0) then
return
end
local file, line, column = sel:match('(.*):(%d+):(%d+)')
if ((file and line and column) == nil) then
print("Error : Invalid format")
print(" -> " .. sel)
return
end
nyagos.exec('gvim.exe ' .. file .. ' +' .. line ..
' -c \":normal 0\"' .. ' -c \":normal ' .. tonumber(column) - 1 .. 'l\" &')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment