Sublime Forum

Delete text :Towards right and text Towards left from cursor position to end of line

#1

I use php and codeigniter … a lot and some-times have to fix other people’s code…

like this
----------------------------------start-------------------------------------
$data[‘postal’] = $this->input->post(‘postal’);
$data[‘type’] = $this->input->post(‘type’);
$data[‘dob’] =$this->input->post(‘dob’);
$data[‘fname’] = $this->input->post(‘fname’);
-----------------------------------end-------------------------------------

it would be swell! if i could delete text after $data[‘postal’] = $this->input->post(’
And also bind this to a key. Any good key-bind suggestion as well.
Please help me with this

0 Likes

#2

This might be a good task for a macro. I use the Emacs Pro Essentials plugin so this was exceptionally easy, but I assume there’s a way to do it with the regular functions. What I did was:

  1. Record Macro
  2. Start Region (This is Ctrl-Space in Emacs – not sure what regular keybinds do for this)
  3. End of Line (This is Ctrl-e in Emacs – imagine you could just hit “End” in regular keys)
  4. Hit Kill (I did region-kill, but I suspect for your purposes just Delete would work)

I also added a down command so that it could traverse down and then you could just hit the macro over and over again, however that would only work in your case if your text were aligned in such a way as that would work. So you might not want to do that.

However, try out macros!

0 Likes

#3

Thanks mate ! sorry for the late reply … working …i would love if there was a emacs tutorial like plugin for sublime…
:cry: … i love to rewire my brain to emacs.

Any one reading this please make a emacs tutorial plugin for sublime … my karma points to ya … if you do

0 Likes

#4

Honestly, if you really want to get used to it, you might be best to just get Emacs and take a bath in it. It’s, to say the least, not terribly intuitive. However once you get used to it, it’s kind of nice in the same way Vi(m) is kinda nice. Youl don’t have to move your hands to navigate.

That being said, I don’t think there’s much reason to worry about it because everything else, Sublime (and others) do just as well – macros, tools, plugins, etc. There are keybinds for all these things and you can make it happen right now without a lot of pain.

0 Likes