Code Monkey home page Code Monkey logo

partialnumber.vim's Introduction

This is a mirror of http://www.vim.org/scripts/script.php?script_id=5290

This plugin shows line numbers or a mark for the specified range with an optional highlight group, by using the vim's sign feature, without modifying the buffer contents.

While running some plugin or your vimrc, you might have seen such an error message:
        Error detected while processing function MyFunc:
        line   37:
        E706: Variable type mismatch for: abc
        line   61:
        E684: list index out of range: 19
        E15: Invalid expression list[idx]
Even with the use of number and relativenumber options, it is not easy to find where those lines of that function are actually displayed in a vim window. But by using this plugin, for example,
        :g/^function/+1,/^endfunction/-1 SetPNU
will assign and show the line numbers for each function individually so that you can see those line numbers on the sign column.

The highlight group option (default: SignColumn) can be used to show the partial line numbers with its highlight and to identify those line numbers as a group of each highlight. For example,
        :g/^{/,/^}/ SetPNU ToDo
        :.,+12 SetPNU - 0
        :'<,'> SetPNU ToDo @@
        :g/printf/ SetPNU Title ++
can show and make 3 different groups. And then,
        :SetNoPNU ToDo
will clear all the partial line numbers of 'ToDo' group but leave others.
        :SetNoPNU *
will clear all of the groups.

Since the vim's sign feature allows to use just 2 columns, the last 1 or 2 digits of the partial line number are displayed in front of each line.  To try to show upper digits, a line number which can be just divided by 100 is displayed as a circled number until 5000 and an empty circle beyond (100/200/.../5000 = circled 1/2/.../50 (①/②/.../㊿), 5100/5200/... = empty circle (○)).

If some lines are added or deleted while showing the partial line numbers, this plugin does not follow those changes.

Commands
:[range]SetPNU [group] [start]
        Show the partial line numbers for [range] with highlight [group].
        [range] : a line range (default: current line)
        [group] : a highlight group (- or default: SignColumn)
        [start] : a start line number, or a mark if not a number (default: 1)
:SetNoPNU [group]
        Clear all the partial line numbers shown with highlight [group].
        [group] : a highlight group (*: all, - or default: SignColumn)

Update 1.1
* Added '*' for SetNoPNU highlight group option
* Changed to display circled line numbers to show upper digits

partialnumber.vim's People

Contributors

rickhowe avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.