what does vim.api.nvim_put(lines,”l”,true,true) do

The function vim.api.nvim_put is a part of Neovim’s Lua API, which allows you to interact with the editor programmatically. The function signature is: vim.api.nvim_put(lines, type, after, follow) Here’s what each parameter does: • lines: A list of strings to be inserted. • type: Specifies the type of operation. “l” indicates linewise, meaning the lines will be inserted as whole lines.
• after: A boolean value. If true, the lines are inserted after the current line; if false, they are inserted before. • follow: A boolean value. If true, the cursor will move to the last inserted line; if false, the cursor will stay in its original position. So, vim.api.nvim_put(lines, “l”, true, true) inserts the given lines after the current line and moves the cursor to the last inserted line.

what is the difference between vim.api.nvim_put(lines,”l”,true,true) vim.api.nvim_put(lines,”c”,true,true)

#;# what is the difference between linewise and characterwise in neovim

In Neovim, the difference between linewise and characterwise pertains to how text is selected or operated upon in visual and command modes:

  1. Characterwise: This mode allows you to select or manipulate text at the character level. When you enter visual mode with v, you can select text character by character. This is useful for precise editing, such as selecting a specific portion of a line.

  2. Linewise: This mode operates on entire lines. When you enter visual line mode with V, the entire lines are selected. This is useful for operations that need to affect whole lines, such as moving or deleting multiple lines at once.

These modes provide flexibility in text manipulation, allowing for both granular and broad operations.


This site uses Just the Docs, a documentation theme for Jekyll.