A
A
Artem Lipatov2015-02-03 11:55:42
Sublime Text
Artem Lipatov, 2015-02-03 11:55:42

How to add a semicolon to the end of a line?

How can I set up hotkeys to add a semicolon to the end of a line without moving the cursor from the current position?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Taratin, 2015-02-03
@Rendalf

sublimetext.info/docs/en/extensibility/macros.html
Google
https://www.google.ru/webhp?sourceid=chrome-instan...

A
Alexander Ruchkin, 2015-02-03
@VoidEx

For example, write a plugin by adding User.py to the Plugins/User folder. Add a class there

class AppendSemicolon(sublime_plugin.TextCommand):
  def run(self, edit):
    for s in self.view.sel(): # пройтись по всем селекциям
      ins = self.view.line(s) # находим регион, соответствующий текущей строке
      self.view.insert(edit, ins.b, ";") # вставляем в конце точку с запятой

Then add User.sublime-keymap:
[
  { "keys": ["ваш биндинг"], "command": "append_semicolon" }
]

I wrote the code right here, I did not check it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question