Code Monkey home page Code Monkey logo

highlight-words's Introduction

highlight-words

screencast

This extension is adapted from the sample VS code extension decorator-sample, inspired by atom-quick-highlight.

It creates a decoration for each selected word that appears in all editors.

Usage

  • You can add words by chosing Highlight Toggle Current from the command pallet, this will highlight the word at the cursor or the selection.
  • To stop highlighting, choose Highlight Remove, then the desired word or expression, or all
  • You may also remove all from the command Highlight Remove All without the prompt for selection
  • To highlight using regular expression choose Highlight Expression and enter expression(slashes optional, can ignore case with /expression/i(g flag is automatic, i flag accepted, all others ignored).
  • To highlight with options choose Highlight Selection with Options and choose whole word, ignore case or both when presented
  • You can set the mode for "Highlight Toggle Current" from the Set Highlight Mode command. The default can be set in the configuration.
  • Sidebar can show in explorer view and can be toggled on and off with Highlight Toggle Sidebar command. This provides features such as navigating highlighted items, context menu for changing options and removing.

Configuration

The following options can be configured

highlightwords.colors: this is an array of light/dark pairs for respective theme types, you can have as few or as many as you like

highlightwords.box: show highlights as a box around the selections if true, set highlight as background color if false

highlightwords.defaultMode: the initial mode when initialized. 0=default, 1=whole word, 2=ignore case, 3=whole word and ignore case

highlightwords.showSidebar provides a view in the explorer window for searching, changing options and removing highlights

defaults shown below

"highlightwords.colors": [
    { "light": "#b3d9ff", "dark": "cyan" },
    { "light": "#e6ffb3", "dark": "pink" },
    { "light": "#b3b3ff", "dark": "lightgreen" },
    { "light": "#ffd9b3", "dark": "magenta" },
    { "light": "#ffb3ff", "dark": "cornflowerblue" },
    { "light": "#b3ffb3", "dark": "orange" },
    { "light": "#ffff80", "dark": "green" },
    { "light": "#d1e0e0", "dark": "red" }                                        
    ...
],
"highlightwords.box": {
    "light": false,
    "dark": true
},
"highlightwords.defaultMode": {
    "default": 0
}

"highlightwords.showSidebar": {
    "default": true
}

highlight-words's People

Contributors

rsbondi avatar toyorg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

highlight-words's Issues

Configuration.defaultMode issue in vscode setting.json

Hello,

Setting highlightwords.defaultMode to 1 (whole word) in setting.json does not work. Is there any way that can fix this? Thanks.
My current version of vscode running environment is as follows:
highlight-words version: v0.1.4
Version: 1.48.2 (user setup)
Commit: a0479759d6e9ea56afa657e454193f72aef85bd0
Date: 2020-08-25T10:13:11.295Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.19041

Add a toggle highlight to match vim plugin?

The vim plugin multihightlight has a m that maps to a toggle highlight. Would be nice to have that here too so the experience would be closer to the original vim behavior.

I mapped this as close as I could. Maybe this will be of use to other vim users wanting a similar keybinding:

    "vim.normalModeKeyBindingsNonRecursive": [
        {
            "before": ["<leader>", "m"],
            "commands": [
                "highlightwords.addHighlight"
            ]
        },
        {
            "before": ["<leader>", "M"],
            "commands": [
                "highlightwords.removeHighlight"
            ]
        },
        {
            "before": ["<leader>", "N"],
            "commands": [
                "highlightwords.removeAllHighlights"
            ]
        }
    ],

dont work with VSC 1.13.0

I just updated version 1.13.0 and it has stopped working. I reinstalled the extension and it does not work either

Random color

Thanks for this plug-in! Use it all the time!

There is one thing I would like to have though: if word is already highlighted, applying addHighlight again changes color to the next one. Ideally to a random color, not predefined. In this case I would press addHighlight few times to get a color I like.

Thanks!

setting foreground color

After the code is highlighted, it is easy to be confused with the background color of the plug-in, resulting in unclear.

I think it would be very helpful if the foreground color can be customized.

example:
image

Select color when highlighting

Hello, thanks for the great plugin, is the option possible when I myself want to control the selection color:
For example, I have a palette of 2 colors, red and green, I would like to be able to choose a color with which I plan to select text, also assign a hot key to a selection with the selected color.

Highlight on select

Could you had the option to highlight on mouse select? And remove highlight when selection is unselected.

Allow configuring the text colour when using a dark theme with box.dark: false

I am currently experimenting with background colours with dark themes, but have run into the problem that the colour is either too bright or may make the hard-coded text colour #555555 hard to read.
image
I'd like to suggest a config option be added to suppress the hard-coded colour or allow it to be changed.
Thank you for this extension; I found it quite useful.

one issue on partial highlight

Hi,
I am a big fan of this plugin since it provides me exactly the same feature as Source Insight highlight.
I found an issue as follows:

void remove(int i);
void remove(int i, int n);
inline void removeFirst() { Q_ASSERT(!isEmpty()); erase(d->begin()); }
inline void removeLast();

when we want to highlight remove, removeFirst and removeLast also got highlighted partially. For most programmers, this is unexpected behavior. Because it's normal that two variables have some common part in their names.

Could you please try to fix this issue?

count how many occurrences

Will be great if in front of occurrence have a counter with hit count like 1/x for navigation.

tks for your work for communit.

Highlight whole word by default?

Can you add highlight "whole word" by default as an option or settings? Right now it seems that I can only highlight whole word by selecting highlight selection with options every time.

Remove all on close

HI rsbonidi,

love your extension - I had something similar in Emacs and Sublime and use it all the time to review code quickly.
A configuration I miss: if highlights could be removed when the window/file is closed. This wuold be an easier way to "remove all" :)

