First time here? Check out the FAQ!

Revision history  [back]

Well, "they are not in any of my scripts files" is not quite accurate. It wasn't in my version 6 scripts, and it wasn't in my version 5 scripts, but it was in my version 4 scripts!. I have always carried my preferences file over from version to version, so yes, I once had these defined and therefore was able to bind keys to them, so they were left in my preferences file.

I guess I'm wrong about having used this often in Wing, at least not for a very long time. My guess is that instead of trying to use these, I just used select-scope, then forward-character or backward-character to enter a different definition.

The way I had implemented long ago  was contorted and used internal calls that may even exist anymore. Simple definitions that more or less do what I want are:

def backward_definition():
  """ Move backward to the def or class prior to current line"""
  ed = wingapi.gApplication.GetActiveEditor()
  ed.ExecuteCommand('previous_scope')
  ed.ExecuteCommand('backward-char')           # clear selection

def forward_definition():
  """ Move forward to the def or class following the current line"""
  ed = wingapi.gApplication.GetActiveEditor()
  ed.ExecuteCommand('next_scope')
  ed.ExecuteCommand('backward-char')           # clear selection

Is there a cleaner way to clear the selection than just using backward-char?

Well, "they are not in any of my scripts files" is not quite accurate. It wasn't in my version 6 scripts, and it wasn't in my version 5 scripts, but it was in my version 4 scripts!. I have always carried my preferences file over from version to version, so yes, I once had these defined and therefore was able to bind keys to them, so they were left in my preferences file.

I file.I guess I'm wrong about having used this often in Wing, at least not for a very long time. My guess is that instead of trying to use these, I just used select-scope, then forward-character or backward-character to enter a different definition.

The definition.The way I had implemented long ago  was contorted and used internal calls that may even exist anymore. Simple definitions that more or less do what I want are:

def backward_definition():
  """ Move backward to the def or class prior to current line"""
  ed = wingapi.gApplication.GetActiveEditor()
  ed.ExecuteCommand('previous_scope')
  ed.ExecuteCommand('backward-char')           # clear selection

def forward_definition():
  """ Move forward to the def or class following the current line"""
  ed = wingapi.gApplication.GetActiveEditor()
  ed.ExecuteCommand('next_scope')
  ed.ExecuteCommand('backward-char')           # clear selection

Is there a cleaner way to clear the selection than just using backward-char?

Well, "they are not in any of my scripts files" is not quite accurate. It wasn't in my version 6 scripts, and it wasn't in my version 5 scripts, but it was in my version 4 scripts!. I have always carried my preferences file over from version to version, so yes, I once had these defined and therefore was able to bind keys to them, so they were left in my preferences file.I guess I'm wrong about having used this often in Wing, at least not for a very long time. My guess is that instead of trying to use these, I just used select-scope, then forward-character or backward-character to enter a different definition.The way I had implemented long ago  was contorted and used internal calls that may even exist anymore. Simple definitions that more or less do what I want are:are: def backward_definition(): """ Move backward to the def or class prior to current line""" ed = wingapi.gApplication.GetActiveEditor() ed.ExecuteCommand('previous_scope') ed.ExecuteCommand('backward-char') # clear selection

def backward_definition():

def forward_definition(): """ Move backward forward to the def or class prior to following the current line""" ed = wingapi.gApplication.GetActiveEditor() ed.ExecuteCommand('previous_scope') ed.ExecuteCommand('next_scope') ed.ExecuteCommand('backward-char') # clear selection def forward_definition(): """ Move forward to the def or class following the current line""" ed = wingapi.gApplication.GetActiveEditor() ed.ExecuteCommand('next_scope') ed.ExecuteCommand('backward-char') # clear selection

​ Is there a cleaner way to clear the selection than just using backward-char?