Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to show the exact position in Sublime Text 2?

I've been learning Markdown, and using the Python Markdown package, which often returns the following when I try to convert text that has been pasted in from the web:

UnicodeEncodeError: 'ascii' codec can't encode character u'\u201c' in  position 1611: ordinal not in range(128) 

At the bottom of my editor I currently see this:

COMMAND MODE, Line X, Column Y 

Is there a setting in Sublime Text 2 that will show the full position (as in 1611 in the example above) at all times so I can quickly find the bad character?

like image 829
Brian Dant Avatar asked Oct 17 '12 21:10

Brian Dant


People also ask

How do I turn on sidebar in Sublime Text?

You have to add a folder to the Sublime Text window in order to navigate via the sidebar. Go to File -> Open Folder... and select the highest directory you want to be able to navigate. Also, 'View -> Sidebar -> Show Sidebar' if it still doesn't show.

How do I navigate in Sublime Text?

The Goto Anything shortcuts navigate the current file. If you have a project open, you can press Ctrl ⇧ R to launch Goto Anything In Project. This command will search for symbols across every file in your project.


1 Answers

You could make a simple python script to do this.

1. Save this code to your User folder as characterCounter.py (Preferences > Browse Packages > User):

import sublime, sublime_plugin  class PositionListener(sublime_plugin.EventListener):   def on_selection_modified(self,view):     text = "Position: "     sels = view.sel()     for s in sels:         text += " " + str(s.begin())         if not s.empty():             text += "-" + str(s.end()) + " "     view.set_status('exact_pos', text) 

2. Then restart Sublime Text to have it loaded.

like image 123
Liam Cain Avatar answered Oct 21 '22 07:10

Liam Cain