Skip to content

Commit b287cca

Browse files
authored
fix: register command for nvim <0.7 (#138)
## 📃 Summary closes #137 the method used to register the command is only available in Neovim 0.7 and higher, this should cover older versions.
1 parent 54f0043 commit b287cca

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

plugin/no-neck-pain.lua

+7-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ end
44

55
_G.NoNeckPainLoaded = true
66

7-
vim.api.nvim_create_user_command("NoNeckPain", function()
8-
require("no-neck-pain").toggle()
9-
end, {})
7+
if vim.fn.has("nvim-0.7") == 0 then
8+
vim.cmd("command NoNeckPain lua require('no-neck-pain').toggle()")
9+
else
10+
vim.api.nvim_create_user_command("NoNeckPain", function()
11+
require("no-neck-pain").toggle()
12+
end, {})
13+
end

0 commit comments

Comments
 (0)