The vim binding duplicates the line and replaces all characters with a -
One way to do this in Sublime would be with this plugin:
import sublime
import sublime_plugin
class UnderlineCommand(sublime_plugin.TextCommand):
def run(self, edit):
for r in self.view.sel():
full_line = self.view.full_line(r)
line = self.view.line(r)
self.view.insert(edit, full_line.b, '-' * line.size() + '\n')
Place this code in a file named underline.py
in your Packages/User
directory (menu Preferences -> Browse Packages, then go into User
directory).
Then add this to your User keybindings (menu Preferences -> Key Bindings):
{ "keys": ["ctrl+u"], "command": "underline" },