Thanks for this!

Is there a way to run this automatically?

I'm wondering if there is a way to have the selection and the matches highlighted automatically? I mean without having to open the command palette etc.
Thanks a lot!

Configurable colors & highlight current word & highlight background

Hello! First of all, thank you for the very useful extension! On vim I used Marks (http://www.vim.org/scripts/script.php?script_id=2666) and I missed similar functionality a lot on VSCode. Now to the point:

  1. Configurable colors. Could you please add an option so that user could specify custom colors? I wish I could add custom palette generated, for example, with colorbrewer. Here it's important to use all colors the user has provided. For example, if there are 30 colors, please don't limit colorization to 8 internal colors provided by default.

  2. Add "Highlight current word" command. It's nice to have "Highlight selection" but I also miss a simpler version of it. In vim it was very handy to walk over variables in a function and highlight several of them pressing just one button (well, two actually in my case: ,m). I'd like to add a shortcut to this action when it's there. I think it also could be useful to have a configuration to what's a "word". Maybe a regexp for word separators or something similar. I'd like to have a similar action for "Remove all". At this moment I can do it but I need to choose my action in the menu. Is there a way to configure it without touching the mouse, just remove by a single command?

  3. Instead of adding a rectangular box, maybe you could alternatively fill the box and invert the text color or make it black, i.e. highlight using background. Here is how it looks in vim:

Thank you!

regex highligt issue

hi,

I want to highlight all paragraphs starting with lower case letters. But unfortunately, "^[a-z].*\n" is not recognized by the extension.

is there something I am missing?

Error message when using shortcut keys with highlight-words extension

@rsbondi I am using “highlight-words”, which is mostly working well. It can highlight specific words and allow me to use the mouse to click the left and right arrows in the sidebar to jump to the previous or next match. However, when I use the shortcut keys to do the same operation, I get an error message in the bottom right corner: “Cannot read properties of undefined (reading ‘highlight’)”. Could you please help me analyze why this happens and how to fix it?

defaultMode setting is ignored

Thank you for a great plugin! 👍

The default highlight mode is never loaded from my settings, though. Other settings like custom color are loaded ok. I suspect a bug, but I might be just doing something wrong. What I want to do is to use "whole word" mode in any and all files and projects without manually switching it.

The content of my ~/.config/Code/User/settings.json is:

{
    "highlightwords.colors": [
        { "light": "#d1e0e0", "dark": "red" },
        { "light": "#ffb3ff", "dark": "cornflowerblue" },
        { "light": "#b3ffb3", "dark": "orange" },
        { "light": "#ffd9b3", "dark": "magenta" },
        { "light": "#b3d9ff", "dark": "cyan" },
        { "light": "#b3b3ff", "dark": "lightgreen" },
        { "light": "#e6ffb3", "dark": "pink" },
        { "light": "#ffff80", "dark": "green" },
    ],
    "highlightwords.defaultMode": {
        "default": 1
    }
}

Continuous highlighting

Every time I reopen vscode, I lose my last highlighte-words, is there any way that can fix this in order to persist those words highlighting. thx

Problem configuring colors?

Dear rsbondi,

I would like to omit lightgreen as highlighting color because the contrast is too low on my screen, but no matter what configuration I tried in Visual Studio Code's settings.json, it had no effect.

--> Can you please correct any mistake in my below settings.json configuration:

{ 
"window.zoomLevel": -1,
    
    "highlightwords.colors:"  [
        { "light": "#b3d9ff", "dark": "cyan" },
        { "light": "#e6ffb3", "dark": "pink" },
        { "light": "#ffd9b3", "dark": "magenta" },
        { "light": "#ffb3ff", "dark": "cornflowerblue" },
        { "light": "#b3ffb3", "dark": "orange" },
        { "light": "#ffff80", "dark": "green" },
        { "light": "#d1e0e0", "dark": "red" }
    ]   
}

or advise where else I am supposed to enter this configuration code?

(Instead of "highlightwords.colors" I also tried "highlight.configuration.colors" because that's what I found in the extensions' description in VSC, but that didn't work, either).

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.