Home Download Buy Blog Forum Support

Join lines without space (gJ in vim)

Join lines without space (gJ in vim)

Postby kentor on Tue Oct 22, 2013 1:41 am

Is this possible to implement this feature as a key mapping? In vim, if you type the command "gJ", it'll join the following line with the current one but without adding a space in between. It's similar to the J command but without the space.
kentor
 
Posts: 2
Joined: Mon Oct 21, 2013 9:41 pm

Re: Join lines without space (gJ in vim)

Postby skuroda on Wed Oct 23, 2013 3:56 am

Think the following macro could do what you want.

Code: Select all
[
   {
      "command": "move_to",
      "args":{"to": "eol", "extend": false}
   },
   {
      "command": "join_lines"
   },
   {
      "command": "left_delete"
   }
]


Save it as "<some_name>.sublime-macro" in Packages/User. Then for the key binding use something like the following

Code: Select all
[
    "keys": ["f10"],
    "command": "run_macro_file",
        "args": {"file": "res://Packages/User/macros/Join Without Space.sublime-macro"}
]


Of course, adjust the name and keys as you need to. In fact, you could probably use "context": [{"key": "setting.command_mode", "operand": true} for the context and ["g", "shift+j"] for the keys to follow the same binding in ST (assuming you have vintage enabled).
skuroda
 
Posts: 676
Joined: Fri Oct 05, 2012 8:11 am


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: No registered users and 5 guests