Skip to content

Trouble using grep_word_under_cursor with hybrid VimL/Lua config #97

@pmatulis

Description

@pmatulis

I can grep for files but I can't get the grep-under-cursor feature to work with my VimL/Lua hybrid configuration. Thanks in advance for any guidance.

E5108: Error executing lua [string ":lua"]:1: attempt to index field 'live_grep_args' (a nil value)
stack traceback:
        [string ":lua"]:1: in main chunk
Press ENTER or type command to continue

Here, I'm calling Telescope from init.vim:

.
.
.

source ~/.config/nvim/vim/mappings.vim

.
.
.

lua << EOF
require("telescope-conf")
EOF

Then in telescope-conf.lua:

local lga_actions = require("telescope-live-grep-args.actions")
local live_grep_args_shortcuts = require("telescope-live-grep-args.shortcuts")

.
.
.

    live_grep_args = {
      auto_quoting = false,
      search_dirs = {
        '/Users/pmatulis/git'
      }
    },

  }

}

require('telescope').load_extension('live_grep_args')

In mappings.vim:

nnoremap <leader>g <cmd>lua require('telescope').extensions.live_grep_args.live_grep_args()<CR>
nnoremap <leader>gc <cmd>lua require('telescope').live_grep_args.shortcuts.grep_word_under_cursor()<CR>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions