From the documentation:
dired-dwim-target is a variable defined in `dired.el'. Its value is
Documentation: If non-nil, Dired tries to guess a default target
directory. This means: if there is a Dired buffer displayed in the
next window, use its current directory, instead of this Dired buffer's
The target is used in ...
Use C-x C-f and type out /su::/etc/hostname or /sudo::/etc/hostname as applicable.
This uses the TRAMP package, which is distributed with Emacs. This package provides access to remote files, and more generally to files that Emacs can't open directly.
@Malabarba mentioned the use of wgrep package for editing grep/ack/ag results.
I would like to write a detailed walk-through of how I use the ag package and wgrep-ag packages to achieve editing of 'ag'ged results using multiple-cursors package.
These packages are available through Melpa. You also need to have ag aka the_silver_searcher installed on your ...
Move the cursor to the directory header line (where the directory is shown - e.g., use M-<), then hit w. That copies the directory name to the kill ring. (w copies any file name from Dired, and it works for the directory header too.)
And if you haven't already done so, customize x-select-enable-clipboard to non-nil, so selection is copied to the ...
Additionally you can use dired-subtree from dired-hacks repo.
Here you have short demo and screenshot from my setup where I press i to drill down folder and ; to go back.:
(define-key dired-mode-map "i" 'dired-subtree-insert)
(define-key dired-mode-map ";" 'dired-subtree-remove)
I'm also aware of direx which looks like that: :
There are a couple of options for this.
You can check out dirtree, which is based on dired.
There is also an emacs port of vim's NERDTree called neotree.
Both are excellent packages, though I tend to favor neotree as it has convenient bindings to let me create and delete files and directories. I do not believe dirtree has this support, though I could be ...
C-h f dired tells you the answer. Just pass to dired, as the DIRNAME argument, a list that has as its car the Dired buffer name you want (any string) and as cdr the list of file names you want listed in the buffer. Generally, you want to use absolute file names. For example:
(dired (list "My Dired Buffer Name*" ; The Dired buffer name
Dependent on your desktop environment the method to set a default application may differ. That said, many desktop environments respect the associations in ~/.local/share/applications/mimeapps.list, where you can set up an association for the application/x-directory and/or inode/directory types.
My mimeapps.list looks like this now:
Write a custom function for dired-initial-position-hook. In this function you can use various dired functions to search for files, and eventually call dired-goto-file to move point to the “best” file:
(defun my-dired-goto-important-file ()
"Go to an important file in the current dired buffer."
(unless (bound-and-true-p save-place)
(let ((candidates ...
When you are saying "I am using tramp via ssh" I suppose you open a file like /ssh:host:/path/to/file. This is supposed to use always the ssh method. If you want to use the scp method, you shall use /scp:host:/path/to/file. This uses automatically ssh for short files, and scp for large files. If you trust the default method set in tramp-default-method, you ...
C-u C-x d
This let's you enter arguments for how Dired should list files. By default it says -al at the prompt. Add R to that, ending up with -alR. Type RET.
Select/type a directory and then press RET.
This will recursively open all directories from the one you select, and below.
From here, type % m to mark all files matching a certain file ...
What I would like to do is to either quickly build a dired buffer from existing grep output [...], or transform grep output into a list of buffers for multi-occur [...].
You don't need to convert the grep results buffer into anything, there's already a mode specifically for editing grep output (and reflecting the changes on the files, of course).
The emacs 25.1 release will have in-built support for handling different kinds of archives from within dired. Below is the relevant excerpt from the NEWS file (C-h C-n).
*** The command `dired-do-compress' bound to `Z' now can compress
directories and decompress zip files.
*** New command `dired-do-compress-to' bound to `c' can be used ...
Customize option auto-revert-verbose to nil. C-h v tells you this:
auto-revert-verbose is a variable defined in autorevert.el.
Its value is t
When nil, Auto-Revert Mode does not generate any messages.
When non-nil, a message is generated whenever a file is reverted.
You can customize this variable.
It's kind of a ...
Yes, you can do that. You don't need to (explicitly) use FTP. Just use C in Dired to copy from one directory to the other. You can copy in either direction: from local to remote or remote to local.
Dired buffer #1 is for local directory ~jpepin/mydir/.
Dired buffer #1 is for remote directory /foo.bar.toto.com:/home/jpepin/mydir/.
Just use function dired-get-marked-files. It gives you a list of the marked file and directory names. And then just use funcall or apply to pass them to a function.
(You can also use w in Dired to copy the marked names, separated by spaces, to a (single) string on the kill-ring, which you can then yank to insert them as a group wherever you want.)
With your keyboard setup, the key ^ is most probably a "dead key". It is a key meant to be used in conjunction with another one, in order to produce another character. In this case, it is meant to produce accented characters : ^e will produce ê, ^a will produce â and so on.
It should not be specific to emacs though : I guess all your applications require ...
GNU's ls has an option --group-directories-first, and you can control the list of options passed to ls by dired with the variable dired-listing-switches (assuming that you haven't already customized this, you'd set it to -al --group-directories-first).
Unfortunately, on Windows, emacs usually uses lisp emulation of ls and as you can see from ...
Do you have many Dired buffers because you wanted them all at one point? IOW, did you want to create each of them as separate buffers?
If not, the solution is simple: tell Dired to reuse an existing Dired buffer when you hit RET a directory name to open it in Dired.
Here is how to do that:
Load library Dired+ (dired+.el):
Tell Dired to ...
Instead of add another function to kill all dired buffers, I suggest you take advantage of filter groups in ibuffer, it allow you to group buffer by many condition.
Here is a example to set filter groups:
;; I create a group call Dired, which contains all buffer in dired-...
In Dired you can include a subdirectory using i, with the cursor on the subdir line.
You can do likewise on a subdir line within a subdir listing, so you can list any number of levels of any number of subdirs in the same Dired buffer.
$ on a subdir-listing header line hides/shows that subdir listing. So it corresponds more or less with the expand/contract ...
Use find-file with tramp. At the prompt /sudo::/etc/ssh/ssh_config will use sudo and a subshell to open that file with root privileges. When sudo is first used it will prompt for a password, but until that session closes you can edit any file with those permissions by prefixing with the existing /sudo:: command.
See http://www.gnu.org/software/tramp/ for ...
You can invoke dired with an argument, ie. C-u C-x d and after prompting for the directory it will also let you modify the switches passed to ls. Add R and dired will recursively list all sub-directories, each in it's own section.
If you only want to see the contents of some sub-directories, press i when the point is on a directory name.
You can also use ...
Here is my super hacky way to simulate key down/up event binding by taking advantage of timers.
Overall I would suggest going by Sigma's answer, but you asked for a way to close the preview by letting go so I'm obliged to try.
Basically what you can do is bind some function that will be your "keydown" function to a keybinding and inside that action, start ...
Use function directory-files, for which C-h f tells you:
directory-files is a built-in function in `C source code'.
(directory-files DIRECTORY &optional FULL MATCH NOSORT)
Return a list of names of files in DIRECTORY.
There are three optional arguments:
If FULL is non-nil, return absolute file names. Otherwise return names
that are relative to the ...
Firstly, take note of JeanPierre's comment -- you're not renaming files by using convert like that. You're creating new and different files (lower quality ones, although the difference may or may not matter in practice, depending on your use-cases).
Here are a few different options for renaming files in dired using a number sequence. The first two are ...