Emacs: file and Dired basics

  Рет қаралды 13,269

Protesilaos Stavrou

Protesilaos Stavrou

Күн бұрын

Video overview of file navigation in Emacs. There are lots of powerful commands to find files, open directories, and perform operations on the contents of the filesystem. Technically, I talk about `find-file`, `dired` and its numerous accoutrements, the minibuffer and its histories, file permissions, keyboard macros, and projects.
The configurations I recommend are available on my website, in the publication about this video: protesilaos.co...
[ You can find all my work on my website. ]

Пікірлер: 58
@chsdfsbwersdf2568
@chsdfsbwersdf2568 Жыл бұрын
Your videos are showing me just how much of a powerhouse Emacs really is. Thanks a lot!
@protesilaos
@protesilaos Жыл бұрын
You are welcome!
@mcxds
@mcxds 11 ай бұрын
Your videos are doing a great job at making the capabilites of Emacs acessible for users coming from a non-technical background. Thank you very much! 0:00 Introduction 1:00 The 'find-file' command; Navigating and opening directories and files 10:17 Accessing and navigating history of prior searches 12:10 Navigating by using an absolute file system path 15:02 The 'vertico' and the 'marginalia' package 17:28 Finding files and directories by typing just abbreviations 19:14 Configure dired to hide details (dired-hide-details-mode) 20:11 'dired-jump' (C-x C-j): command for jumping to parent directory 21:29 'dired-directory-up (^) 22:20 'dired-find-file-other-window' (o) 24:07 Moving and renaming files 25:38 How to delete a file (D) 26:45 How to rename a file (R) 29:13 Operating on multiple files at once 32:22 Making dired buffer editable (C-x C-q), save changes with C-C C-c 33:32 Recording a keyboard macro 36:26 Using dired as a dual pane file manager 39:00 Create an empty file by visiting a file that doesn't exist with C-x C-f 39:58 Mark files that match a given regexp (% m) 41:54 Remove marked items from the current listing without deleting (k) 44:40 Remove everything except marked items from the current listing by toggling the mark (t) and (k) 46:34 Introduction to file permissions 48:17 How to modify file permissions 51:11 A few more commands 51:45 project-find-file 53:32 Introducing the 'consult' package 54:07 Searching with 'consult-find' 56:25 Use dired to open files externally 1:00:37 How to populate the minibuffer with the file at point in a buffer 1:01:34 The 'dired' command for opening directories
@protesilaos
@protesilaos 11 ай бұрын
Thank you!
@teddykayy
@teddykayy Ай бұрын
These are beautiful
@protesilaos
@protesilaos Ай бұрын
Thank you!
@256k_
@256k_ 11 ай бұрын
this video was filmed on my birthday. i remember exactly what i was doing while you were filming this video
@AndersJackson
@AndersJackson Жыл бұрын
One of the best and efficient video/instructions for find-file and dired. Thanks a lot!
@AndersJackson
@AndersJackson Жыл бұрын
I personally hate the use of octal numbers for rights, as that is so easy to make a mistake. And Never Use 7 Except in the first group. Because you should NEVER give OTHERS write access to files or directories. That is a security threats, and only experience users should use that right.
@protesilaos
@protesilaos Жыл бұрын
You are welcome!
@protesilaos
@protesilaos Жыл бұрын
Indeed, 7 for everybody is a bad idea.
@Dar1gaaz
@Dar1gaaz Жыл бұрын
Prot, happy to see you back on Emacs track and full of energy as it seems. Have a great Sunday, greetings from Germany
@protesilaos
@protesilaos Жыл бұрын
Thank you! Best regards from the mountains of Cyprus.
@Dar1gaaz
@Dar1gaaz Жыл бұрын
what I find useful for quickly searching a dir full of files is to just use n and p to move point up and down in dired and then visit a file with letter v and exiting it with q. that is blazingly fast and as it does not require the kill buffer shortcut
@protesilaos
@protesilaos Жыл бұрын
Yes, this is nice.
@CaribouDataScience
@CaribouDataScience 5 ай бұрын
Thanks, the set header and auto align features are pretty spiffy!
@protesilaos
@protesilaos 4 ай бұрын
You are welcome!
@10cadr
@10cadr Жыл бұрын
Very nice. It is always good to see you mastering Emacs and being so understandable in showcasing everything. Also, I noticed along your life trajectory, you master (or have good knowledge) about a wide range of things. Emacs, linux in general (wms scripts), philosophy, politics, and just recently the construction area. ` How do you learn things? Learning is a wide area discussed in psychology, pedagogy, and philosophy. Although we have a variety of yt content on the subject, it is not quite rich in content and is just "show off quick methods" in order to "hack your brain". Just a curiosity and a way to compliment your intelligence. Thanks for taking the time to record this video. Much appreciated.
@protesilaos
@protesilaos Жыл бұрын
Thank you! I will have to do a video about this topic in particular. Hints of how I approach it are provided in the talk about "Productivity, honesty, and accountability structures": protesilaos.com/books/2023-02-21-productivity-honesty-accountability-structures/
@vinvivofikas9973
@vinvivofikas9973 Жыл бұрын
thank you for the detailed information.
@protesilaos
@protesilaos Жыл бұрын
You are welcome!
@gnu-lynx2501
@gnu-lynx2501 Жыл бұрын
excellent recap of the basics. Brothers of the true church make no proselytes! :)
@protesilaos
@protesilaos Жыл бұрын
Haha, thanks!
@connorcreegan
@connorcreegan Жыл бұрын
thanks mate.
@protesilaos
@protesilaos Жыл бұрын
You are welcome!
@omerkasapoglu501
@omerkasapoglu501 Жыл бұрын
;; I can't do without those dired configurations ;; I find dired-jump very useful, jump to current directory of the current buffer (define-key global-map (kbd "C-x C-") 'dired-jump) ;; Makes the dired buffer uncluttered and more clear (add-hook 'dired-mode-hook 'dired-hide-details-mode) ; hide ls information, show only file names (add-hook 'dired-mode-hook 'hl-line-mode) ; highlight current line on dired buffers ;; using double paned midnight commander's like workflow (setq dired-dwim-target t) ;; Delete files by trashing, it is safer than just deleting (setq delete-by-moving-to-trash t) ;;; optional stuff (setq dired-recursive-copies 'always) (setq dired-recursive-deletes 'top) (setq dired-create-destination-dirs 'ask)
@protesilaos
@protesilaos Жыл бұрын
Nice! I also set most of these.
@gmmigge
@gmmigge Жыл бұрын
Just wow, I think I just stumbled on my favorite Emacs channel, very well done! I love the pace and you keep it interesting at all times, no meaningless chatting about irrelevant stuff. I have a kind of unrelated question which you may have a separate video about (sorry, haven't explored all your content yet): I couldn't help by noticing your very clean environment. I assume you're using a tiling window manager, and I see no panels or chrome around the windows. Could you share what setup you're using when it comes window management? Thanks again!
@protesilaos
@protesilaos Жыл бұрын
Yes, it is a tiling window manager. I have all the configurations in my dotfiles: github.com/protesilaos/dotfiles
@josephs1732
@josephs1732 9 ай бұрын
The more I watch these videos the more it's harder for me to use other editors. Emacs ruined everything else for me
@protesilaos
@protesilaos 9 ай бұрын
I guess you have to use those other editors? If not, then using Emacs full time is the way to go.
@josephs1732
@josephs1732 5 ай бұрын
Four months later, I ditched everything else and now use Emacs full-time. Your videos are amazing! I wouldn't have found the motivation if I hadn't come across them.
@cricocrak
@cricocrak Ай бұрын
I love your videos, you are an excelent teacher! I have a question: How do you see the icons next to the names in dired? Mine only shows the name, not the pretty icons you have next. Thank you!
@protesilaos
@protesilaos Ай бұрын
Thank you! You need to install and set up the 'nerd-icons-dired' package: github.com/rainstormstudio/nerd-icons-dired. This will pull in the 'nerd-icons' dependency. Once you have these, do 'M-x nerd-icons-install-fonts' and then restart Emacs. You should now see icons in Dired buffers.
@cricocrak
@cricocrak Ай бұрын
@@protesilaos Thank you! It worked like a charm
@vishnu3014
@vishnu3014 7 ай бұрын
Could you please clarify how to get the icons next to the files and directories in the buffer ? I'm unable to see it in my dired installation of emacs.
@whatevermait1
@whatevermait1 Жыл бұрын
no 1 best man
@protesilaos
@protesilaos Жыл бұрын
Thanks!
@256k_
@256k_ 11 ай бұрын
I love your theme! please tell me what theme this is! i've been looking for something bright and colorful that looks good
@protesilaos
@protesilaos 11 ай бұрын
This is the ef-elea-light theme from my package ef-themes.
@user-fx5iy5dl2o
@user-fx5iy5dl2o Жыл бұрын
amazing as always Prot! Do you have any code handy so that 'RET' runs the default program suggested after calling '(dired-do-async-shell-command'? E.g hitting 'RET' on video opens it with mpv etc
@protesilaos
@protesilaos Жыл бұрын
Here is the first idea that comes to mind: ;; NOTE 2023-06-27: This user option is quick-and-dirty. I prefer not ;; to have an option at all and simply do the right thing based on ;; `dired-guess-shell-alist-user'. (defcustom prot-dired-always-external-regexp "\\(mkv\\|mp4\\|mp4\\|ogg\\|m4a\\|webm\\)" "Regular expression of file extensions to open externally. The test is performed by `prot-dired-open-dwim', which then defers to the `dired-guess-shell-alist-user'." :group 'prot-dired :type 'string) ;; NOTE 2023-06-27: This is a proof-of-concept. See the previous ;; note. (defun prot-dired-open-dwim (files) "Open FILES using the appropriate program." (interactive (list (dired-get-marked-files))) (if-let* ((extension (file-name-extension (car files))) ((string-match-p extension prot-dired-always-external-regexp)) (guess (dired-guess-default files)) (program (if (listp guess) (car guess) guess))) (dired-do-async-shell-command program nil files) (find-file (car files))))
@user-fx5iy5dl2o
@user-fx5iy5dl2o Жыл бұрын
@@protesilaos It works! thanks very much!
@EdouardTavinor
@EdouardTavinor 10 ай бұрын
1:01:25 oh, i didn't know that!
@protesilaos
@protesilaos 10 ай бұрын
That's basically the story of every Emacs user: always learning something new.
@10cadr
@10cadr 10 ай бұрын
Hi, Prot! I think in one of your videos you have a dired view that shows full file paths for each file, unlikely the normal view that is the heading for the folder the files are in then their names listed. Can you shed some light how I can have full file name lists instead of the default view? I know this sounds kinda dumb, but I want to have a dired buffer that lists all files under a directory and mark some files comparing to a another dired buffer containing symlinks. If I want to edit or delete or add these symlinks, I will make a macro so Emacs will mark them all, comparing the two buffers, so I can keep track and not mark all the musics again and eventually forget some. I am pretty sure I have some duplicates filenames, so path+filename is the safer way to do it. That's how I am planning to sync music across my phone and computer (local music gang + syncthing + emacs shenanigans).
@protesilaos
@protesilaos 10 ай бұрын
I don't remember. There is an option to consolidate arbitrary file paths into a single Dired buffer, though I am not sure this is what you have in mind. Otherwise, you may be referring to Dired's ability to insert the contents of a subdirectory in the current buffer (I use that frequently). Please let me know and I am happy to help.
@OneTwoFf
@OneTwoFf Жыл бұрын
Hi Prot, Do you know how to always use short version on a folder? Right now I have to press ( to toggle short mode.
@joseluis_io
@joseluis_io Жыл бұрын
(add-hook 'dired-mode-hook 'dired-hide-details-mode)
@protesilaos
@protesilaos Жыл бұрын
Exactly what @joseluis_io wrote.
@OneTwoFf
@OneTwoFf Жыл бұрын
Thanks a lot!
@jakeh.8754
@jakeh.8754 Жыл бұрын
I don't think its default behaviour for emacs to read as you type and update the displayed files. Maybe you have some setting enabled that I'm not aware of
@protesilaos
@protesilaos Жыл бұрын
The default minibuffer requires that you type TAB to update what it displays in the "Completions" buffer. Whereas Vertico displays the matches live.
@jakeh.8754
@jakeh.8754 Жыл бұрын
@@protesilaos I apologize for commenting before finishing the video and seeing the vertico section. May I ask now how you are getting icons in dired? Also, do you ever use dark themes?
@protesilaos
@protesilaos Жыл бұрын
@jakeh.8754 The icons are done with the 'all-the-icons-dired' package. It depends on the 'all-the-icons' package. Install the latter, then do M-x all-the-icons-install-fonts. Once the fonts are installed, set up the activation of the aforementioned mode with: (add-hook 'dired-mode-hook 'all-the-icons-dired-mode) Yes, I do use light themes. Though only when the environmental light is low. I like all the dark themes in the packages 'modus-themes' and 'ef-themes' (developed by me).
@auntiecarol
@auntiecarol Жыл бұрын
Your Emacs videos should come with a NSFT (Not Safe For Tinkerers) warning! I just know before even watching this, that I'm going to pick up some 'Oh, that's neat' trick, and want to `C-x b` my init.el This time I shall resist.
@protesilaos
@protesilaos Жыл бұрын
Good point! I guess this warning should go with every Emacs-related publication. There is just so much to learn and experiment with!
@ISCARI0T
@ISCARI0T Жыл бұрын
emacs or vim?
Emacs: search and replace basics
53:03
Protesilaos Stavrou
Рет қаралды 10 М.
Emacs: mark and register basics
35:34
Protesilaos Stavrou
Рет қаралды 6 М.
SPILLED CHOCKY MILK PRANK ON BROTHER 😂 #shorts
00:12
Savage Vlogs
Рет қаралды 49 МЛН
This Dumbbell Is Impossible To Lift!
01:00
Stokes Twins
Рет қаралды 34 МЛН
Emacs: Org mode basics
48:31
Protesilaos Stavrou
Рет қаралды 14 М.
Linux from Scratch
2:35:42
Titus Tech Talk
Рет қаралды 154 М.
Emacs. But why?
51:20
(Bit-Mage)
Рет қаралды 1,2 М.
Emacs: modern minibuffer packages (Vertico, Consult, etc.)
44:01
Protesilaos Stavrou
Рет қаралды 14 М.
Interview with an Emacs Enthusiast in 2023 [Colorized]
8:50
Programmers are also human
Рет қаралды 1,2 МЛН
The Tragedy of systemd
47:18
linux.conf.au
Рет қаралды 1,1 МЛН
OSCP Practice Lab: Active Directory Attack Path #1
1:57:02
Derron C
Рет қаралды 53 М.
Emacs: control where buffers are displayed (the 'display-buffer-alist')
29:52
The 6 Emacs Settings Every User Should Consider
15:41
System Crafters
Рет қаралды 35 М.
The Only Debate That Matters: Vim VS Emacs
19:47
Andrew Giraffe
Рет қаралды 16 М.