Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vim-sandwich underlining not displaying #533

Closed
MaximoMachado opened this issue Jan 21, 2021 · 6 comments
Closed

vim-sandwich underlining not displaying #533

MaximoMachado opened this issue Jan 21, 2021 · 6 comments

Comments

@MaximoMachado
Copy link

In Neovim, vim-sandwich has a feature in which it underlines the text that you are about to surround. It also will highlight the background of the surrounding characters if you are attempting to change or delete them.

In VSCode, currently all that happens is the character your cursor is over gets underlined but nothing else will appear.

@Shatur
Copy link
Collaborator

Shatur commented Jan 21, 2021

Yes, the additional highlighting is missing.

@MaximoMachado
Copy link
Author

MaximoMachado commented Jan 21, 2021

I think I was able to solve it using the same strategy that was used for the quickscope plugin. However, I'm not sure how to get the background highlighting working as of yet, which occurs when you are changing a specific surrounding to some other character.

Here's an example of what you should put in your config file to get it working correctly.

image

@Shatur
Copy link
Collaborator

Shatur commented Jan 21, 2021

Could you put it as a text?

@MaximoMachado
Copy link
Author

MaximoMachado commented Jan 21, 2021

Sure thing. Also, it's possible adding a background color would get the effect needed to mimic the default behavior. I haven't tried it yet. Also if anyone knows the specifics of when which highlight group is utilized, that'd be helpful. I'm reading the documentation for it and it's rather confusing as to when each is used.

if exists('g:vscode')

    highlight OperatorSandwichBuns guifg='#edc41f' gui=underline ctermfg=172 cterm=underline 
    highlight OperatorSandwichAdd guifg='#b1fa87' gui=underline ctermfg=172 cterm=underline
    highlight OperatorSandwichDelete guifg='#b1fa87' gui=standout ctermfg=172 cterm=underline
    highlight OperatorSandwichChange guifg='#b1fa87' gui=standout ctermfg=172 cterm=underline
endif

@MaximoMachado
Copy link
Author

So I was able to get the background colors working as well. However, on a different note, I've been having an issue where the cursor stays as an underline rather than a full block after using sandwich. Unfortunately, I can't reliably reproduce it, it seems to happen at random, but it's probably more likely that I can't figure out the pattern. Usually if I yank afterwords the cursor will return to a full block.

@samvv
Copy link
Collaborator

samvv commented Mar 16, 2021

The solution of @MaximoMachado is now in the wiki: https://github.com/asvetliakov/vscode-neovim/wiki/sandwich.vim

I'm closing this issue for now. If other plugins are having the same problems then we probably should create a separate issue related to way we handle highlighting.

@samvv samvv closed this as completed Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants