dotfiles/emacs/.emacs

178 lines
4.4 KiB
Plaintext

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
;;; General
;
;; Don't show welcome screen every time
(setq inhibit-startup-screen t)
;
;; Turn off 'bell sounds'
; https://emacs.stackexchange.com/questions/28906/how-to-switch-off-the-sounds
(setq ring-bell-function 'ignore)
;
;; Enable word wrap
(setq-default word-wrap t)
;
;; Scroll buffer without moving cursor
; https://www.emacswiki.org/emacs/Scrolling#h5o-2
(defun gcm-scroll-down ()
(interactive)
(scroll-up 1))
;
(defun gcm-scroll-up ()
(interactive)
(scroll-down 1))
;
; C-Down scroll down without moving cursor
(global-set-key [(control down)] 'gcm-scroll-down)
;
; C-Up scroll up without moving cursor
(global-set-key [(control up)] 'gcm-scroll-up)
;
;; Zooming
; https://stackoverflow.com/questions/5533110/emacs-zoom-in-zoom-out
;
; zoom in with mouse scroll up
(global-set-key [C-mouse-4] 'text-scale-increase)
;
; zoom out with mouse scroll down
(global-set-key [C-mouse-5] 'text-scale-decrease)
;
;; Show emacs startup time
(add-hook 'emacs-startup-hook
(lambda ()
(message (format "Emacs started in %s" (emacs-init-time)))))
;
;; Disable automatic indentation
(setq electric-indent-mode nil)
;
;; Display current column
; https://www.gnu.org/software/emacs/manual/html_node/efaq/Displaying-the-current-line-or-column.html
(setq column-number-mode t)
;
;; Set default encoding as UTF-8
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(setq locale-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
;;; Evil mode
; https://www.emacswiki.org/emacs/Evil
;
;; Activate evil mode
(require 'evil)
(evil-mode t)
;
;; Vim digraphs
(load-file "~/.config/emacs/digraphs.el")
;;; Org mode
;
;; Enable org mode
(org-mode)
;
;; States
; https://orgmode.org/manual/Workflow-states.html
;
; org-mode needs to be restarted after changing this variable
;
; TODO: To be done
; DONE: Completed
; NODO: Can't be done or not going to be done anymore
;
(setq org-todo-keywords
'((sequence "TODO" "|" "DONE" "NODO")))
;
;; Save clock history across Emacs sessions
; https://orgmode.org/manual/Clocking-Work-Time.html
(setq org-clock-persist 'history)
(org-clock-persistence-insinuate)
;
;; org-agenda
; https://stackoverflow.com/questions/44094125/org-mode-c-c-a-undefined/44096106
(define-key global-map "\C-ca" 'org-agenda)
;
;; Set agenda files for org-agenda
(setq org-agenda-files (quote ("~/today/agenda.org" "~/org.org")))
;;; Added with Custom
; Proof general: Change colour of highlighting for executed part (light green)
(custom-set-faces
'(proof-locked-face ((t (:extend t :background "#bcffbd")))))
;;; Proof-general mode
;
;; Show goal and in vertical splits
(eval-after-load "proof-script"
'(setq proof-three-window-mode-policy 'hybrid))
;;; tab-bar
; https://www.emacswiki.org/emacs/TabBarMode
; https://github.com/noctuid/evil-guide
; https://stackoverflow.com/a/7790759
(when (require 'tab-bar nil 'noerror)
(setq tab-bar-show 1) ; hide tab bar when there's only one tab
(evil-ex-define-cmd "tabc[lose]" 'tab-bar-close-tab)
(evil-ex-define-cmd "tabon[ly]" 'tab-bar-close-other-tabs))
; (defun get-buffer-contents (buffer)
; (with-current-buffer buffer
; (save-restriction
; (widen)
; (buffer-substring-no-properties (point-min) (point-max)))))
;
; (defun coq-insert-output-as-comment (buffer description)
; ; can be bound to a key combination
; (interactive)
;
; ; save current cursor position
; (save-excursion
;
; ; go to end of current line
; (end-of-line)
;
; ; insert text
; (insert
; (concat
; "\n(*\n#+BEGIN_OUTPUT ("
; description
; ")\n\n"
; (get-buffer-contents buffer)
; "\n#+END_OUTPUT ("
; description
; ")\n*)\n"))))
;
;
; (eval-after-load "proof-script"
; '(progn
; ; change key combination for undo previous line
; (define-key proof-mode-map
; (kbd "C- C-u") 'proof-prf)
;
; (define-key proof-mode-map
; (kbd "C- C-p") 'proof-undo-last-successful-command)
;
; ; Add key combinations to display Info and Goal
; (define-key proof-mode-map
; (kbd "C-c i")
; (lambda ()
; (interactive)
; (coq-insert-output-as-comment "*response*" "Info")))
;
; (define-key proof-mode-map
; (kbd "C-c j")
; (lambda ()
; (interactive)
; (coq-insert-output-as-comment "*goals*" "Goal")))
; ))