Home Download Buy Blog Forum Support

Sublime for straight prose?

Sublime for straight prose?

Postby Kensai on Mon Aug 24, 2009 8:55 pm

I really want to love Sublime. The minimap and panes would be ridiculously useful for writing long works of fiction, and the app looks and feels fantastic, but I just can't get text to display in some acceptable manner. I know its really meant as a coding tool, not a writing one, but its just so close to being top option for that purpose, and its so configurable and extensible, I know there's got to be some way to get it done.

Unfortunately, I'm not a coder. I've got just enough gumption to get the options that are obviously present in Sublime altered to suit my taste (no line numbers, removed the status and scroll bars, etc.) but I can't figure out any way to make text appear as it would normally in any other text editor with Tab indenting just the first line of a paragraph rather than simply shifting every line over until you either push it further with another Tab or Shift+Tab to get it back. I would even settle for not using Tab if I could get the carriage return to add a line space between it and the next paragraph. Whatever it takes to be able to very clearly and legibly discern between one paragraph and the next. If I could be shown how to get this reliably, I would very likely buy a license on the spot.

I'm also interested in getting the Word Count package to run via a key binding, though I can't figure out how. I know I have to have the Statusbar showing to see the results of the Work Count package, so I've figured out how to build a custom key binding to toggle it on for that purpose (so I'm not completely useless here), but even so, I could use some help with the Word Count and it would be fantastic if there were a method of running it so that the results were displayed in some method that didn't require having a normally useless (to me) bit of chrome taking up space. I wouldn't mind leaving the status bar up if it could give me a real time word count and certainly if there were plug ins that allowed for setting word count "bookmarks" or possibly timers.

What do you geniuses think? Should I go crawling back to WriteMonkey and q10, my dreams plagued by MiniMaps and multiple panes, or can we get some of this stuff working.

Posts: 37
Joined: Mon Aug 24, 2009 8:19 pm

Re: Sublime for straight prose?

Postby rulfzid on Tue Aug 25, 2009 2:43 pm


Try the following:

Step 1:
Click on Preferences -> Default key bindings

