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 ...
22
votes
Accepted
How can I find the path to an executable with Emacs Lisp?
@Sigma's answer is a good start, but it doesn't filter by executability, nor does it allow for extra suffixes. On windows, for example, running a can invoke a.exe, if that's what's in your path.
So ...
20
votes
Accepted
Open large files?
I suggest you use the vlf package.
It handles opening larges files in chunks and is very performant, I use it regularly to open files ~2gb.
In your config, require vlf-setup to have vlf ask you if ...
20
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 ...
18
votes
Spacemacs: kill buffer and kill window in one command?
spacemacs binding for kill-buffer-and-window:
Cx,4,0
17
votes
Open file in new window after searching it with helm
I'm using Spacemacs (on Windows 10 if that matters) with the default keybindings. This may differ from your configuration, but I found the following ways to open files via Helm-Find-Files:
Open Helm-...
15
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 ...
13
votes
Edit file with super-user rights
There are today many packages that solve this problem (as of 2018). Some of them are:
sudo-edit, allows to switch editing rights on an already opened read-only file. Just M-x sudo and type a password ...
13
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.
...
12
votes
Accepted
How to do a simple write to file
Use with-temp-file; this is documented at M-: (info "(elisp) Writing to Files") (also available online).
This takes a filename or path and a list of body forms. It creates a temporary buffer, then ...
11
votes
Can I view within Emacs the properties of a file which I already opened?
There doesn't seem to be a command to get this info interactively, although you can use dired as @jrm suggests.
You can get this information with the following elisp code:
(file-attributes (buffer-...
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
(...
10
votes
How do I reload a file in a buffer?
you can also enable global-auto-revert-mode as shown below
(global-auto-revert-mode 1)
this is helpful when you do a lot of checks of your js files with auto-fix mode enabled, like in jssc.
9
votes
How to do a simple write to file
f third-party library has f-write-text and some other file manipulation functions, such as f-exists? predicate:
(f-write-text "some string" 'utf-8 "path/to/my/file.txt")
9
votes
Accepted
Can I view within Emacs the properties of a file which I already opened?
Here is a command that uses dired with verbose file flags for the ls command. You may want to customize those flags depending on your operating system.
(defun file-info ()
(interactive)
(let ((...
9
votes
Accepted
Ignoring specific files in recentf-mode
(add-to-list 'recentf-exclude "company-statistics-cache.el")
or more accurately
(add-to-list 'recentf-exclude
(recentf-expand-file-name "~/.emacs.d/company-statistics-...
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.
8
votes
Accepted
Setting default-directory does not change find-file directory
According to the documentation:
default-directory is a variable defined in ‘C source code’. Its value
is "~/" Local in buffer *scratch*; global value is nil
Automatically becomes permanently ...
8
votes
Why do some files generated by emacs have a tilde after their name?
These are backup files created by Emacs. See Backup in the Emacs Manual.
The manual also says this:
When Emacs makes a backup file, its name is normally constructed by appending ~ to the file name ...
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 ...
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 ...
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.
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 ~/...
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-...
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 ...
7
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.
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 ...
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 ...
7
votes
Accepted
How to delete all instances of a character in a bunch of files?
Unless you want an interactive confirmation, which you presumably don't since you're automatic the replacement of all occurrences, call replace-string or replace-regexp instead of query-replace-string ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
files × 288buffers × 37
dired × 32
find-file × 17
org-mode × 16
directories × 14
tramp × 12
saving × 11
elisp × 10
microsoft-windows × 10
init-file × 8
hooks × 7
helm × 6
window × 6
projectile × 6
start-up × 6
recentf × 6
permissions × 6
osx × 5
search × 5
completion × 5
functions × 5
ivy × 5
debugging × 4
frames × 4