Add a "group", as in "delGroupBefore"

I’m trying to be able to have groups that can each be deleted/treated independently, but can each contain multiple words. Is that possible to do with native CodeMirror code or do I have to implement that myself? I was thinking of using groups, or perhaps tokens, but I’m not sure how.

It’s unclear to me when a “group” (object?) is made. When I use “javascript” mode delGroupBefore seems to delete a whole line before the cursor, but when I use “text/html” mode delGroupBefore seems to delete just the part of the word that is before the cursor. I may be doing something wrong though. Edit: I must have been hallucinating. I’ve been testing again and in both ‘javascript’ mode and ‘text/html’ mode, the part of the word before the cursor is deleted. (Unless the cursor is after the last letter in the word, in which case, everything except the last letter is deleted, though I’m not sure why that is.)

Is it possible to manually trigger the creation of a group? Or manually trigger the creation of a new token (without having to create a mode)? Edit: In which case I guess I need to make my own code to delete tokens.

The “group” concept in these commands is not configurable. Modes can change which characters count as word characters, which influences the definition of group (which is a group of either word or non-word-non-whitespace characters) for that mode. (For example, in JavaScript, $ counts as a word characters, which it does not by default.)

You can implement custom commands that skip/delete blocks of your own definition. You’d first define a primitive that finds the end of the next block, and then define commands to move past or delete such blocks.

Just fyi for future folk, I ended up making my own mode. It took a bit to figure it out, but actually doing it is pretty simple:

CodeMirror.defineSimpleMode( 'someWord', {
    start:  [ {regex: someRegex, token: 'another-word'} ]
} );

and then:

var cmEditor = CodeMirror( parentNode, { mode: 'someWord' } );