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

docs: default keymap for running watch file results in an error #61

Open
perzhul opened this issue Aug 23, 2024 · 0 comments
Open

docs: default keymap for running watch file results in an error #61

perzhul opened this issue Aug 23, 2024 · 0 comments

Comments

@perzhul
Copy link
Contributor

perzhul commented Aug 23, 2024

This keymap from docs

vim.api.nvim_set_keymap(
      'n',
      '<leader>twf',
      "<cmd>lua require('neotest').run.run({ vim.fn.expand(" % "), vitestCommand = 'vitest --watch' })<cr>",
      { desc = 'Run Watch File' }
    )

Returns the following error upon execution: attempt to perform arithmetic on a string value because of double quotes surrounding % sign. They should be changed to single quotes - that's the solution that worked for me. Because unless you change it, lua thinks that string is like this "lua require('neotest').run.run({ vim.fn.expand("

Fix:

vim.api.nvim_set_keymap(
      'n',
      '<leader>twf',
      "<cmd>lua require('neotest').run.run({ vim.fn.expand(' % '), vitestCommand = 'vitest --watch' })<cr>",
      { desc = 'Run Watch File' }
    )
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

No branches or pull requests

1 participant