Step 2:
The file "Default.sublime-keymap" will open, and look for the line (for me, it's on line 42):

Code: Select all
<binding key="enter" command="insertAndDecodeCharacters \n" />

Step 3:
Replace that line of code with:

Code: Select all
<binding key="enter" command="insertCharacters \t\n" />

Step 4:
Enjoy a Sublime Text editing experience that doesn't autodetect tabbing and indents new paragraphs when you hit "enter". :D

As for the word count, I'll try to figure something out and and post about it soon.
Posts: 9
Joined: Thu Aug 20, 2009 10:06 pm

Re: Sublime for straight prose?

Postby rulfzid on Tue Aug 25, 2009 6:30 pm

As promised, here is a real time word count solution.

I just tweaked the WordCount plugin that ships with Sublime to display the word count in the status bar when you modify the document.

Just save the code below as livewordcount.py in Sublime's Packages/User directory. "Preferences -> Browse Packages" will take you to the Packages directory. Open the "User" folder, drop in the file, start up Sublime, and start typing:


Here's the code (save as livewordcount.py):

Code: Select all
import sublime, sublimeplugin, re

class liveWordCount(sublimeplugin.Plugin):
   def onModified(self, view):
      sels = view.sel()
      content = view.substr(sublime.Region(0, view.size()))
      sublime.statusMessage("Words: %s" % self.count(content))
   def count(self, content):
      """counts by counting all the start-of-word characters"""
      # regex to find word characters
      wrdRx = re.compile("\w")
      matchingWrd = False
      words = 0;
      for ch in content:
         # test if this char is a word char
         isWrd = wrdRx.match(ch) != None
         if isWrd and not matchingWrd:
            # we're moving into a word from not-a-word
            words = words + 1
            matchingWrd = True
         if not isWrd:
            # go back to not matching words
            matchingWrd = False
      return words
Posts: 9
Joined: Thu Aug 20, 2009 10:06 pm

Re: Sublime for straight prose?

Postby SteveCooperOrg on Wed Sep 02, 2009 12:34 pm

I use sublime text for writing fiction, blog posts, and other pieces of prose. I tend to write everything in the markup language Markdown, which is basically plain text, paragraphs separated by blank lines, with a little formatting for bold, italic, lists, etc. See more here: <http://daringfireball.net/projects/markdown/> If you go with Markdown, there's a nice program called Pandoc which will convert Markdown files into RTF, HTML, and other formats. This lets you get a version of your manuscript which can be formatted up for submission.

I use a slightly modified version of the Markdown package that comes with sublime; there's a download link at the bottom of this post; <http://www.stevecooper.org/2008/01/28/sublime-text-editor-review/>

To get a keybinding for work count, add this to your User/Default.sublime-keymap

<!-- word count -->
<binding key="ctrl+w,ctrl+c" command="wordCount" />

Then you can use ctrl+W, ctrl+C to do the count.
Maybe what you're looking for is at the http://www.sublimetextwiki.com
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am

Re: Sublime for straight prose?

Postby jps on Tue Sep 08, 2009 11:10 am

With regards to the indenting, I just added an option to inhibit the indenting of wrapped lines. This will be in the next beta, which should be out sometime in the next two weeks.
Site Admin
Posts: 3217
Joined: Wed Mar 19, 2008 12:33 pm

Re: Sublime for straight prose?

Postby Kensai on Wed Sep 09, 2009 3:05 am

Very nice. I'm looking forward to it.

And thanks, all, for the advice.

Posts: 37
Joined: Mon Aug 24, 2009 8:19 pm

Re: Sublime for straight prose?

Postby Kensai on Sat Sep 12, 2009 2:49 am

The new beta is working great. The indent function works just fine.

The problem I'm seeing now that I've been able to get in and start working is that when selecting text, it starts doing some weird thing where it seems to be taking the selected text and overwriting it further down in the file, as I'm selecting. It goes away when I click away, but its weird enough that I can't really select what I need to.

Any idea what that is and if there's any way to disable it? I thought it might be the line swapping thing (whatever that is) that was mentioned in the post about the beta, but other than finding a couple of key bindings that only seem to activate a swap rather than change a setting.

Posts: 37
Joined: Mon Aug 24, 2009 8:19 pm

Re: Sublime for straight prose?

Postby MachoManhattan on Mon Aug 22, 2011 3:26 am

Modern writing -- articles, blogs, online novels -- improve upon paper-based writing/reading thanks to interactivity like hyperlinks and tooltips. For Sublime Text to accommodate modern writing, it needs to support text hyperlinks along with standard word-processing features, like automatic capitalization after periods and grammar check. I would love to see a programming tool include these basics of content writing to blend the two disciplines. Sometimes the programmers are the content creators. Why must we use separate tools to edit text in multiple ways? I need to allow my creative prose to flow, insert hyperlinks, special Latin characters, look up definitions and synonyms as needed, and then edit the HTML to add DOM IDs and classes and otherwise mark it up.

Perhaps content can be written in prose editor, converted to a markup language, and modified in code editor. I suppose this is what Dreamweaver and others do via their code/preview toggle. Thoughts?
Posts: 1
Joined: Mon Aug 22, 2011 3:16 am

Re: Sublime for straight prose?

Postby forehead on Tue Oct 11, 2011 5:58 am

FYI i just hacked up a build system for Markdown that opens an HTML preview in a new browser window. MacOS only for now.

Posts: 20
Joined: Wed Oct 05, 2011 10:32 pm

Re: Sublime for straight prose?

Postby micromatic on Tue Oct 11, 2011 2:20 pm

Hi all,

I'm absolutely no coder and I'm also using Sublime Text only for prose. I bought registration-key a few days ago after a 4 week testing period. And I must say, I love writing with sublime, cause it feels great and it's so easy to switch between different documents (different scenes of a story) in fullscreenmode and the minimap is just wonderful, cause it reacts spontaneously and it's as if you got the text directly in your hands. I had spent an hour making around with settings, experimented with wrap, ruler and minimap size and other things, but I had no real problem to get it perfect for my writing demands. Everything looks and works great on my screen. But I have to say, I use only Sublime 1.4, cause I could'nt find out how to get version 2 working for my demands, I don't really understand how the setting of Sublime 2 works. But never mind, as 1.4 is really really the best thing I can imagine for writing my texts; to make it even more perfect, I additionally installed word count and of course automaticbackup.

... it's just great!

Thanks a lot for this editor!

Greetings to all and keep on keepin on,


PS: My english is not very good, sorry.
Posts: 11
Joined: Tue Oct 11, 2011 2:02 pm


Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot], Yahoo [Bot] and 27 guests