Sublime Forum

Cant find to show all lines from file on statusbar

#1

Hi,
i installed the the latest sublime version. On 2016 in the old version i got a solution to show the number of lines from the current file
hc_021
But I don’t know how to do it anymore. I still remember that I had to write a kind of configuration file. Can someone help me?

regards
Andreas

0 Likes

#2

Add a new plugin like the following should quite do the job.

import sublime
import sublime_plugin


class StatusBarFileLineCounts(sublime_plugin.EventListener):
    def on_activated_async(self, view):
        self._show_view_line_counts(view)

    def on_modified_async(self, view):
        self._show_view_line_counts(view)

    def _show_view_line_counts(self, view):
        line_counts = view.rowcol(view.size())[0] + 1
        view.set_status("line_counts", "#Lines: {}".format(line_counts))
0 Likes

#3

Hi,
thanks for the fast reply. Sorry, but i’m not a programmer and i have a question about your solution.
Is the plugin to be created as shown here and if so, do I have to give it a certain name or an extension so that I can import it via browse package? Where does the sublime import to? If I know that, then I can take a look at the old installation and import from there.

regards
Andreas

0 Likes

#4

image

You just have to copy it and paste it after clicking on the “New Plugin…” and save it in the default prompt location with whatever filename you like.

0 Likes

#5

It should be under “Preferences -> Browse Packages…” and any file under that (sub)dir can potentially be your goal.

0 Likes

#6

Hi,
i found the old file. It’s under C:\Users&USER\AppData\Roaming\Sublime Text 3\Packages\User
called lines_count.py stored. Thanks for for the hints. Wish you the best and a god going to the new Decade

Andreas

1 Like

#7

@jfcherng, is that a real plugin on Package Control? Seems useful!

0 Likes

#8

No. It’s just a casually written code.

0 Likes