Giter Site home page Giter Site logo

semantic-highlight.vim's Introduction

Semantic-Highlight.vim

Where every variable is a different color, an idea popularized by Evan Brooks' blog post.

Install

Vundle or Neobundle:

Plugin 'jaxbot/semantic-highlight.vim'

Pathogen:

git clone https://github.com/jaxbot/semantic-highlight.vim.git

Usage

In a file, run :SemanticHighlight to convert variables into colors. Run :SemanticHighlightRevert to revert.

You can also map :SemanticHighlightToggle to a shortcut to toggle the effect on and off:

:nnoremap <Leader>s :SemanticHighlightToggle<cr>

Customization

Set g:semanticTermColors and/or g:semanticGUIColors to a list of colors, then run RebuildSemanticColors to flush the cache. The color lists look like:

let s:semanticGUIColors = [ '#72d572', '#c5e1a5', '#e6ee9c', '#fff59d', '#ffe082', '#ffcc80', '#ffab91', '#bcaaa4', '#b0bec5', '#ffa726', '#ff8a65', '#f9bdbb', '#f9bdbb', '#f8bbd0', '#e1bee7', '#d1c4e9', '#ffe0b2', '#c5cae9', '#d0d9ff', '#b3e5fc', '#b2ebf2', '#b2dfdb', '#a3e9a4', '#dcedc8' , '#f0f4c3', '#ffb74d' ]

or

let g:semanticTermColors = [28,1,2,3,4,5,6,7,25,9,10,34,12,13,14,15,16,125,124,19]

Either list can also be set in your vimrc

Language support

This plugin is language agnostic, meaning it will work on any language with words. However, some languages have been tweaked by default to disable highlighting of language keywords.

Current language support with keyword blacklists:

  • JavaScript
  • Ruby
  • PHP
  • Python
  • CoffeeScript

This can be customized locally by populating g:semanticBlacklistOverride like so:

let g:semanticBlacklistOverride = {
	\ 'javascript': [
	\	'setTimeout',
	\	'break',
	\	'dance',
	\ ]
\ }

If you want to add language support to the plugin itself, feel free to edit autoload/blacklist.vim and submit a pull request with your changes. Help is appreciated!

Kudos

Big thanks to John Leimon, whose Semantic C/C++ Vimscript was inspirational in the construction of this one.

Also big thanks to everyone who submitted bugs, suggestions, and pull requests!

About me

I'm Jonathan. I like to hack around with Vim, Node.js, embedded hardware, and Glass. If any of that sounds interesting, follow me!

semantic-highlight.vim's People

Contributors

adnoc avatar faceleg avatar g0xa52a2a avatar jaxbot avatar jonathanglasmeyer avatar matatk avatar octopuscabbage avatar othree avatar

Watchers

 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.