emacs.d/init.el
2019-11-14 10:24:13 +01:00

130 lines
3.9 KiB
EmacsLisp
Executable file

(add-to-list 'load-path (expand-file-name "~/.emacs.d/bundle"))
(require 'package)
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(when no-ssl
(warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
(require 'fill-column-indicator)
(require 'tls)
(require 'request)
(require 'yaml-mode)
(require 'json)
(require 'url)
(setq custom-file "~/.emacs.d/bundle/custom.el")
(load custom-file :noerror)
(setq small-font "Iosevka Term-11")
(setq big-font "Iosevka Term-14")
(require 'os)
;; start a server, unless one is already running
(when (require 'server nil t)
(unless (server-running-p)
(server-start)))
;; UTF-8 FTW
(prefer-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
;; nuke trailing whitespace when writing to a file
(add-hook 'write-file-hooks 'delete-trailing-whitespace)
(add-hook 'markdown-mode-hook 'turn-on-font-lock)
(add-hook 'python-mode-hook 'turn-on-font-lock)
;; I got sick of typing "yes"
(defalias 'yes-or-no-p 'y-or-n-p)
(defun copy-whole-buffer ()
"Copy entire buffer to clipboard"
(interactive)
(clipboard-kill-ring-save (point-min) (point-max)))
(defun format-whole-buffer ()
"Copy entire buffer to clipboard"
(interactive)
(fill-paragraph (point-min) (point-max)))
(put 'upcase-region 'disabled nil)
(setq view-diary-entries-initially t
mark-diary-entries-in-calendar t
number-of-diary-entries 7)
(add-hook 'diary-display-hook 'fancy-diary-display)
(add-hook 'today-visible-calendar-hook 'calendar-mark-today)
(put 'narrow-to-region 'disabled nil)
(put 'narrow-to-page 'disabled nil)
(defun duplicate-line()
(interactive)
(move-beginning-of-line 1)
(kill-line)
(yank)
(open-line 1)
(next-line 1)
(yank)
)
;;(global-set-key (kbd "C-d") 'duplicate-line)
(add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))
;; slime
(setq slime-contribs '(slime-fancy))
(require 'url)
(defun webscrap-page-raw (url)
(interactive)
(let 'url-request-method "GET")
(url-retrieve url
(lambda (status) (switch-to-buffer-other-window (current-buffer))))
)
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
;; ===================== Org-mode ====================== ;;
(add-hook 'org-mode-hook 'turn-on-font-lock)
(org-clock-persistence-insinuate)
;; ==================== GLOBAL KEYS ==================== ;;
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-switchb)
(global-set-key "\C-xg" 'magit-status)
(global-set-key "\C-xM-g" 'magit-dispatch)
(global-unset-key "\C-z")
;; ================= ALWAYS AT THE END ================= ;;
;; Turn off chrome
;; (dolist (mode '(menu-bar-mode tool-bar-mode scroll-bar-mode))
;; (when (fboundp mode) (funcall mode -1)))
;; Local Variables:
;; mode: emacs-lisp
;; coding: utf-8-unix
;; End: