Giter Site home page Giter Site logo

vscode-nvim-ui's Introduction

DEPRICATION NOTICE

After careful consideration, I have decided to deprecate the vscode-nvim-ui plugin. This decision follows the discovery of more efficient solutions and a shift in my development focus.

For details on this decision and alternative solutions, please refer to Issue #14. I recommend the Apc Customize UI++ extension as a superior alternative for enhanced functionality.

If the extension is working for you then feel free to continue but there will be no futher development. As pointed out in the mentioned issue, Apc Customize UI++ hooks into the Electron window where this extension is simply inserting lines into settings.json which can cause issues with other plugins that have similar functionality such as this issue with Peacock

Thank you to everyone who has used the extension and for your support and understanding.

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"],

These are some of the settings you can use with this plugin:

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

This plugin should work with any ui setting, the above have been tested.

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')
        autocmd ModeChanged [vV\x16]*:* 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')
    autocmd ModeChanged [vV\x16]*:* 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 roger-sato avatar shortarrow avatar simonjonathan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vscode-nvim-ui's Issues

VSCodium

Please release this on the VSCodium repo.

Is there any plans to fix the cursor being moved to start of line in visual mode?

Hello! Hope you are well :)

I like the extension very much, but I find that the cursor being moved to the start of line whenever entering visual mode is quite frustrating when using character or block-wise visual mode.

Are there any plans to fix it?

(there's a typo on the title because I opened the issue by mistake before correcting it)

Do not overwrite `workbench.colorCustomizations` entirely

If there is already a workbench.colorCustomizations in the user's settings.json you should not replace the entire object. I try to set statusBar.foreground to #000000, but whenever I enter or leave insert mode, it will be removed, because this extension replaces the entire object of it instead of merging properly.

This is undesirable.

Installing peacock and Neovim Ui Modifier v0.13 will cause the peacock colors to be written to vscode's user settings and will not be removed

Versions (please complete the following information):

OS: Mac
VS Code version April 2023 (version 1.78)
Peacock Version v4.2.2
Describe the bug
Install peacock and set a color for the project. Install Neovim Ui Modifier v0.13, then reset peacock and uninstall peacock, peacock's color will be written to vscode's user settings, delete the settings manually, then save the settings and they will be set back.

Solution, disable neovim ui Modifier, then manually remove the color setting of peacock from user settings.

Settings for custom cursor colors are not working

These settings writing in the doc are not working:

"workbench.nvimColorNormal": "#ffc600",
"workbench.nvimColorInsert": "#D32F2F",
"workbench.nvimColorVisual": "#673AB7",
"workbench.nvimColorReplace": "#000"

Checked your source code. Were they changed to the following?

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

When exiting visual mode there is a delay up to 5 seconds before the color changes

The issue seems to be present when configuring the extension via vimscript.

Changing the config to lua and loading via nvim_exec the issue is still present but behaves differently.

-- init.lua

vim.api.nvim_exec([[
    ...config
]], false

When loaded in Lua the Visual modes work as follows

  • Visual Mode: delay on entering (apx 2 seconds), very slight delay/none on exit
  • Visual Line mode: no delay on entrance, very slight delay on exit.

The delay when entering Visual Mode is negated when pressing any button with the color changing as soon as a button is pressed. This makes the issue a lot less noticeable.

A new release will be created updating the README to recommend configuring in Lua to minimize the issue. It will also change the default advice to include the status bar and cursor, @simonjonathan mentioned he only uses the plugin for the cursor color. It makes a lot of sense as your eyes are already there so I'm happy to make this the default recommendation.

Changing modes causes brief token recolor

Changing between any mode (normal-insert, normal-visual, normal-visual line, normal-replace, insert-normal etc) causes some tokens to be colored differently for a split second and then get the intended color again. This is not specific to the used theme (tested on default dark+)
Removing this code in the .lua config fixes this issue (but basically disables the extension)

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)

See attached videos for actual vs expected behaviours

actual.mp4
expected.mp4

settings.json

    "nvim-ui.nvimColorCustomizationKeys": [
        "tab.activeBorder",
        "editorCursor.foreground",
        "statusBarItem.remoteBackground"
    ],
    "workbench.colorCustomizations": {
        "tab.activeBorder": "#267bd2",
        "editorCursor.foreground": "#267bd2",
        "statusBarItem.remoteBackground": "#267bd2"
    },

Versions:

  • neovim ui modifier: 0.1.5
  • vscode neovim: 1.1.3
  • vscodium: 1.84.2

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.