Variables or Placeholders?

Sorry if this is something already documented, I just could not find it.

I am looking for a way to put placholders in my document, that I can change later by updating only one value.

For instance, if I have a character that I am not sure what to name just yet, I might want to insert something like <% character1 %> until I figure out his name. For now I may specify somewhere that <% character1 %> = “Bob”. I may write the whole book this way. Then later, I can change it so that <% character1 %> = “Jimmy”, and every instance of <% character1 %> magically changes from Bob to Jimmy.

And I do not want to use Find & Replace. It is too easy to clobber other words that way, and it just is not as elegant.



At present, Find and Replace is the only way to do this. If your string is as specific as <%character1%> though, I find it highly unlikely you would clobber other words!

The problem with your suggestion is that it could lead to many other problems - if you mistype the placeholder string, it would remain in your exported text. And it doesn’t deal with the problem that most people call him Jimmy, but his mother calls him James, and the concierge calls him Mr Bond. So then there would be further requests for an elegant solution for that as well.

I think this has been raised before, and in the end it seemed a careful search and replace was about as elegant as any other proposal, and has the advantage that it does not go around changing your text behind your back.


Yes, I wrote one of those previous posts, but I can’t find it now.

In a historical novel, I had two characters whose identities I had to switch. Hundreds of references to their first, last, and nicknames. I used Search to find the names, but in the Preferences: Text Editing: Editor Options, I left the box “Editing clears search highlights” UNchecked. That way, after you correct a name, you scroll on to find the next highlighted instance. It’s not a global edit, but it’s a safer way to go and actually quite fast, if you have the new version of name stored in memory.

If you change things around a lot, I’d consider typing in names normally, but prefix them with % or something. This will make global search and replace flawless, and you can refer to characters as “%Erin” instead of “<%character 1%>”. A touch more endearing!