.emacs.d/init.el

167 lines
4.3 KiB
EmacsLisp

; Package repos
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
; use-package
(eval-when-compile
(require 'use-package))
; THEME
(require 'doom-themes)
(use-package doom-themes
:config
;; Global settings (defaults)
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
doom-themes-enable-italic t) ; if nil, italics is universally disabled
(load-theme 'doom-peacock t))
;; doom-modeline
(use-package doom-modeline
:ensure t
:init (doom-modeline-mode 1))
;; custom
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)
; EVIL
;;; Download Evil
(unless (package-installed-p 'evil)
(package-install 'evil))
;;; Enable Evil
(setq evil-want-keybinding nil)
(require 'evil)
(require 'evil-collection nil t)
(evil-collection-init)
(evil-mode 1)
; General configuration
;; no startup message
(setq inhibit-startup-message t)
;; no toolbar
(progn
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(menu-bar-mode -1)
(scroll-bar-mode -1))
;; don't ask to spell out "yes"
(fset 'yes-or-no-p 'y-or-n-p)
;; show line numbers
(global-display-line-numbers-mode)
;; open links in eww
(setq browse-url-browser-function 'eww-browse-url)
;;; No cookies
(setq url-cookie-trusted-urls '()
url-cookie-untrusted-urls '(".*"))
;; autostart all-the-icons
(require 'all-the-icons)
(all-the-icons-icon-for-mode t)
;; general keybindings
;;; Zooming
(global-set-key (kbd "C-=") 'text-scale-increase)
(global-set-key (kbd "C--") 'text-scale-decrease)
; LISP
(load (expand-file-name "~/.roswell/helper.el"))
; org-mode
;; Enable org-mode
(require 'org)
; exwm
(require 'exwm)
(require 'exwm-config)
(require 'exwm-systemtray)
;; These keys should always pass through to Emacs
(setq exwm-input-prefix-keys
'(?\C-x
?\C-u
?\C-h
?\M-x
?\M-`
?\M-&
?\M-:
?\C-\M-j ;; Buffer list
?\C-\ )) ;; Ctrl+Space
;; Ctrl+Q will enable the next key to be sent directly
(define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
;; key bindings
(setq exwm-input-global-keys
`(
;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard)
([?\s-r] . exwm-reset)
;; Move between windows
([s-left] . windmove-left)
([s-right] . windmove-right)
([s-up] . windmove-up)
([s-down] . windmove-down)
;; Launch applications via shell command
([?\s-&] . (lambda (command)
(interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command)))
;; Switch workspace
([?\s-w] . exwm-workspace-switch)
([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0)))
;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9)
,@(mapcar (lambda (i)
`(,(kbd (format "s-%d" i)) .
(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
(number-sequence 0 9))))
(exwm-enable)
(exwm-systemtray-enable)
; elfeed
(use-package elfeed
:ensure t)
(global-set-key (kbd "C-x w") 'elfeed)
; gnus
(setq gnus-select-method '(nntp "news.tilde.club"))
;(add-to-list 'gnus-secondary-select-methods '(nntp "news.gnus.org"))
;(add-to-list 'gnus-secondary-select-methods '(nntp ""))
(setq gnus-read-active-file nil)
; elpher
; Open all gemini and gopher links in elpher
(advice-add 'eww-browse-url :around 'asc:eww-browse-url)
(defun asc:eww-browse-url (original url &optional new-window)
(cond ((string-match-p "\\`\\(gemini\\|gopher\\)://" url)
(require 'elpher)
(elpher-go url))
(t (funcall original url new-window))))
; dashboard
(require 'dashboard)
(dashboard-setup-startup-hook)
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
(setq dashboard-startup-banner "~/.emacs.d/img/arch-with-emacs-icon.png")
(setq dashboard-center-content t)
(setq dashboard-items '((recents . 5)
(bookmarks . 5)
;(projects . 5) ;; have't install projectile yet
(agenda . 5)
(registers . 5)))