diff --git a/README.md b/README.md index e0d3f48..695f025 100644 --- a/README.md +++ b/README.md @@ -231,8 +231,7 @@ example: ## Credits -Thank you @TheSafdarAwan for PR #22 +Thanks to -## TODO - -* Make documentation on how to create a plugin +@TheSafdarAwan for PR #22 +@costowell for PR #32 diff --git a/lua/greyjoy/_extensions/cargo.lua b/lua/greyjoy/_extensions/cargo.lua index d2ccb0a..e30b832 100644 --- a/lua/greyjoy/_extensions/cargo.lua +++ b/lua/greyjoy/_extensions/cargo.lua @@ -14,7 +14,11 @@ local M = {} M.parse = function(fileinfo) if type(fileinfo) ~= "table" then - print("[cargo] fileinfo must be a table") + vim.notify( + "fileinfo must be a table", + vim.log.levels.ERROR, + { title = "Greyjoy cargo" } + ) return {} end diff --git a/lua/greyjoy/_extensions/docker_compose.lua b/lua/greyjoy/_extensions/docker_compose.lua index c06d9c3..1da5212 100644 --- a/lua/greyjoy/_extensions/docker_compose.lua +++ b/lua/greyjoy/_extensions/docker_compose.lua @@ -23,7 +23,11 @@ local M = {} M.parse = function(fileinfo) if type(fileinfo) ~= "table" then - print("[docker_compose] fileinfo must be a table") + vim.notify( + "fileinfo must be a table", + vim.log.levels.ERROR, + { title = "Greyjoy docker compose" } + ) return {} end diff --git a/lua/greyjoy/_extensions/generic.lua b/lua/greyjoy/_extensions/generic.lua index 2dca0ca..ae42643 100644 --- a/lua/greyjoy/_extensions/generic.lua +++ b/lua/greyjoy/_extensions/generic.lua @@ -22,7 +22,11 @@ local M = {} M.parse = function(fileobj) if type(fileobj) ~= "table" then - print("[generic] fileinfo must be a table") + vim.notify( + "fileinfo must be a table", + vim.log.levels.ERROR, + { title = "Greyjoy generic" } + ) return {} end diff --git a/lua/greyjoy/_extensions/init.lua b/lua/greyjoy/_extensions/init.lua index eeb0044..72bac46 100644 --- a/lua/greyjoy/_extensions/init.lua +++ b/lua/greyjoy/_extensions/init.lua @@ -9,7 +9,7 @@ local load_extension = function(name) if not ok then vim.notify( "Unable to require greyjoy._extensions." .. name, - vim.lsp.log_levels.ERROR, + vim.log.levels.ERROR, { title = "Plugin error" } ) return diff --git a/lua/greyjoy/_extensions/kitchen.lua b/lua/greyjoy/_extensions/kitchen.lua index d802c8a..bd2acd1 100644 --- a/lua/greyjoy/_extensions/kitchen.lua +++ b/lua/greyjoy/_extensions/kitchen.lua @@ -26,7 +26,11 @@ local uv = vim.uv M.parse = function(fileinfo) if type(fileinfo) ~= "table" then - print("[kitchen] fileinfo must be a table") + vim.notify( + "fileinfo must be a table", + vim.log.levels.ERROR, + { title = "Greyjoy kitchen" } + ) return {} end diff --git a/lua/greyjoy/_extensions/makefile.lua b/lua/greyjoy/_extensions/makefile.lua index 6a701bd..e8493e6 100644 --- a/lua/greyjoy/_extensions/makefile.lua +++ b/lua/greyjoy/_extensions/makefile.lua @@ -14,7 +14,11 @@ local M = {} M.parse = function(fileinfo) if type(fileinfo) ~= "table" then - print("[makefile] fileinfo must be a table") + vim.notify( + "fileinfo must be a table", + vim.log.levels.ERROR, + { title = "Greyjoy makefile" } + ) return {} end diff --git a/lua/greyjoy/_extensions/vscode_tasks.lua b/lua/greyjoy/_extensions/vscode_tasks.lua index 6b696fc..c307755 100644 --- a/lua/greyjoy/_extensions/vscode_tasks.lua +++ b/lua/greyjoy/_extensions/vscode_tasks.lua @@ -3,7 +3,7 @@ local ok, greyjoy = pcall(require, "greyjoy") if not ok then vim.notify( "This plugin requires greyjoy.nvim (https://github.com/desdic/greyjoy.nvim)", - vim.lsp.log_levels.ERROR, + vim.log.levels.ERROR, { title = "Plugin error" } ) return @@ -61,7 +61,11 @@ end M.parse = function(fileinfo) if type(fileinfo) ~= "table" then - print("[vscode_tasks] fileinfo must be a table") + vim.notify( + "fileinfo must be a table", + vim.log.levels.ERROR, + { title = "Greyjoy vscode_tasks" } + ) return {} end diff --git a/lua/greyjoy/init.lua b/lua/greyjoy/init.lua index df33588..800fc6b 100644 --- a/lua/greyjoy/init.lua +++ b/lua/greyjoy/init.lua @@ -147,13 +147,13 @@ end greyjoy.to_buffer = function(command) local bufnr = vim.api.nvim_create_buf(false, true) - vim.api.nvim_buf_set_option(bufnr, "filetype", "greyjoy") + vim.api.nvim_set_option_value("filetype", "greyjoy", { buf = bufnr }) local append_data = function(_, data) if data then - vim.api.nvim_buf_set_option(bufnr, "modifiable", true) + vim.api.nvim_set_option_value("modifiable", true, { buf = bufnr }) vim.api.nvim_buf_set_lines(bufnr, -1, -1, false, data) - vim.api.nvim_buf_set_option(bufnr, "modifiable", false) + vim.api.nvim_set_option_value("modifiable", false, { buf = bufnr }) end end @@ -178,8 +178,8 @@ greyjoy.to_buffer = function(command) focusable = true, } - vim.api.nvim_buf_set_option(bufnr, "modifiable", false) - vim.api.nvim_open_win(bufnr, 1, opts) + vim.api.nvim_set_option_value("modifiable", false, { buf = bufnr }) + vim.api.nvim_open_win(bufnr, true, opts) local commandstr = table.concat(command.command, " ") local shell_command = { greyjoy.default_shell, "-c", commandstr }