Code Monkey home page Code Monkey logo

vim-hl-var's Introduction

Vim plugin to highlight variables in Perl

This Vim plugin will highlight all instances of the Perl variable under the cursor. It is a fork of Sandeep.c.r's plugin to do the same for PHP.

Imgur

(Image credit: Ovid)

Perl variables, of all types, will be highlighted, as will methods.

Installation

If you are using a package manager such as Vundle or Pathogen, this plugin should be installed in the standard manner. If you are not (why not?), you could just copy hl-var.vim into your ~/.vim/plugins directory.

Requires Vim version 7.3 or later.

Configuration

The variables will be highlighted after you have not performed any action for a certain length of time. That time is controlled by the updatetime setting. (See :help updatetime.) The default value is 4000, which is four seconds. That value is too large for this plugin, so I recommend adjusting it to 500, which is half a second. You can experiment with the value which works best for you.

set updatetime=500

You can customise the highlighting applied by this plugin by using the hlvarhl global variable. This can be set in your .vimrc file:

let g:hlvarhl="ctermbg=black ctermfg=red guifg=#ff0000 guibg=#000000 gui=bold"

If you don't want the variable under cursor to be highlighted, you can disable it by setting variable g:hlvarcurrent to 1.

let g:hlvarcurrent = 1

Licence

This code is released under the MIT licence, as is Sandeep's original code. See hl-var.vim for the full licence.

Authors

This version was forked from Sandeep's repository, with his blessing. Curtis "Ovid" Poe hacked it to support Perl. It is currently being maintained by Paul Johnson.

vim-hl-var's People

Contributors

mannih avatar mattoates avatar pjcj avatar rgs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-hl-var's Issues

Return to using CursorMove

Using CursorHold imposes a very specific way of working: a long delay before highlighting kicks in. Tuning updatetime to something virtually "instant" has an unpleasant side effect of causing swap writes much more often, which for large writes will impose its own performance penalty.

I suggest returning to using the CursorMove event and optimizing the function for speed if it becomes a problem. The matchparens plugin works on CursorMove and is rarely a problem so we could look at that for possible optimizations. It's possible that matchadd is already limiting the search to the current window, which might be sufficient, and if not, we should consider something along those lines so that this function runs in constant time even for large files.

Unexpected highlights of braces and whitespace

If I have a line like this $s->{visual_alignment} and put the cursor on the first {, all of them get highlighted throughout the file. In addition the space after the fat comma like the following one will be be highlighted with the background defined for vim-hl-var.

Here is a screenshot.

screenshot wed aug 23 2017 22 34 45 gmt 0200 cest 620x797

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.