Bring RGB to life in Neovim

Overview

Bring RGB to life in Neovim

Change your RGB devices' color depending on Neovim's mode.
Fast and asynchronous plugin to live your vim-life to the fullest.

Why?

  • 🌍 Universal: works with all devices supported by OpenRGB
  • 🚀 Fast: snappy and completely asynchronous
  • 💎 Reliable: multiple vim instances are supported
  • ❤️ Flexible: each mode's colors are customizable

Installation

Make sure to have the following plugin in your vimrc:

Plug 'antoinemadec/openrgb.nvim', {'do': 'UpdateRemotePlugins'}

Install:

Setup

Make sure the OpenRGB server is running:

openrgb --server

And add the folowing in your vimrc :

  • if you don't use any statusline plugin, add this in your vimrc:
function OpenRGBStatuslineFunc()
  if g:openrgb_is_ready
    call OpenRGBChangeColorFromMode(mode())
  endif
  return ''
endfunction

if empty(&statusline)
  set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
endif
set statusline+=%{OpenRGBStatuslineFunc()}

autocmd FocusGained * call OpenRGBChangeColorFromMode(mode(), 1)
  • if you use lightline, add this in your vimrc:
" default lightline values
let g:lightline = {}
let g:lightline.active = {
      \ 'left': [ [ 'mode', 'paste' ],
      \           [ 'readonly', 'filename', 'modified' ] ],
      \ 'right': [ [ 'lineinfo' ],
      \            [ 'percent' ],
      \            [ 'fileformat', 'fileencoding', 'filetype' ] ] }
let g:lightline.inactive = {
      \ 'left': [ [ 'filename' ] ],
      \ 'right': [ [ 'lineinfo' ],
      \            [ 'percent' ] ] }
let g:lightline.tabline = {
      \ 'left': [ [ 'tabs' ] ],
      \ 'right': [ [ 'close' ] ] }

" openrgb modifications
let g:lightline.active.left[0][0] = 'mymode'
let g:lightline.component_function = {'mymode': 'MyMode'}
function MyMode() abort
  if g:openrgb_is_ready
    call OpenRGBChangeColorFromMode(mode())
  endif
  return lightline#mode()
endfunction
autocmd FocusGained * call OpenRGBChangeColorFromMode(mode(), 1)

Customization

If you don't like the default RGB colors, here is how to change it:

" default dict
let s:default_dict = {
      \ 'main_color': '#000000',
      \ 'led_names': [[]],
      \ 'led_colors': []
      \ }
let g:openrgb_mode_dict = {}
for mode in ['n', 'v', 'V', '', 'i', 'R', 'c', 'r', 't', 'default']
  let g:openrgb_mode_dict[mode] = copy(s:default_dict)
endfor

" customize dict:
"     - if dict[mode] is not found, it falls back to dict['default']
"     - each group of keys in 'led_names' are lit using the same color
"     - look at 'g:openrgb_led_names' to see the available 'led_names'
"     - if empty(led_colors):
"           colors are assigned automatically
"       else:
"           led_colors are used
" -- normal
let g:openrgb_mode_dict['n']['main_color'] = '#ffff00'
let g:openrgb_mode_dict['n']['led_names'] = [
      \ ['Key: Right Arrow', 'Key: Left Arrow', 'Key: Up Arrow', 'Key: Down Arrow'],
      \ ['Key: H', 'Key: J', 'Key: K', 'Key: L'],
      \ ['Key: Left Control', 'Key: Left Windows', 'Key: Left Alt', 'Key: Left Shift'],
      \ ['Key: Insert', 'Key: Delete', 'Key: Home', 'Key: End', 'Key: Page Up', 'Key: Page Down'],
      \ ['Key: F1', 'Key: F2', 'Key: F3', 'Key: F4'],
      \ ['Key: F5', 'Key: F6', 'Key: F7', 'Key: F8'],
      \ ['Key: F9', 'Key: F10', 'Key: F11', 'Key: F12'],
      \ ['Key: 0', 'Key: 1', 'Key: 2', 'Key: 3', 'Key: 4', 'Key: 5', 'Key: 6', 'Key: 7', 'Key: 8', 'Key: 9'],
      \ ]
" -- insert
let g:openrgb_mode_dict['i']['main_color'] = '#007020'
let g:openrgb_mode_dict['i']['led_names'] = [
      \ ['Key: F', 'Key: R'],
      \ ['Key: A', 'Key: N'],
      \ ['Key: C', 'Key: E'],
      \ ]
let g:openrgb_mode_dict['i']['led_colors'] = [
      \ '#0000ff',
      \ '#ffffff',
      \ '#ff0000'
      \ ]

Here is the API if you want to trigger color changes manually:

" calling OpenRGBChangeColor() using 'g:openrgb_mode_dict' info
OpenRGBChangeColorFromMode(mode, force)
" calling OpenRGBChangeColor() directly
call OpenRGBChangeColor(main_color, led_names, led_colors, force)

