Skip to main content
31 votes

Ivy disable completion for a command in minibuffer

I think what you're looking for is C-M-j (ivy-immediate-done) in the mini buffer. This function is described as follows in the Ivy manual: Exits with the current input instead of the current ...
tirocinium's user avatar
23 votes

Recursively list all files and sub-directories

directory-files-recursively (I think this was added in Emacs 25) here's the link to the manual: https://www.gnu.org/software/emacs/manual/html_node/elisp/Contents-of-Directories.html Return all ...
wvxvw's user avatar
  • 11.5k
18 votes

Spacemacs: kill buffer and kill window in one command?

spacemacs binding for kill-buffer-and-window: Cx,4,0
sjas's user avatar
  • 311
16 votes
Accepted

how to ignore current selection from ivy when my typed text matches one

C-M-j (ivy-immediate-done) - exit with the current action, calling it on the current input instead of the current candidate. This is useful especially when creating new files or directories - often ...
Adrian Staniec's user avatar
15 votes

How to prevent creating files starting with .# (lock files)?

How I can prevent generating the lock file .#rest.api.rc? Set the user option create-lockfiles to nil, but note that this can stop Emacs from being able to detect simultaneous edits to the same file. ...
Basil's user avatar
  • 12.6k
11 votes
Accepted

Recursively list all files and sub-directories

Assuming you use ivy you can use this function (defun fhd/counsel-everything () "list everything recursively" (interactive) (let* ((cands (split-string (...
fhdhsni's user avatar
  • 713
9 votes
Accepted

Spacemacs: kill buffer and kill window in one command?

Spacemacs has recently added two shortcuts for kill-buffer-and-window: SPC b x and SPC w x.
sid-kap's user avatar
  • 544
8 votes

Spacemacs: kill buffer and kill window in one command?

Use kill-buffer-and-window to close a buffer and its window. But this will keep emacs running. If you also want to kill emacs (the equivalent of :q) then try evil-quit-all if you're using evil, and ...
mclear's user avatar
  • 1,605
8 votes
Accepted

Display recursive folder sizes in-line in dired?

Indeed, Alex is right. If your Emacs version is >=24.4, then you can try `dired-du' library. It's available from the ELPA repository. Once you've installed this lib: If your current buffer is in ...
Tino's user avatar
  • 430
8 votes

Comparing two text files on a Windows system

If you have git for windows installed, then it is enough to add C:\Program Files\Git\usr\bin\ to your PATH, because it already ships with a diff executable and installs it in that folder.
FlyingFoX's user avatar
  • 191
8 votes

What's the equivalent of `helm-find` in ivy/counsel? I want to find files **recursively**

The counsel equivalent of helm-find is counsel-file-jump. See also counsel-dired-jump and John Kitchin's answer for suggestions on writing a custom function.
Basil's user avatar
  • 12.6k
8 votes

Ivy disable completion for a command in minibuffer

There are multiple approaches to file navigation that apply here. Just to rephrase your statement: switch from ~/code/study to ~/other/code/study Easiest and most consistent: use ~ to switch to ~/...
abo-abo's user avatar
  • 14.3k
8 votes
Accepted

Why does calling expand-file-name indirectly produce a different result?

In short: dynamic binding. It is maybe a little unfortunate that default-directory was used as the argument to expand-file-name. Note the docstring: (expand-file-name NAME &optional DEFAULT-...
phils's user avatar
  • 53k
8 votes

Dired: How to find all files under a directory that match a glob pattern (wildcards)?

Use command find-name-dired. M-x find-name-dired RET my-directory RET *.txt That opens Dired to a listing of all files matching glob pattern *.txt in and under directory my-directory. The usual ...
Drew's user avatar
  • 79.1k
7 votes

How do I reload a file in a buffer?

For spacemacs users: SPC b R (spacemacs/safe-revert-buffer). For skipping confirmation, other answers already cover that, though I agree with others that it's probably not a good idea to bind that to ...
Croad Langshan's user avatar
7 votes

Edit file with super-user rights

If you use Helm. You don't need any external package / additional config. it works out of the box. Inside helm-find-files you can invoke find file as root which bound to C-c r. This works for files ...
azzamsa's user avatar
  • 644
7 votes
Accepted

Single function to return file contents as a string

There is not. You can report-emacs-bug and suggest that one be included. One reason I can think of for not including such a function is that there are different reasonable ways to handle errors. E.g. ...
Tianxiang Xiong's user avatar
7 votes

Get file name relative to projectile root

I think the reason your code is not working as hoped for is because you are using the buffer-local variable projectile-project-root instead of the eponymous function. C-hvprojectile-project-rootRET ...
Basil's user avatar
  • 12.6k
7 votes
Accepted

Open directory containing file during counsel-file-jump

You can create a new Ivy action that opens the directory of a file name selection. It can be done with: (defun my/ivy-open-dir-action (x) (interactive) (dired (or (file-name-directory x) ...
Wanderley Guimarães's user avatar
7 votes
Accepted

Why Emacs (dired+) asks me twice to delete file?

So when you open a file it creates a 'buffer' with the file's contents. The first yes moves the physical file to the trash. But the 'buffer' is still loaded in Emacs. If you say no to the second ...
Greth's user avatar
  • 355
6 votes

How do I search and replace over a set of files?

Using rgrep and wgrep: M-xrgrep. Enter the regex to search for. Enter the glob pattern matching which files to search in. Select the base directory to search in. Results will be shown in a grep ...
glennsl's user avatar
  • 161
6 votes

Edit file with super-user rights

If you use the ivy package, and have configured counsel-find-file to replace find-file, then one of the "ivy actions" pre-configured for you already is to edit the file as root. The default hydra ...
user1404316's user avatar
6 votes

Recursively list all files and sub-directories

This answer assumes that you want to display a listing of the file and dir names, instead of obtaining a Lisp list of them. Use standard Emacs commands find-dired , find-name-dired, or find-grep-...
Drew's user avatar
  • 79.1k
6 votes
Accepted

Get filename from dired using elisp

I imagine the function dired-get-filename is what you're looking for? Or perhaps dired-get-file-for-visit would be more useful (being a wrapper which handles some common errors).
phils's user avatar
  • 53k
6 votes
Accepted

How can I open an org file at a specific header postion via a command line?

Perhaps something along the following lines: emacs -Q --eval='(progn (find-file "/path/to/file") (goto-char (org-find-exact-headline-in-buffer "org-headline")))'
aadcg's user avatar
  • 1,248
5 votes

How do I reload a file in a buffer?

Magit manages file reversions for you automatically, thus solving your core problem. You also benefit from its other features. Here are the docs for tweaking the settings you're interested in: If you ...
webappzero's user avatar
5 votes

Human readable directory tree with org-attach

Define ATTACH_DIR Property Under Each Heading to Set an Human Readable Directory Path for Attachments Place cursor, a.k.a point, on heading. For this example, choose This headline * This headline **...
Melioratus's user avatar
  • 4,758
5 votes
Accepted

tagging files for filtering

If you use library Bookmark+ then yes, you can do this easily. Tagging files using Bookmark+ means creating autofile bookmarks for the files and then adding tags for those bookmarks. You can think ...
Drew's user avatar
  • 79.1k
5 votes
Accepted

What are the '.#' links for?

Symbolic links of the form “.#*” are not auto-save files, their purpose is to prevent the simultaneous editing of the same file. See Interlocking and File Locks in the Emacs Manual.
dliotev's user avatar
  • 66

Only top scored, non community-wiki answers of a minimum length are eligible