diff options
author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2023-09-14 08:23:01 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-14 08:23:01 -0500 |
commit | 2e92065686f62851318150a315591c30b8306a4b (patch) | |
tree | 3d4d216f7b031cd2e966380f9b32d1aae472d32f /runtime/lua/vim/_editor.lua | |
parent | 9fc321c9768d1a18893e14f46b0ebacef1be1db4 (diff) | |
download | rneovim-2e92065686f62851318150a315591c30b8306a4b.tar.gz rneovim-2e92065686f62851318150a315591c30b8306a4b.tar.bz2 rneovim-2e92065686f62851318150a315591c30b8306a4b.zip |
docs: replace <pre> with ``` (#25136)
Diffstat (limited to 'runtime/lua/vim/_editor.lua')
-rw-r--r-- | runtime/lua/vim/_editor.lua | 96 |
1 files changed, 51 insertions, 45 deletions
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index 64aeb64736..0215cae0cb 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -70,23 +70,24 @@ vim.log = { --- Run a system command --- --- Examples: ---- <pre>lua --- ---- local on_exit = function(obj) ---- print(obj.code) ---- print(obj.signal) ---- print(obj.stdout) ---- print(obj.stderr) ---- end +--- ```lua --- ---- -- Run asynchronously ---- vim.system({'echo', 'hello'}, { text = true }, on_exit) +--- local on_exit = function(obj) +--- print(obj.code) +--- print(obj.signal) +--- print(obj.stdout) +--- print(obj.stderr) +--- end --- ---- -- Run synchronously ---- local obj = vim.system({'echo', 'hello'}, { text = true }):wait() ---- -- { code = 0, signal = 0, stdout = 'hello', stderr = '' } +--- -- Run asynchronously +--- vim.system({'echo', 'hello'}, { text = true }, on_exit) --- ---- </pre> +--- -- Run synchronously +--- local obj = vim.system({'echo', 'hello'}, { text = true }):wait() +--- -- { code = 0, signal = 0, stdout = 'hello', stderr = '' } +--- +--- ``` --- --- See |uv.spawn()| for more details. --- @@ -200,7 +201,8 @@ do --- (such as the |TUI|) pastes text into the editor. --- --- Example: To remove ANSI color codes when pasting: - --- <pre>lua + --- + --- ```lua --- vim.paste = (function(overridden) --- return function(lines, phase) --- for i,line in ipairs(lines) do @@ -210,7 +212,7 @@ do --- overridden(lines, phase) --- end --- end)(vim.paste) - --- </pre> + --- ``` --- ---@see |paste| ---@alias paste_phase -1 | 1 | 2 | 3 @@ -361,32 +363,33 @@ local VIM_CMD_ARG_MAX = 20 --- command. --- --- Example: ---- <pre>lua ---- vim.cmd('echo 42') ---- vim.cmd([[ ---- augroup My_group ---- autocmd! ---- autocmd FileType c setlocal cindent ---- augroup END ---- ]]) --- ---- -- Ex command :echo "foo" ---- -- Note string literals need to be double quoted. ---- vim.cmd('echo "foo"') ---- vim.cmd { cmd = 'echo', args = { '"foo"' } } ---- vim.cmd.echo({ args = { '"foo"' } }) ---- vim.cmd.echo('"foo"') +--- ```lua +--- vim.cmd('echo 42') +--- vim.cmd([[ +--- augroup My_group +--- autocmd! +--- autocmd FileType c setlocal cindent +--- augroup END +--- ]]) +--- +--- -- Ex command :echo "foo" +--- -- Note string literals need to be double quoted. +--- vim.cmd('echo "foo"') +--- vim.cmd { cmd = 'echo', args = { '"foo"' } } +--- vim.cmd.echo({ args = { '"foo"' } }) +--- vim.cmd.echo('"foo"') --- ---- -- Ex command :write! myfile.txt ---- vim.cmd('write! myfile.txt') ---- vim.cmd { cmd = 'write', args = { "myfile.txt" }, bang = true } ---- vim.cmd.write { args = { "myfile.txt" }, bang = true } ---- vim.cmd.write { "myfile.txt", bang = true } +--- -- Ex command :write! myfile.txt +--- vim.cmd('write! myfile.txt') +--- vim.cmd { cmd = 'write', args = { "myfile.txt" }, bang = true } +--- vim.cmd.write { args = { "myfile.txt" }, bang = true } +--- vim.cmd.write { "myfile.txt", bang = true } --- ---- -- Ex command :colorscheme blue ---- vim.cmd('colorscheme blue') ---- vim.cmd.colorscheme('blue') ---- </pre> +--- -- Ex command :colorscheme blue +--- vim.cmd('colorscheme blue') +--- vim.cmd.colorscheme('blue') +--- ``` --- ---@param command string|table Command(s) to execute. --- If a string, executes multiple lines of Vim script at once. In this @@ -871,9 +874,10 @@ end --- "Pretty prints" the given arguments and returns them unmodified. --- --- Example: ---- <pre>lua ---- local hl_normal = vim.print(vim.api.nvim_get_hl_by_name('Normal', true)) ---- </pre> +--- +--- ```lua +--- local hl_normal = vim.print(vim.api.nvim_get_hl_by_name('Normal', true)) +--- ``` --- --- @see |vim.inspect()| --- @see |:=| @@ -900,10 +904,12 @@ end --- Translate keycodes. --- --- Example: ---- <pre>lua ---- local k = vim.keycode ---- vim.g.mapleader = k'<bs>' ---- </pre> +--- +--- ```lua +--- local k = vim.keycode +--- vim.g.mapleader = k'<bs>' +--- ``` +--- --- @param str string String to be converted. --- @return string --- @see |nvim_replace_termcodes()| |