Add FreeBSD handling
This commit is contained in:
parent
c7d474425c
commit
59ba7cf999
3 changed files with 81 additions and 57 deletions
|
|
@ -1,13 +1,20 @@
|
|||
;;; 01mac -- summary
|
||||
;;; 01base.el --- summary
|
||||
|
||||
;; Author: Maciej Szlosarczyk
|
||||
;; Maintainer: Maciej Szlosarczyk
|
||||
;; Version: 0.1-snapshot
|
||||
|
||||
;;; Commentary:
|
||||
;;; Make Emacs play nicer with MacOS.
|
||||
|
||||
;; 01base defines basic packages and environment.
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;;;;;;;; GC configuration ;;;;;;;;;;;;;;;;;;;
|
||||
(setq gc-cons-threshold 50000000)
|
||||
|
||||
;;;;;;;; Other optimizations ;;;;;;;;;;;;;;;;;
|
||||
;; Stolen from Doom Emacs.
|
||||
;;;;;;;; Stolen from Doom Emacs. ;;;;;;;;;;;;;
|
||||
|
||||
;; Update emacs less often
|
||||
(setq idle-update-delay 1.0)
|
||||
|
|
@ -34,48 +41,12 @@
|
|||
|
||||
;;;;;;;;; Emacs bindings ;;;;;;;;;;;;;;;;;;;;;
|
||||
(global-set-key (kbd "RET") 'newline)
|
||||
|
||||
(setq mac-option-modifier 'meta)
|
||||
(setq mac-command-modifier 'hyper)
|
||||
|
||||
(defun mac-switch-meta nil
|
||||
"Switch meta between Option and Command."
|
||||
(interactive)
|
||||
(if (eq mac-option-modifier nil)
|
||||
(progn
|
||||
(setq mac-option-modifier 'meta)
|
||||
(setq mac-command-modifier 'hyper)
|
||||
)
|
||||
(progn
|
||||
(setq mac-option-modifier nil)
|
||||
(setq mac-command-modifier 'meta)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;;;;;;;;; Mac binding (fix) ;;;;;;;;;;;;;;;;;;
|
||||
(define-key global-map [home] 'beginning-of-line)
|
||||
(define-key global-map [end] 'end-of-line)
|
||||
(global-set-key (kbd "H-<right>") 'end-of-line)
|
||||
(global-set-key (kbd "H-<left>") 'beginning-of-line)
|
||||
(global-set-key (kbd "H-<up>") 'scroll-down) ; WTF is this reverse, I dunno
|
||||
(global-set-key (kbd "H-<down>") 'scroll-up)
|
||||
|
||||
(global-set-key [(hyper a)] 'mark-whole-buffer)
|
||||
(global-set-key [(hyper v)] 'yank)
|
||||
(global-set-key [(hyper x)] 'kill-region)
|
||||
(global-set-key [(hyper c)] 'kill-ring-save)
|
||||
(global-set-key [(hyper s)] 'save-buffer)
|
||||
(global-set-key [(hyper l)] 'goto-line)
|
||||
(global-set-key [(hyper w)]
|
||||
(lambda () (interactive) (delete-window)))
|
||||
(global-set-key [(hyper z)] 'undo)
|
||||
(global-set-key [(hyper q)] 'kill-emacs)
|
||||
|
||||
;;; Helpful key bindings
|
||||
(global-set-key (kbd "<f1> b") 'describe-bindings) ;; List all key bindings
|
||||
;; there are.
|
||||
|
||||
(global-set-key (kbd "C-c \\") 'split-window-right) ;; Split window to the right
|
||||
(global-set-key (kbd "C-c /") 'split-window-below) ;; Split window to the bottom
|
||||
|
||||
|
|
@ -170,21 +141,7 @@
|
|||
:if (memq window-system '(mac ns))
|
||||
:ensure t
|
||||
:config (add-to-list 'exec-path "/opt/local/bin")
|
||||
(exec-path-from-shell-initialize))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;; Window configuration ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Always start in fullscreen
|
||||
(defun toggle-fullscreen ()
|
||||
"Toggle full screen."
|
||||
(interactive)
|
||||
(set-frame-parameter
|
||||
nil 'fullscreen
|
||||
(when (not (frame-parameter nil 'fullscreen)) 'fullboth)))
|
||||
|
||||
(global-set-key (kbd "C-H-f") 'toggle-fullscreen)
|
||||
|
||||
;; Disable meta on right alt (useful for Polish characters)
|
||||
(setq mac-right-option-modifier nil)
|
||||
(exec-path-from-shell-initialize))
|
||||
|
||||
;; Draw underline lower
|
||||
(setq x-underline-at-descent-line t)
|
||||
|
|
@ -210,5 +167,5 @@
|
|||
|
||||
(which-key-mode t)
|
||||
|
||||
(provide '01mac)
|
||||
;;; 01mac.el ends here
|
||||
(provide '01base)
|
||||
;;; 01base.el ends here
|
||||
66
01sys-specific.el
Normal file
66
01sys-specific.el
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
;;; 01sys-specific -- summary
|
||||
;;; Commentary:
|
||||
;;; Make Emacs play nicer with specific operating systems
|
||||
;;; Code:
|
||||
|
||||
(defconst IS-MAC (eq system-type 'darwin))
|
||||
(defconst IS-BSD (eq system-type 'berkeley-unix))
|
||||
|
||||
;;;;;;;;; Mac-specific config ;;;;;;;;;;;;;;;;;;;;;
|
||||
(if IS-MAC
|
||||
(progn
|
||||
(setq mac-option-modifier 'meta)
|
||||
(setq mac-command-modifier 'hyper)
|
||||
|
||||
(defun mac-switch-meta nil
|
||||
"Switch meta between Option and Command."
|
||||
(interactive)
|
||||
(if (eq mac-option-modifier nil)
|
||||
(progn
|
||||
(setq mac-option-modifier 'meta)
|
||||
(setq mac-command-modifier 'hyper))
|
||||
(progn
|
||||
(setq mac-option-modifier nil)
|
||||
(setq mac-command-modifier 'meta))))
|
||||
|
||||
;;;;;;;;; Mac binding (fix) ;;;;;;;;;;;;;;;;;;
|
||||
(global-set-key (kbd "H-<right>") 'end-of-line)
|
||||
(global-set-key (kbd "H-<left>") 'beginning-of-line)
|
||||
(global-set-key (kbd "H-<up>") 'scroll-down) ; WTF is this reverse, I dunno
|
||||
(global-set-key (kbd "H-<down>") 'scroll-up)
|
||||
|
||||
(global-set-key [(hyper a)] 'mark-whole-buffer)
|
||||
(global-set-key [(hyper v)] 'yank)
|
||||
(global-set-key [(hyper x)] 'kill-region)
|
||||
(global-set-key [(hyper c)] 'kill-ring-save)
|
||||
(global-set-key [(hyper s)] 'save-buffer)
|
||||
(global-set-key [(hyper l)] 'goto-line)
|
||||
(global-set-key [(hyper w)]
|
||||
(lambda () (interactive) (delete-window)))
|
||||
(global-set-key [(hyper z)] 'undo)
|
||||
(global-set-key [(hyper q)] 'kill-emacs)
|
||||
|
||||
;; Disable meta on right alt (useful for Polish characters)
|
||||
(setq mac-right-option-modifier nil)))
|
||||
|
||||
;;;;;;;;; BSD-specific config ;;;;;;;;;;;;;;;;;;;;;
|
||||
(if IS-BSD
|
||||
(progn
|
||||
(global-set-key (kbd "A-<right>") 'end-of-line)
|
||||
(global-set-key (kbd "A-<left>") 'beginning-of-line)
|
||||
(global-set-key (kbd "A-<up>") 'scroll-down) ; WTF is this reverse, I dunno
|
||||
(global-set-key (kbd "A-<down>") 'scroll-up)
|
||||
|
||||
(global-set-key (kbd "A-a") 'mark-whole-buffer)
|
||||
(global-set-key (kbd "A-v") 'yank)
|
||||
(global-set-key (kbd "A-x") 'kill-region)
|
||||
(global-set-key (kbd "A-c") 'kill-ring-save)
|
||||
(global-set-key (kbd "A-s") 'save-buffer)
|
||||
(global-set-key (kbd "A-l") 'goto-line)
|
||||
(global-set-key (kbd "A-w")
|
||||
(lambda () (interactive) (delete-window)))
|
||||
(global-set-key (kbd "A-z") 'undo)
|
||||
(global-set-key (kbd "A-q") 'kill-emacs)))
|
||||
|
||||
(provide '01sys-specific)
|
||||
;;; 01sys-specific.el ends here
|
||||
3
init.el
3
init.el
|
|
@ -18,7 +18,8 @@
|
|||
(require 'use-package)
|
||||
|
||||
;; General configuration files.
|
||||
(require '01mac "$HOME/.emacs.d/01mac.el")
|
||||
(require '01base "$HOME/.emacs.d/01base.el")
|
||||
(require '01sys-specific "$HOME/.emacs.d/01sys-specific.el")
|
||||
(require '05macros "$HOME/.emacs.d/05macros.el")
|
||||
(require '05ivy "$HOME/.emacs.d/05ivy.el")
|
||||
(require '05hydra "$HOME/.emacs.d/05hydra.el")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue