The example below is not working (error is given when neovim is opened not recognising $env_var) how can I let him recognise the env_var?

g = {

name = “+grep”,

a = { “Telescope grep_string”, “Grep on all dirs” },

s = { “Telescope grep_string search_dirs={”$env_var/dir1/dir2/dir3/“} cr>”, “Grep on dir” },

},

Thanks

  • lckdscl [they/them]@whiskers.bim.boats
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    Vimscript: "Telescope grep_string search_dirs=["$HOME/.config"]"

    Lua: require("telescope.builtin").grep_string({ search_dirs = { os.get_env("HOME") .. "/.config" } })

    • dafunkkk@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      1 year ago

      tried this but still not woking (tried with and without … )

      s = { “Telescope grep_string search_dirs={os.get_env(“prj_path”) … “/dir1/dir2/dir3/”} cr>”, “Grep on dir3” }

      what’s wrong?

      • lckdscl [they/them]@whiskers.bim.boats
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        1 year ago

        You’re mixing Lua with Vimscript, the stuff with in double quotes should be in Vimscript

        s = { "Telescope grep_string search_dirs=['$prj_path/dir1/dir2/dir3/'] cr>", "Grep on dir3" }

        • dafunkkk@lemmy.worldOP
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          1 year ago

          I’m very sorry, but I don’t understad how should I do to let it work in lua (I’m using init.vim but this part is under lua << EOF)