Giter Site home page Giter Site logo

vscode-nvim-ui's Introduction

NeoVim Ui Modifier

Changes theme accents based on current NeoVim mode.

Alt Text

Currently works for the following modes:

  • Normal
  • Insert
  • Visual

Set the color for each mode to match your theme in settings.json (see below)

Also see the Blog Article

Requirements

You will need the NeoVim VScode extension installed for this to work - Neovim Extension - follow full setup before continuing

Config

In settings.json:

You can change the colors to match the theme you use:

    "nvim-ui.nvimColorNormal": "#ffc600",
    "nvim-ui.nvimColorInsert": "#D32F2F",
    "nvim-ui.nvimColorVisual": "#673AB7",
    "nvim-ui.nvimColorReplace": "#000"

By default the extension only changes the color of cursor. To change the color of other elements, add it's name to workbench.nvimColorCustomizationKeys in setings.json.

For example, if you would like the active tab highlight and cursor to change color, enter the following in settings.json:

    "nvim-ui.nvimColorCustomizationKeys":  ["tab.activeBorder", "editorCursor.foreground"],

Here the elements that can be updated via this plugin:

activityBarBadge.background editorCursor.foreground inputValidation.errorBorder panel.border panelTitle.activeBorder panelTitle.activeForeground peekView.border peekViewTitleLabel.foreground tab.activeBorder statusBar.border

In Neovim config

This will need adding to you init.vim or init.lua, it tells neovim to send a command to vscode changing the color in a hacky way

Make sure to restart VSCode after adding

init.lua

vim.api.nvim_exec([[
    " THEME CHANGER
    function! SetCursorLineNrColorInsert(mode)
        " Insert mode: blue
        if a:mode == "i"
            call VSCodeNotify('nvim-theme.insert')

        " Replace mode: red
        elseif a:mode == "r"
            call VSCodeNotify('nvim-theme.replace')
        endif
    endfunction

    augroup CursorLineNrColorSwap
        autocmd!
        autocmd ModeChanged *:[vV\x16]* call VSCodeNotify('nvim-theme.visual')
        autocmd ModeChanged *:[R]* call VSCodeNotify('nvim-theme.replace')
        autocmd InsertEnter * call SetCursorLineNrColorInsert(v:insertmode)
        autocmd InsertLeave * call VSCodeNotify('nvim-theme.normal')
        autocmd CursorHold * call VSCodeNotify('nvim-theme.normal')
    augroup END
]], false)

init.vim

" THEME CHANGER
function! SetCursorLineNrColorInsert(mode)
    " Insert mode: blue
    if a:mode == "i"
        call VSCodeNotify('nvim-theme.insert')

    " Replace mode: red
    elseif a:mode == "r"
        call VSCodeNotify('nvim-theme.replace')
    endif
endfunction

augroup CursorLineNrColorSwap
    autocmd!
    autocmd ModeChanged *:[vV\x16]* call VSCodeNotify('nvim-theme.visual')
    autocmd ModeChanged *:[R]* call VSCodeNotify('nvim-theme.replace')
    autocmd InsertEnter * call SetCursorLineNrColorInsert(v:insertmode)
    autocmd InsertLeave * call VSCodeNotify('nvim-theme.normal')
    autocmd CursorHold * call VSCodeNotify('nvim-theme.normal')
augroup END

** WARNING: The plugin will add / override any keys that are passed in for customization in settings.json. If uninstalling the extension you will need to remove these from your settings.json

"workbench.colorCustomizations": {
    ...keys
}

vscode-nvim-ui's People

Contributors

kensledev avatar simonjonathan avatar roger-sato 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.