0

I'm trying to start vim from command line and have it jump to a certain place in the file and run <c-c>g to trigger goto_definition in python-mode.

So far running vim filename "+call cursor(x, y)" does at least get me to the position I want, but now how do I run <c-c>g afterwards?

If I try vim % "+call cursor(x, y)" -c "normal! <c-c>g" I get a "not an editor command" error

CornSmith
  • 1,957
  • 1
  • 19
  • 35

1 Answers1

1

Try

vim FILENAME -c "call cursor(x, y)" -c "call pymode#rope#goto_definition()"

<c-c>g is actually bind to function pymode#rope#goto_definition(). You can look up in :map to see the mapping.

Refer to here if you're interested in why not an editor command error occured.

YLJ
  • 2,940
  • 2
  • 18
  • 29
  • Interestingly that still fails, but the logic is sound. It should work. The exact command that I ran is `:!gvim main.py -c "call cursor(41, 45)" -c "call pymode#rope#goto_definition()"` which spits out an error about parenthesis. I'm guessing that pymode isn't fully "warmed up" at the point that gets called – CornSmith May 28 '17 at 19:25
  • This is my exact error (wouldn't let me copy it out of gvim) https://i.imgur.com/L7q0RE8.png – CornSmith May 28 '17 at 19:29
  • Why do you add `:!` before gvim? Isn't it a normal terminal command instead of a vim command? Sorry, I'm not familiar with windows environment. Which version is your vim? – YLJ May 29 '17 at 08:58