Doom, dired: h and l to navigate, SPC m o to sort
This commit is contained in:
parent
4bc86245c4
commit
58e01b0e61
3 changed files with 72 additions and 0 deletions
|
@ -47,6 +47,8 @@
|
||||||
(setq my-unignored-buffers '("*ielm*" "*scratch*" "*ansi-term*" "*term*"))
|
(setq my-unignored-buffers '("*ielm*" "*scratch*" "*ansi-term*" "*term*"))
|
||||||
|
|
||||||
(setq insert-on-mode #s(hash-table size 30 data (shell-mode insert term-mode term-send-raw-string prog-mode insert!)))
|
(setq insert-on-mode #s(hash-table size 30 data (shell-mode insert term-mode term-send-raw-string prog-mode insert!)))
|
||||||
|
|
||||||
|
(setq compression-extensions '("7z" "7zip" "zip" "zstd" "tar\..*"))
|
||||||
(defun eval-string (string)
|
(defun eval-string (string)
|
||||||
"Evals all the commands inside the string"
|
"Evals all the commands inside the string"
|
||||||
(eval (car (read-from-string (format "(progn %s)" string)))))
|
(eval (car (read-from-string (format "(progn %s)" string)))))
|
||||||
|
@ -301,6 +303,19 @@
|
||||||
;; i i
|
;; i i
|
||||||
(map! :i "i i" #'evil-normal-state)
|
(map! :i "i i" #'evil-normal-state)
|
||||||
)
|
)
|
||||||
|
(defun get-file-type (file &optional deref-symlinks)
|
||||||
|
"Return the type of FILE, according to the `file' command.
|
||||||
|
If you give a prefix to this command, and FILE is a symbolic
|
||||||
|
link, then the type of the file linked to by FILE is returned
|
||||||
|
instead."
|
||||||
|
(let (process-file-side-effects)
|
||||||
|
(with-temp-buffer
|
||||||
|
(if deref-symlinks
|
||||||
|
(process-file "file" nil t t "-bL" "--" file)
|
||||||
|
(process-file "file" nil t t "-b" "--" file))
|
||||||
|
(when (bolp)
|
||||||
|
(backward-delete-char 1))
|
||||||
|
(buffer-string))))
|
||||||
(map! :n "g r" #'evil-replace-with-register)
|
(map! :n "g r" #'evil-replace-with-register)
|
||||||
(evil-replace-with-register-install)
|
(evil-replace-with-register-install)
|
||||||
(map! :n "SPC w D" #'delete-other-windows)
|
(map! :n "SPC w D" #'delete-other-windows)
|
||||||
|
@ -328,6 +343,23 @@
|
||||||
(interactive)
|
(interactive)
|
||||||
(mark-real-user-buffer)
|
(mark-real-user-buffer)
|
||||||
))
|
))
|
||||||
|
(map! :map 'dired-mode-map :n "A" (lambda () (interactive) (find-alternate-file "..")))
|
||||||
|
(map! :map 'dired-mode-map :n "a"
|
||||||
|
(lambda ()
|
||||||
|
(interactive)
|
||||||
|
(if (equal (get-file-type (dired-get-file-for-visit)) "directory")
|
||||||
|
(dired-find-alternate-file)
|
||||||
|
(dired-find-file))
|
||||||
|
))
|
||||||
|
(map! :map 'dired-mode-map :n "l"
|
||||||
|
(lambda ()
|
||||||
|
(interactive)
|
||||||
|
(if (equal (get-file-type (dired-get-file-for-visit)) "directory")
|
||||||
|
(dired-find-alternate-file)
|
||||||
|
(dired-find-file))
|
||||||
|
))
|
||||||
|
(map! :map 'dired-mode-map :n "SPC m o" #'hydra-dired-quick-sort/body)
|
||||||
|
(map! :map 'dired-mode-map :n "h" (lambda () (interactive) (find-alternate-file "..")))
|
||||||
(ii-mode)
|
(ii-mode)
|
||||||
;; Why is not working?
|
;; Why is not working?
|
||||||
;; (ii-mode org-mode-map "org-mode-map")
|
;; (ii-mode org-mode-map "org-mode-map")
|
||||||
|
|
|
@ -100,6 +100,8 @@ If you intend to use org, it is recommended you change this!
|
||||||
(setq my-unignored-buffers '("*ielm*" "*scratch*" "*ansi-term*" "*term*"))
|
(setq my-unignored-buffers '("*ielm*" "*scratch*" "*ansi-term*" "*term*"))
|
||||||
|
|
||||||
(setq insert-on-mode #s(hash-table size 30 data (shell-mode insert term-mode term-send-raw-string prog-mode insert!)))
|
(setq insert-on-mode #s(hash-table size 30 data (shell-mode insert term-mode term-send-raw-string prog-mode insert!)))
|
||||||
|
|
||||||
|
(setq compression-extensions '("7z" "7zip" "zip" "zstd" "tar\..*"))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* Custom functions
|
* Custom functions
|
||||||
|
|
||||||
|
@ -372,6 +374,22 @@ ii mode:
|
||||||
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun get-file-type (file &optional deref-symlinks)
|
||||||
|
"Return the type of FILE, according to the `file' command.
|
||||||
|
If you give a prefix to this command, and FILE is a symbolic
|
||||||
|
link, then the type of the file linked to by FILE is returned
|
||||||
|
instead."
|
||||||
|
(let (process-file-side-effects)
|
||||||
|
(with-temp-buffer
|
||||||
|
(if deref-symlinks
|
||||||
|
(process-file "file" nil t t "-bL" "--" file)
|
||||||
|
(process-file "file" nil t t "-b" "--" file))
|
||||||
|
(when (bolp)
|
||||||
|
(backward-delete-char 1))
|
||||||
|
(buffer-string))))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
* Custom keybindings
|
* Custom keybindings
|
||||||
Replace with Regiser:
|
Replace with Regiser:
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
@ -431,6 +449,26 @@ Real buffer:
|
||||||
(mark-real-user-buffer)
|
(mark-real-user-buffer)
|
||||||
))
|
))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
** Dired
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(map! :map 'dired-mode-map :n "A" (lambda () (interactive) (find-alternate-file "..")))
|
||||||
|
(map! :map 'dired-mode-map :n "a"
|
||||||
|
(lambda ()
|
||||||
|
(interactive)
|
||||||
|
(if (equal (get-file-type (dired-get-file-for-visit)) "directory")
|
||||||
|
(dired-find-alternate-file)
|
||||||
|
(dired-find-file))
|
||||||
|
))
|
||||||
|
(map! :map 'dired-mode-map :n "l"
|
||||||
|
(lambda ()
|
||||||
|
(interactive)
|
||||||
|
(if (equal (get-file-type (dired-get-file-for-visit)) "directory")
|
||||||
|
(dired-find-alternate-file)
|
||||||
|
(dired-find-file))
|
||||||
|
))
|
||||||
|
(map! :map 'dired-mode-map :n "SPC m o" #'hydra-dired-quick-sort/body)
|
||||||
|
(map! :map 'dired-mode-map :n "h" (lambda () (interactive) (find-alternate-file "..")))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
** 'ii' in INSERT mode to escape to NORMAL mode:
|
** 'ii' in INSERT mode to escape to NORMAL mode:
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
|
|
@ -54,4 +54,6 @@
|
||||||
(package! highlight-operators)
|
(package! highlight-operators)
|
||||||
(package! highlight)
|
(package! highlight)
|
||||||
(package! yafolding)
|
(package! yafolding)
|
||||||
|
(package! ranger)
|
||||||
|
(package! dired-quick-sort)
|
||||||
(package! ido-vertical-mode) ; not being used
|
(package! ido-vertical-mode) ; not being used
|
||||||
|
|
Loading…
Reference in a new issue