feat(emacs): a function to open a yadm-managed file

This commit is contained in:
Pavel Korytov 2021-03-27 21:54:12 +03:00
parent 93a0573fc4
commit 0e3b17edb6
2 changed files with 58 additions and 28 deletions

View file

@ -70,19 +70,6 @@
:weight 'bold)
:straight t)
(defun my/edit-configuration ()
"Open the init file."
(interactive)
(find-file "~/Emacs.org"))
;; (defun my/edit-exwm-configuration ()
;; "Open the exwm config file."
;; (interactive)
;; (find-file "~/.emacs.d/exwm.org"))
(general-define-key "C-c c" 'my/edit-configuration)
;; (general-define-key "C-c C" 'my/edit-exwm-configuration)
(general-def :states '(normal insert visual)
"<home>" 'beginning-of-line
"<end>" 'end-of-line)
@ -874,6 +861,32 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
(add-hook 'org-babel-after-execute-hook 'org-redisplay-inline-images)
(add-hook 'org-mode-hook (lambda () (rainbow-delimiters-mode 0)))
(defun my/edit-configuration ()
"Open the init file."
(interactive)
(find-file "~/Emacs.org"))
;; (defun my/edit-exwm-configuration ()
;; "Open the exwm config file."
;; (interactive)
;; (find-file "~/.emacs.d/exwm.org"))
(general-define-key "C-c c" 'my/edit-configuration)
;; (general-define-key "C-c C" 'my/edit-exwm-configuration)
(defun my/open-yadm-file ()
"Open a file managed by yadm"
(interactive)
(find-file
(concat
(file-name-as-directory (getenv "HOME"))
(completing-read
"yadm files: "
(split-string
(shell-command-to-string "yadm ls-files $HOME --full-name") "\n")))))
(general-define-key "C-c f" 'my/open-yadm-file)
;; Disable GUI elements
(tool-bar-mode -1)
(menu-bar-mode -1)

View file

@ -110,21 +110,6 @@ One day we won't hate one another, no young boy will march to war and I will cle
:straight t)
#+end_src
** My keybindings
*** Open config
#+begin_src emacs-lisp
(defun my/edit-configuration ()
"Open the init file."
(interactive)
(find-file "~/Emacs.org"))
;; (defun my/edit-exwm-configuration ()
;; "Open the exwm config file."
;; (interactive)
;; (find-file "~/.emacs.d/exwm.org"))
(general-define-key "C-c c" 'my/edit-configuration)
;; (general-define-key "C-c C" 'my/edit-exwm-configuration)
#+end_src
*** Editing
#+begin_src emacs-lisp
(general-def :states '(normal insert visual)
@ -1127,6 +1112,38 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
(add-hook 'org-babel-after-execute-hook 'org-redisplay-inline-images)
(add-hook 'org-mode-hook (lambda () (rainbow-delimiters-mode 0)))
#+end_src
* Managing dotfiles
** Open Emacs config
#+begin_src emacs-lisp
(defun my/edit-configuration ()
"Open the init file."
(interactive)
(find-file "~/Emacs.org"))
;; (defun my/edit-exwm-configuration ()
;; "Open the exwm config file."
;; (interactive)
;; (find-file "~/.emacs.d/exwm.org"))
(general-define-key "C-c c" 'my/edit-configuration)
;; (general-define-key "C-c C" 'my/edit-exwm-configuration)
#+end_src
** Open dotfile
Open a file managed by yadm
#+begin_src emacs-lisp
(defun my/open-yadm-file ()
"Open a file managed by yadm"
(interactive)
(find-file
(concat
(file-name-as-directory (getenv "HOME"))
(completing-read
"yadm files: "
(split-string
(shell-command-to-string "yadm ls-files $HOME --full-name") "\n")))))
(general-define-key "C-c f" 'my/open-yadm-file)
#+end_src
* UI & UX
** GUI Settings
#+begin_src emacs-lisp