Skip to content

Wrong visual selection when evil motion vi" within quotes and templating strings with ${...} is used #205

@zzantares

Description

@zzantares

I have a file like:

{ profile, pkgs, lib, ... }:

{
  programs.librewolf = {
    languagePacks = [ "en-US" ];

    profiles."${profile.login}" = {
      id = 0;
      settings = {
        "browser.search.defaultenginename" = "DuckDuckGo";
      };
    };
  };
}

when my cursor/point is within "...." for example in this line (see | showing cursor position):

...
        "brow|ser.search.defaultenginename" = "DuckDuckGo";
...

and then I do vi" to select everything within quotes (which calls evil-visual-char under the hood), I get the whole attribute set under profiles selected:

Image

My expectation is that it should only highlight what's within quotes, i. e. browser.search.defaultenginename.

I think this has something to do with the presence of profiles."${profile.login}" = part, because if I don't do any templating there, then vi" works as expected.

I'm reporting this issue here because so far nix-mode is the only mode where I'm able to see this issue, I'm happy to help debug/fix but I just don't know where to start to look, any help is very much appreciated!

emacs-version:

GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.18.2, Xaw3d scroll bars)

doom-version:

Doom core     v3.0.0-pre       grafted, HEAD -> master, origin/master, origin/HEAD b55d988 2025-02-21 18:35:36 -0500
Doom modules  v25.03.0-pre     grafted, HEAD -> master, origin/master, origin/HEAD b55d988 2025-02-21 18:35:36 -0500

evil-version:

Evil version 1.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions