i on a subdirectory in the dired mode inserts that directory in the buffer. How can I remove it from the buffer?
TL;DR: Type C-uk on the subdirectory header line.
(emacs) Subdirectories in Dired:
Use the ‘l’ command (‘dired-do-redisplay’) to update the subdirectory’s contents, and use ‘C-u k’ on the subdirectory header line to remove the subdirectory listing (see Dired Updating). You can also hide and show inserted subdirectories (see Hiding Subdirectories).
If you use ‘k’ to kill the line for a directory file which you had inserted in the Dired buffer as a subdirectory (see Subdirectories in Dired), it removes the subdirectory listing as well. Typing ‘C-u k’ on the header line for a subdirectory also removes the subdirectory line from the Dired buffer.
(emacs) Hiding Subdirectories:
“Hiding” a subdirectory means to make it invisible, except for its header line. ‘$’ Hide or show the subdirectory that point is in, and move point to the next subdirectory (‘dired-hide-subdir’). This is a toggle. A numeric argument serves as a repeat count.
How I navigated the manual:
- C-hr (
- i (
subdirTABRET (autocompletes to
subdirectories in Dired)