Python icon indicating copy to clipboard operation
Python copied to clipboard

Delete whitespace intelligently or backspace by indentation, e.g. delete four spaces that function as 'a tab'

Open kenny-evitt opened this issue 9 years ago • 1 comments

See LightTable/LightTable#548 for the original issue. The original comment:

So currently, if I configure LT to insert spaces rather than tabs, what happens when I try to delete the spaces is that I have to delete the spaces one by one, rather than deleting them as tabs (delete 4 spaces at once in my case). Could LT intelligently detect when I want to delete a tab width of spaces?

kenny-evitt avatar Dec 06 '15 23:12 kenny-evitt

From LightTable/LightTable#548: Open to a pull request on Python plugin that does this. CodeMirror provides indentLine which provides a "subtract" to do this. The keybinding would need to be bound to backspace, scoped to just python files and map to a command that does something like the following (haven't tested it in a python file):

(let [ed (pool/last-active)]
      (.indentLine (editor/->cm-ed ed) (.-line (editor/cursor ed)) "subtract" true))

cldwalker avatar Dec 07 '15 00:12 cldwalker