Moving and selecting by word, sentence, paragraph, etc.

Hi folks,

I’m as much of a newbie as it’s possible to be with Scrivener, having just starting playing with the software today. I have spent some time writing, though, and longstanding habits mean that straight away a question has popped up for me about enhancing the way I can move about within Scrivener.

Specifically: is there any way to move and select by sentence, screen, etc.?

Here’s what I mean (and why). A huge part of writing for me is re-writing. And a huge part of that is navigating through my text, word by word and sentence by sentence and paragraph by paragraph, shuffling things about. Sometimes I might re-write a given chunk of text 20 times or more before it’s finished, and all of that will have occurred while navigating piece by piece through the document.

The one thing that has kept me glued to Word since version 4 in 1990 or so is that I can – using only the keyboard – move or select or extend a selection a word at a time, a sentence at a time, a line at a time, a paragraph at a time, or a screen at a time. Even better, I don’t have to use the built-in shortcuts for these processes, which are all linked to the numeric keypad (miles off to the right); I can, instead, re-map them all to use modifier keys and a rectangular set of keys which sits directly under my right hand.

Yes, a subset of those functions already exists with modifier keys applied to the arrow keys. For example, in Cocoa apps I can move a word at a time with option-left-or-right-arrow, or a paragraph at a time with option-up-or-down-arrow, etc. These tricks also work with the arrow keys embedded in a non-num-locked numeric keypad. Unfortunately, nothing that is built-in seems to emulate Word’s movement and selection by sentence or screen. And, of course, it’s still all tied to the arrow keys and numeric keypad.

So something that would help me leap into Scrivener with open arms would be the capability of moving and selecting by sentence or screen, in addition to the OS-provided word and paragraph. Something that would help me leap into Scrivener with open arms while hollering from the hilltops would be the capability to assign all those moving and selecting functions to my own favourite keys so I don’t have to run over to the arrows or the numeric keypad whenever I want to edit something.

I’ve checked with Keith, and my understanding is that because Scrivener relies on the OS’s own text system, there isn’t much that can be done to add this sort of capability directly (short of writing a whole new text system, which seems mildly zany). But at his suggestion, I thought I’d post the question here as well, just in case someone out there might be able to recommend a route toward my text movement Holy Grail.

BTW, I’m already a user of Keyboard Maestro and ControllerMate, but at first glance it would seem pretty darned fiddly to make this work using either of those (the latter is likely the better option of the two for this sort of thing, but my first feeble attempts this afternoon quickly ran me into a wall of complication that I won’t explain unless someone is really interested in programming USB device functionality).

Many thanks in advance for any thoughts!

All the best,
Greg

Have a look at the FAQ, in the Advanced section you should see a query involving keybindings. Provided are some tips for re-mapping keystrokes to existing text editing functions. This will help you get rid of the arrow/modifier gripe. Selecting by “screen” and sentence is, I’m afraid, not possible unless somebody has deeply hacked the text system and provided this as a plug-in that can be access with keybindings.

This is a kludge, but one way you can jump by sentence is: Select a period punctuation mark, press Cmd-E and then use Cmd-G and Cmd-Shift-G to jump back and forth. This is of course just using the find system to look for instances of ‘.’ and thus will also trigger on abbreviations.

swimming in the dark here but I wonder if you can set a key binding to a mouse triple click.

Like a small script that uses the command to select next word then toss in a triple click to select a sentence…

As far as I know, there is no way to bind a keyboard command to a mouse event like that (though there are some tools in Universal Access for keyboard control of the pointer), plus even if a key strike could trigger a mouse click, unless you moved the mouse to the appropriate position, you would send the clicks somewhere unexpected. If you have to move the mouse to the right position—might as well just triple-click at that point. :slight_smile:

Hi folks,

Thanks so much for your speedy replies!

@AmberV: I’d been wondering about other ways of getting at the functionality apart from modifying key bindings because of complications with what I was already doing with key bindings (extensive changes in order to take full advantage of my Microsoft Natural Ergonomic Keyboard 4000, part of which entailed handing over control of modifier keys to ControllerMate). But see below for more on this…

@Wock: It’s possible to define a virtual controller which would achieve this trick (essentially, a pointer device that only does anything when a particular keystroke activates it), but as AmberV says, I think the problem would be the positioning to make that triple click useful. Also, while enabling me to select a whole sentence at a time, it wouldn’t allow me to extend a selection to the beginning or end of a sentence from an arbitrary point.

The upshot seems to be that my beloved sentence selection just ain’t gonna happen in a purely Cocoa text system environment. Moving navigation and selection somewhere other than miles off with the arrow keys or numeric keypad seemed worth fiddling with a bit more, though.

The end result of a bit more fiddling? Well, I decided to go back to modifying key bindings and circumvent the complication I was otherwise running into by sacrificing my Caps Lock key. I’ve now set it up so that Caps Lock toggles an embedded keypad of arrows, home/end and page up/page down centred on my ‘k’ key. In other words, with Caps Lock on, I replace u, i, o, j, l, m, , and . with the navigation keys in the same position you would find them on the numeric keypad. This is much like the embedded keypad which you can activate on some laptops, except that I haven’t bothered with enabling actual number keys.

There are pros and cons to this setup, but I’m going to give it a try for awhile and see if I can coax myself into using it regularly, in preference to those handy old Word nav and selection functions.

Thanks again for your speedy replies, and for coaxing me into having another go at customising my key bindings without having to re-do a bunch of my existing setup.

All the best,
Greg

Reminds me of the time when I was using XyWrite on a PC. XyWrite was an vrey special and ingenious cross between a typesetting program and a word processor, in which you could go directly into the keyboard files and edit away to your heart’s content. Although I have never regretted switching back to the Mac, I do miss the ability to easily select to the end of the sentence, and paragraph.

@thewolfgang – I hear you! Note, though, that you can still select to the end of a paragraph using shift-option-downarrow (or start of a paragraph using uparrow). To move without selecting, just omit the ‘shift’. If only the equivalent capability for sentences were to be added to the Cocoa text system, I’d be a very happy bunny…

All the best,
Greg

You can also press Ctrl-e to jump to the end of a paragraph; Ctrl-a goes to the beginning. To delete to the end of the paragraph from the current position, press Ctrl-k. There is a useful side effect in that doing so doesn’t actually fully “delete,” but rather puts the removed text into a buffer—just like Cut. However you cannot paste using Cmd-v, it goes into its own buffer. To put the text some place else, press Ctrl-y. So depending on why you are selecting to the end of the paragraph, you might find those two to be of use.

AmberV

That is oddly pico like syntax there. I think vim and some other variants of vi (elvis, elvim) used that syntax as well.

Any idea of which core command set the core text system is built on? It might yield a pile of shortcuts that we think are missing.

@Jaysen - One place to find the whole Cocoa pile is here:

http://www.hcs.harvard.edu/~jrus/Site/System%20Bindings.html

All the best,
Greg