emacs-macos/src/modules/built-in/emacs.org

70 lines
2.1 KiB
Org Mode

#+begin_src elisp
(use-package emacs
:bind
(("C-c f f" . toggle-frame-fullscreen))
:config
;; Disable tool-bar
(tool-bar-mode -1)
;; Enable horizontal mouse scroll
(setq mouse-wheel-tilt-scroll t)
;; Enable electric indent mode
(electric-pair-mode t)
;; Switch meta command key
(setq mac-command-modifier 'meta)
;; Enable which-key
(which-key-mode)
;; Enable completion preview
;;(global-completion-preview-mode)
;; Set font
(set-face-attribute 'default t :font "JetBrains Mono" :height 120)
;; Fontify code blocks in markdown mode
;;(setq markdown-fontify-code-blocks-natively t)
;; Enable SPC option in minibuffer
;;(define-key minibuffer-local-completion-map (kbd "SPC") 'self-insert-command)
;; Enable SPC option in minibuffer
;;(define-key minibuffer-local-completion-map (kbd "SPC") 'self-insert-command)
;; Enable fido mode
;;(setq fido-mode t)
;;(fido-vertical-mode)
;;(defun my-icomplete-styles ()
;; (setq-local completion-styles '(orderless)))
;;(add-hook 'icomplete-minibuffer-setup-hook 'my-icomplete-styles)
;; Disable native comp warnings
(setq native-comp-async-report-warnings-errors 'silent)
;; Save history of minibuffer
(savehist-mode)
;; Set cursor type
(setq-default cursor-type 'bar)
;; Automatically reread from disk if the underlying file changes
(setq auto-revert-interval 1)
(setq auto-revert-check-vc-info t)
(global-auto-revert-mode)
;; Don't litter file system with *~ backup files; put them all inside
(defun my--backup-file-name (fpath)
"Return a new file path of a given file path. If the new path's directories does not exist, create them."
(let* ((backupRootDir "~/.config/emacs/emacs-backup/")
(filePath (replace-regexp-in-string "[A-Za-z]:" "" fpath )) ; remove Windows driver letter in path
(backupFilePath (replace-regexp-in-string "//" "/" (concat backupRootDir filePath "~") )))
(make-directory (file-name-directory backupFilePath) (file-name-directory backupFilePath))
backupFilePath))
(setq make-backup-file-name-function 'my--backup-file-name)
)
#+end_src