We couldn't find that page...

Were you looking for one of these?

Lua Comments
Before we get into Lua itself, let's first talk about comments. Comments are text annotations in code that are ignored when the script is executed, but help people reading the code understand it. We use comments throughout our examples to explain what is happening a different points in the code, as well as to show the values of variables and other important information. Because comments are used to help document this behavior, let's start with explain what they are and how to read them. There are two types of comments in Lua: Line Comments Line comments are delimited with two dashes, as in --. When Lua encounters this delimiter, it ignores any content to the right of the delimiter. For example: -- This entire line is a comment print(123)--- The print statement executes, then this is ignored We will often use comments in examples to either: Explain the operations performed on a line, or Show the output or value of a variable on a line Block Comments Block comments are similar to line comments, except they apply to entire blocks of code. When there is an entire block of code to comment out, there are two choices. First, every line in the block case be commented with a line comment: -- local a = 123 -- -- print(a) -- -- a = 456 -- -- print(a) which is perfectly valid, though often less convenient than using a block comment: --[[ local a = 123 print(a) a = 456 print(a) ]] In the second example, the block comment starts with the --, which is followed by double-square brackets [[ which define the start of the block comment. Everything between the start of the block and the end of the block, defined by the closing double-square brackets ]], is considered a comment and ignored.
What is the Shell?
As described in the previous section, when a terminal is opened it runs software that provides access to the computer's operating system. This software has became known as "the shell ". Let's take a quick at how that name came to be used. At a high level, operating systems are designed with two distinct parts: A first part which contains the low-level software that has complete control of system resources. A second part which "surrounds" the first to prevent access to it, except for specific, pre-defined actions that application software are allowed to take. This concept has been visualized as a nut contained within its shell, where the meat of the nut (the "kernel ") contains the low-level software, and the hard shell that surrounds it prevents outside access except for specific, pre-defined "system calls ", such as those defined by "the Linux API . With this in mind, when users open a terminal they are presented with an application that accepts commands that are typed in the terminal, executes them, and returns the output to the terminal interface. This application provides users an interface to make system calls, call other applications, and execute scripts that define higher-level interactions with the operating system. Since these "shell applications" allow users to interact directly with the shell, they have become synonymous with "the shell". On Linux systems, the most common shell application is Bash , which is often installed by default, though other popular shell applications include ksh , zsh , and fish . Since Bash is the most common shell we will use it for examples, but most shells feature backwards-compatibility with Bash so most examples should work across other shells. As terminals evolved from hardware to software, the boundaries between the terminal and the shell became increasingly blurred, to the point where the concepts of "the terminal", a "terminal emulator", "the console", and "the shell" have become interchangeable in many conversations, which has led to confusion about what each term actually refers to. Possibly the most common term for these concepts among users is "the command-line", which is the topic of the next section.
Counts in Neovim Commands
Counts have two jobs in commands , based upon where they are located in the command . When placed in front of the motion counts are multipliers of that motion . For example, to delete a word one can use dw (short for delete word). Step 1 Initial Conditions I have always believed, and I still believe, that whatever good or bad fortune may come our way we can always give it meaning and transform it into something of value. NORMAL 40% 2:1 Step 2 Delete textdw I have always believed, and I still believe, whatever good or bad fortune may come our way we can always give it meaning and transform it into something of value. NORMAL 40% 2:1 Step 1 shows the initial conditions, while Step 2 shows the result of executing dw . As expected, one word was deleted. To delete multiple words, we can add a count in front of the motion . For example, let's try executing d4w (literally, "delete 4 words"): Step 1 Initial Conditions I have always believed, and I still believe, that whatever good or bad fortune may come our way we can always give it meaning and transform it into something of value. NORMAL 40% 2:1 Step 2 Delete textd4w I have always believed, and I still believe, bad fortune may come our way we can always give it meaning and transform it into something of value. NORMAL 40% 2:1 When the count is placed in front of the entire command , it means "repeat the entire command count times". So, let's try executing 4dw , which means "delete a word, repeating 4 times": Step 1 Initial Conditions I have always believed, and I still believe, that whatever good or bad fortune may come our way we can always give it meaning and transform it into something of value. NORMAL 40% 2:1 Step 2 Delete text4dw I have always believed, and I still believe, bad fortune may come our way we can always give it meaning and transform it into something of value. NORMAL 40% 2:1 Counts can also be located in both places. For example, we can achieve the same result a 3rd way using 2d2w , which means "delete two words, repeating twice": Step 1 Initial Conditions I have always believed, and I still believe, that whatever good or bad fortune may come our way we can always give it meaning and transform it into something of value. NORMAL 40% 2:1 Step 2 Delete text2d2w I have always believed, and I still believe, bad fortune may come our way we can always give it meaning and transform it into something of value. NORMAL 40% 2:1 The end result of these examples were the same, which can be common for simple commands such as these, through in general commands can have very different results based upon which count location is used. The important thing to take away from this section is that counts can appear in multiple locations of the command , and they preform slightly different tasks based on where they are located.
Neovim Commands
Interacting with content in Vim is generally performed using commands. "Command" is a fairly broad term in Vim, and applies to a wide variety of commands, used for navigation, editing, etc. Commands can take several forms depending on the context such as the current mode : In normal mode Commands are made up of one or more operators, counts, motions, and text objects, and general follow one of the following patterns: [count]{operator}{[count]motion} or [count]{operator}{text object} In command-line mode commands are issued in the command-line, and are typically of the form: :[range]{command} [args] Commands are less-common in insert mode, but those that are available are typically of the form: <C-{operator}> This format is also common for commands that affect menus and the like. When working with windows in Vim, commands take the form: <C-W>{operator} Individual commands will be discussed in their respective sections, but the purpose of this section is provide some information about their constituent parts.