From aa5717f00fd14430c80939a68d7107c26de6e554 Mon Sep 17 00:00:00 2001 From: Mohammad Reza Karimi Date: Tue, 20 Jan 2026 15:55:27 -0500 Subject: first commit --- after/ftplugin/python.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 after/ftplugin/python.lua (limited to 'after/ftplugin/python.lua') diff --git a/after/ftplugin/python.lua b/after/ftplugin/python.lua new file mode 100644 index 0000000..2f1a564 --- /dev/null +++ b/after/ftplugin/python.lua @@ -0,0 +1,29 @@ +local function keyword_help(kw) + local buf = vim.api.nvim_create_buf(false, true) + local win = vim.api.nvim_open_win(buf, true, { + anchor = "SE", + split = "below", + height = 20, + }) + local obj = vim.system({ "pydoc-markdown", "-m", kw }):wait() -- "--render-toc"?? + vim.api.nvim_buf_set_lines(buf, -1, -1, false, vim.split(obj.stdout, "\n")) + vim.bo[buf].filetype = "markdown" + vim.bo[buf].swapfile = false +end + +vim.api.nvim_create_user_command("PyDoc", function(params) + if #params.fargs > 0 then + keyword_help(params.fargs[1]) + end +end, { + bar = true, + range = true, + addr = "other", + nargs = "*", + complete = function(...) + vim.print("completion request: " .. vim.inspect(...)) + return nil + end, +}) + +vim.cmd([[ setlocal keywordprg=:PyDoc ]]) -- cgit v1.2.3-71-gdd5e