Atom soft undo (like Sublime)


#1

Hi everyone,

I just wanted to ask if it is possible to get “Soft undo” functionality in Atom (maybe via some plugin) the way it works in Sublime.

In Sublime pressing super+U works the same way as super+Z but will also undo cursor movements, text selections, jump to definitions, etc. Basically all things that super+Z doesn’t undo.

PS
Also, is there any way to make ESC unselect current selection?

Thanks!


#2

Core Atom doesn’t have this functionality and I saw this was brought up somewhat recently here:

And a quick package search didn’t turn up anything so it looks like this isn’t possible at the moment.

Do you mean the equivalent of just clicking somewhere after making a selection so nothing is selected anymore?


#3

Thanks for your reply!

It does seem like this feature is not available atm. If I got enough time - I’ll probably try creating my own package for this.

Yep, thats what I mean.


#4

Thanks for confirming - I think that should be possible by adding some code to your init file along with mapping Escape in your keymap file? I haven’t played with something like this much yet but I gave it a try and I have a start at least I think (it only works for single selections).

In my init script:

atom.commands.add 'atom-text-editor', 'user:esc-selection', ->
  return unless editor = atom.workspace.getActiveTextEditor()
  selections = editor.getSelections()

  if selections.length == 1
    selections[0].clear()

And in my keymap.cson file:

'atom-text-editor':
  'escape': 'user:esc-selection'

Hopefully someone with more experience will chime in if I did anything way off :vulcan: