diff options
| author | Mohammad Reza Karimi <m.r.karimi.j@gmail.com> | 2026-01-20 15:55:27 -0500 |
|---|---|---|
| committer | Mohammad Reza Karimi <m.r.karimi.j@gmail.com> | 2026-01-20 15:55:27 -0500 |
| commit | aa5717f00fd14430c80939a68d7107c26de6e554 (patch) | |
| tree | 784e99d9b018e0554369c41cb33e2e195e28d3c6 /after/ftplugin/python.lua | |
first commit
Diffstat (limited to 'after/ftplugin/python.lua')
| -rw-r--r-- | after/ftplugin/python.lua | 29 |
1 files changed, 29 insertions, 0 deletions
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 ]]) |
