Indentation with space in codemirror


#1

i want to use tab key to insert 4 spaces but all 4 spaces get deleted at once when i press backspaces.
and all four space behave like a tab key and when i insert four space somewhere they automatically behave like a tab key.


#2

That’s because tab actually inserts a tab. You can bind it to the insertSoftTab command to insert spaces instead.


#3

but when i use insertSoftTab and try to delete space all space gets removed one by one and i want that all four spaces gets removed at once. How can i do this???


#4

Ah, I see, that’s not a feature the core library has, but you could write your own code that does it (bind something to backspace that, if there’s spaces before the cursor, computes the next tab stop and deletes up to that).


#5

can you give me some idea how it’s code look like??