Pages

Thursday, October 19, 2023

vim args

In Vim, "args" typically refer to the list of files you're working with, and Vim provides several shortcuts and commands to work with this argument list. Here are some common Vim shortcuts and commands for working with arguments:

  1. :args <file1> <file2> ... - Set the argument list to a specific list of files.

  2. :args *.txt - Set the argument list to all files matching a pattern (e.g., all .txt files in the current directory).

  3. :argadd <file> - Add a file to the argument list.

  4. :argdelete - Remove the current file from the argument list.

  5. :args - List all files in the current argument list.

  6. :argnext (or :an) - Go to the next file in the argument list.

  7. :argprev (or :ap) - Go to the previous file in the argument list.

  8. :argfirst - Go to the first file in the argument list.

  9. :arglast - Go to the last file in the argument list.

  10. :argdo <command> - Execute a command on all files in the argument list. For example, :argdo :%s/foo/bar/g would replace "foo" with "bar" in all files.

  11. :args $mylist - Set the argument list from a variable.

  12. :argopen - Open all files in the argument list in separate windows.

  13. :arglist - Display the argument list and the cursor position within each file.

No comments:

Post a Comment