License

MIT

Owner
Antoine
Verification engineer. Music enthusiast. Vim lover.
Antoine
Course materials and handouts for #100DaysOfCode in Python course

#100DaysOfCode with Python course Course details page: talkpython.fm/100days Course Summary #100DaysOfCode in Python is your perfect companion to take

Talk Python 1.9k Dec 31, 2022
Explicit, strict and automatic project version management based on semantic versioning.

Explicit, strict and automatic project version management based on semantic versioning. Getting started End users Semantic versioning Project version

Dmytro Striletskyi 6 Jan 25, 2022
A tutorial for people to run synthetic data replica's from source healthcare datasets

Synthetic-Data-Replica-for-Healthcare Description What is this? A tailored hands-on tutorial showing how to use Python to create synthetic data replic

11 Mar 22, 2022
Xanadu Quantum Codebook is an experimental, exercise-based introduction to quantum computing using PennyLane.

Xanadu Quantum Codebook The Xanadu Quantum Codebook is an experimental, exercise-based introduction to quantum computing using PennyLane. This reposit

Xanadu 43 Dec 09, 2022
A Python validator for SHACL

pySHACL A Python validator for SHACL. This is a pure Python module which allows for the validation of RDF graphs against Shapes Constraint Language (S

RDFLib 187 Dec 29, 2022
Rust Markdown Parsing Benchmarks

Rust Markdown Parsing Benchmarks This repo tries to assess Rust markdown parsing

Ed Page 1 Aug 24, 2022
Cleaner script to normalize knock's output EPUBs

clean-epub The excellent knock application by Benton Edmondson outputs EPUBs that seem to be DRM-free. However, if you run the application twice on th

2 Dec 16, 2022
Main repository for the Sphinx documentation builder

Sphinx Sphinx is a tool that makes it easy to create intelligent and beautiful documentation for Python projects (or other documents consisting of mul

5.1k Jan 04, 2023
Create Python API documentation in Markdown format.

Pydoc-Markdown Pydoc-Markdown is a tool and library to create Python API documentation in Markdown format based on lib2to3, allowing it to parse your

Niklas Rosenstein 375 Jan 05, 2023
A `:github:` role for Sphinx

sphinx-github-role A github role for Sphinx. Usage Basic usage MyST: :caption: index.md See {github}`astrojuanlu/sphinx-github-role#1`. reStructuredT

Juan Luis Cano Rodríguez 4 Nov 22, 2022
A Json Schema Generator

JSON Schema Generator Author : Eru Michael About A Json Schema Generator. This is a generic program that: Reads a JSON file similar to what's present

1 Nov 10, 2021
Crystal Smp plugin for show scoreboards

MCDR-CrystalScoreboards Crystal plugin for show scoreboards | Only 1.12 Usage !!s : Plugin help message !!s hide : Hide scoreboard !!s show : Show Sco

CristhianCd 3 Oct 12, 2021
A document format conversion service based on Pandoc.

reformed Document format conversion service based on Pandoc. Usage The API specification for the Reformed server is as follows: GET /api/v1/formats: L

David Lougheed 3 Jul 18, 2022
Python bindings to OpenSlide

OpenSlide Python OpenSlide Python is a Python interface to the OpenSlide library. OpenSlide is a C library that provides a simple interface for readin

OpenSlide 297 Dec 21, 2022
graphical orbitational simulation of solar system planets with real values and physics implemented so you get a nice elliptical orbits. you can change timestamp value or scale from source code idc.

solarSystemOrbitalSimulation graphical orbitational simulation of solar system planets with real values and physics implemented so you get a nice elli

Mega 3 Mar 03, 2022
A next-generation curated knowledge sharing platform for data scientists and other technical professions.

Knowledge Repo The Knowledge Repo project is focused on facilitating the sharing of knowledge between data scientists and other technical roles using

Airbnb 5.2k Dec 27, 2022
Automated Integration Testing and Live Documentation for your API

Automated Integration Testing and Live Documentation for your API

ScanAPI 1.3k Dec 30, 2022
An introduction course for Python provided by VetsInTech

Introduction to Python This is an introduction course for Python provided by VetsInTech. For every "boot camp", there usually is a pre-req, but becaus

Vets In Tech 2 Dec 02, 2021
A Python module for creating Excel XLSX files.

XlsxWriter XlsxWriter is a Python module for writing files in the Excel 2007+ XLSX file format. XlsxWriter can be used to write text, numbers, formula

John McNamara 3.1k Dec 29, 2022
🍭 epub generator for lightnovel.us 轻之国度 epub 生成器

lightnovel_epub 本工具用于基于轻之国度网页生成epub小说。 注意:本工具仅作学习交流使用,作者不对内容和使用情况付任何责任! 原理 直接抓取 HTML,然后将其中的图片下载至本地,随后打包成 EPUB。

gyro永不抽风 188 Dec 30, 2022