Created
June 24, 2015 12:49
-
-
Save nocd5/2f2e99f32785482f4589 to your computer and use it in GitHub Desktop.
ptしてpecoってvimるnyagosのlua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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