Sublime Forum

Typewriter: a plugin for writers

#4

Exactly :smile:

I wish there were some way in unicode (or Sublime Text) to combine arbitrary characters - it would be awesome if backspace could just let you type over your previous characters.

0 Likes

#5

Without testing, and just by reading, I think you need to tweak the function to guess the focused view; because in cloned views, the view argument of the on_modified is not the same view on which you are writting. IIRC.

github.com/SublimeText/BufferSc … #L142-L149

0 Likes

#6

@icylace I think you mean an unfeature request :smiley:

@adzenith That was my first thought as well. But that would be trying to make a digital typewriter.

I think I’ve found a happy compromise in trying to figure out how to encourage user behaviour* that’s similar to that caused by an actual typewriter, while maintaining the benefits of the digital format. I use git for version control; what would be the use of ████████ █████ ██████████ a bunch of CIA-style redactions in my repo’s history? Does this line of thinking make sense?

(* I’m referring to myself. YMMV.)

@tito Thanks for pointing this out. I’ll have to look into your code (and possibly steal some of it). I use Typewriter Scrolling almost exclusively in Sublime’s Distraction Free mode, so it hadn’t come up as an issue. (FWIW, I do point to BufferScroll as a more featureful alternative :smile:)

0 Likes

#7

Anyone with OSX care to test something for me? It will only take a couple of minutes.

0 Likes

#8

Sure, what’s up?

0 Likes

#9

Hey @adzenith, thanks for offering.

Can you try these bindings out (one at a time) and let me know if either or both disable your left cursor key in OSX?:

// { "keys": "left"], "command": "do_nothing" },
// { "keys": "left"], "command": "unbound" },

For Windows & Linux the navigation keys are bound explicitly in the Default keymap, but not so in the case of OSX. So, I’m wondering…

Alex

0 Likes

#10

Both disable my left arrow key… and then I have to delete them with my mouse because I can’t use my left arrow key :stuck_out_tongue:

0 Likes

#11

Thank you very much for testing this out. It works as intended.

(And sorry for crippling your editor. It’s a right panic when your cursor keys are misbehaving. Video games used to swap the keys around to simulate drunkenness or weakness.)

I’ll be uploading a rough draft of the Typing Mode for OSX later today. I’m doing this a bit blindly, because I haven’t been able to really thorough list of text editing shortcuts for OSX. I will need another volunteer (or the same) to test that out when it’s ready. And this time there will be an off switch :smile:

Alex

0 Likes

#12

I’ve updated the Typing mode to support OSX. It’s 100% untested guesswork at this point.

I would be very grateful if a gentle soul could install Typewriter from the repo [1], turn on Typing mode (via the Palette) and try to move the cursor.

[1]: git clone [github.com/alehandrof/Typewriter.git](https://github.com/alehandrof/Typewriter.git)

In theory, typing mode should only allow you to type alphanumeric characters, punctuation & symbols, enter and backspace/delete. In practice, let me know what happens.

P.S. The Typing mode command is a toggle so you can return your editor to its former state, although it only takes effect per-view.

Alex

0 Likes

#13

Incidentally, I added this to Package Control as of a couple of weeks ago: https://sublime.wbond.net/packages/Typewriter

I’m still waiting for some nice OSX folk to verify whether the Typing mode works as it should:

Cheers,
Alex

0 Likes

#14

Just tried it on OS X. I can still press up and down, but that’s probably because I have them rebound in my user keybindings.
I can’t “undo”, but I can “find” - again, probably because I rebound find.
I can still move the cursor with the mouse.

0 Likes

#15

Thanks for the report.

If you’ve rebound keys, then the keymap settings I provide won’t know, obviously. What I would really like to do is to temporarily disable commands (such as “move”, “find_prev”, etc.). I couldn’t think of a way of doing that, so I’m just stepping on the default keybindings. I’m still thinking about a Pythonesque solution.

Whether all this is an issue or not for actual writing depends on whether you can resist the urge to use loopholes to go back and edit the text you’ve written. (Erasing and re-writting is acceptable :smile: ) The version of this plugin I used for a long time only blocked the cursor keys, which was sufficiently demoralizing for me, but YMMV.

Just out of curiosity, what have you bound up and down to?

Alex

0 Likes

#16

In ST3, you can probably use this event:

on_text_command(view, command_name, args) (new_command_name, new_args) Called when a text command is issued. The listener may return a (command, arguments) tuple to rewrite the command, or None to run the command unmodified.
Returning a nonexistent command (like ‘blackhole’ :wink:) will probably cancel the current command and do nothing (didn’t try), otherwise you can write your own BlackHoleCommand to trigger instead.

0 Likes

#17

[quote=“bizoo”]
In ST3, you can probably use this event:

on_text_command(view, command_name, args)	(new_command_name, new_args)

Buwahahaha! This is so brutally effective it’s not even funny.

It looks like it also allows me to block mouse events, which I’ve been wanting to do for the typewriter scrolling mode since 2011.

Thank you @bizoo for pointing this out. I am totally grinning like an idiot right now.

Alex

Edit:

Indeed, I’ve been using do_nothing.

0 Likes

#18

github.com/bizoo/SmartCursor

0 Likes

#19

I’d tried one of the first versions of SmartCursor, but I never got the hang of it. IIRC, I had bound it to something I needed to trigger consciously, and of course I never did. But it still sounds intriguing enough to try it again.

I used to be wary of modifying the editor so fundamentally, because the muscle memory would not transfer to other environments. But I’ve pretty much given up writing text in anything other Sublime. (As the Typewriter plugin indicates.)

Who knew? The Emacs people were on to something…

(It just occured to me that I still have to use Excel on occasion. Boy, does that app need multiple cursors! :smiley: )

Alex

0 Likes

#20

You’re right, it’s too difficult to use it this way, I couldn’t either.

I’ve bound them to up/down keys one year ago and use them this way since.

It’s a hit-and-miss feature, sometimes it does exactly what you want, sometimes it doesn’t. But I think that the hit ratio is bigger than the miss ratio.
I don’t consciously use this feature, it’s just that often you hit the down key and you find that the caret is magically where you want it to be.

0 Likes

#21

After 2-3 days of development and months of being too lazy to update this plugin on Package Control, there’s now a new version!

Version 0.3.0 brings two (un)features:

  1. The mouse is disabled when you’re using any of the typewriter modes. (You can use the scroll wheel to look around, but clicking or selecting is blocked.)

  2. Typing Mode positions the cursor at the end of the file and is much more robust at preventing you from moving the cursor.

Unfortunately, because of differences between the API of Sublime ST 2 and 3. The new (un)features are only available for ST 3. The old version is still available but will no longer be maintained.

Check it: sublime.wbond.net/packages/Typewriter

0 Likes

#22

I’ve had a report that this plugin doesn’t work in OSX. My guess is that this is unlikely, but I don’t have an OSX system handy to try it out. If any OSX users try out Typewriter, let me know if you run into trouble here or on github: github.com/alehandrof/Typewriter/issues/6

Cheers,
Alex

0 Likes

#23

Version 0.4.0 is out: Thanks to Rahul Ramadas Typewriter’s scrolling mode now supports mouse clicking and selection.

0 Likes