VSCodeVim / Vim

:star: Vim for Visual Studio Code
http://aka.ms/vscodevim
MIT License
13.94k stars 1.32k forks source link

Change color on entering/leaving modes #6266

Open MagnusBrzenk opened 3 years ago

MagnusBrzenk commented 3 years ago

Is your feature request related to a problem? Please describe. I asked this question on SO, but did not get any answers, so thought I'd try my luck here.

Describe the solution you'd like I want to make it visually OBVIOUS what mode I am presently in by programmatically changing color theme whenever I change modes (in particular normal <-> insert). If it's possible already then I'd appreciate an outline of the solution. If it's not possible, then please consider adding required functionality.

Describe alternatives you've considered As described in the link, in normal vim I can change colors by listening to events with the following sort of syntax:

autocmd InsertEnter * colorscheme industry | set cursorline | highlight CursorLine guibg=darkgrey ctermbg=darkgrey
autocmd InsertLeave * colorscheme torte

However, I don't think that these sorts of features are available in vscode vim. I'd also looked into using VSCode features BUT (i) I don't know if I can trigger a generic action on the event of vscode vim changeing modes, and (ii) even if I could, I cannot find a vscode action to programmatically change the theme (the closest I can find is "command":"workbench.action.selectTheme", but that just opens the menu to select a theme, and I want the theme switched automatically.

sean-brydon commented 3 years ago

On the VSCode side of things there is currently an open PR to implement the feature to be able to change theme via a command.

https://github.com/microsoft/vscode/pull/100861

As an example

    {
        "key": "ctrl+t ctrl+d",
        "command": "workbench.action.selectTheme",
        "args": {
            "id": "Default Dark+"
        }
    }

This will allow you to change theme based on what input mode you are in using "when":"vim.mode='Insert'" for example

You could take the alternative (Arguably better approach) and add it to the keybindings for VSCodeVim


{
   "vim.visualModeKeyBindings":[
      {

        ...

         "commands":[
            {
               "command":"workbench.action.selectTheme",
               "args":{
                  "id":"ayu"
               }
            }
         ]
      }
   ]
}```
J-Fields commented 3 years ago

As of today, the only feature we have is vim.statusBarColorControl, which is janky and limited

macintacos commented 2 years ago

I was looking for something to essentially turn off the line highlight setting (editor.renderLineHighlight) when in insert mode and have it on otherwise. My guess is that's also not possible with the current way VSCodeVim works?

MiLandry commented 4 months ago

I would also like this feature.