dotfiles/dot_emacs

253 lines
7.3 KiB
Plaintext
Raw Normal View History

2020-06-12 22:06:42 +02:00
;;; package --- Summary
;;; Commentary:
;;; Code:
2020-04-08 02:07:43 +02:00
(require 'package)
(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."))
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
)
(package-initialize)
(package-refresh-contents)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
2020-06-13 22:10:16 +02:00
'(auth-source-save-behavior nil)
2020-06-20 00:22:44 +02:00
'(custom-enabled-themes '(doom-one))
'(custom-safe-themes
'("2f1518e906a8b60fac943d02ad415f1d8b3933a5a7f75e307e6e9a26ef5bf570" default))
2020-04-08 02:07:43 +02:00
'(package-selected-packages
2020-06-20 00:22:44 +02:00
'(chess scad-preview dockerfile-mode heaven-and-hell yaml-mode rustic scad-mode lsp-treemacs flycheck-rust telephone-line yasnippet flycheck-pos-tip flycheck magit lsp-ui all-the-icons doom-themes lsp-mode use-package treemacs-evil)))
2020-04-08 02:07:43 +02:00
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package)
(require 'use-package))
(use-package evil
:ensure t
:config
(evil-mode 1))
;(use-package evil-surround
; :ensure t
; :config
; (global-evil-surround-mode 1))
2020-04-08 02:07:43 +02:00
(use-package yasnippet
:ensure t
:config
(yas-global-mode 1))
(use-package treemacs
:ensure t)
(use-package treemacs-evil
:ensure t)
(use-package flycheck
:ensure t
:init (global-flycheck-mode))
(use-package flycheck-pos-tip
:ensure t)
(use-package company-lsp
:ensure t
:config
(push 'company-lsp company-backends))
;(use-package company-box
2020-06-12 22:06:42 +02:00
; :ensure t
2020-04-08 02:07:43 +02:00
; :hook (company-mode . company-box-mode))
2020-06-12 22:06:42 +02:00
;(use-package rust-mode
; :ensure t
; :config
; (setq rust-format-on-save t))
2020-06-13 22:10:16 +02:00
(use-package yaml-mode
:ensure t
:config
(add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))
(add-to-list 'auto-mode-alist '("\\.yaml\\'" . yaml-mode)))
2020-06-20 00:22:44 +02:00
(use-package dockerfile-mode
:ensure t
:config
(add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode)))
2020-06-12 22:06:42 +02:00
(use-package rustic
:ensure t)
2020-04-08 02:07:43 +02:00
(use-package elcord
:ensure t
:config
(elcord-mode))
(use-package magit
:ensure t)
2020-07-09 03:31:09 +02:00
(use-package magit-todos
:ensure t
:config
(add-hook 'rustic-hook 'hl-todo-mode))
2020-04-08 02:07:43 +02:00
(use-package lsp-ui
2020-06-12 22:06:42 +02:00
2020-04-08 02:07:43 +02:00
:ensure t)
(use-package lsp-mode
:ensure t
:config
(setq rustic-lsp-server 'rls)
(setq rustic-compile-command "cargo build")
(setq rustic-format-trigger 'on-save)
2020-06-12 22:06:42 +02:00
(add-to-list 'auto-mode-alist '("\\.rs\\'" . rustic-mode))
(add-hook 'rustic-hook 'lsp))
2020-04-08 02:07:43 +02:00
(use-package lsp-treemacs
:ensure t
:config
(lsp-treemacs-sync-mode 1))
(use-package all-the-icons
:ensure t)
(use-package telephone-line
:ensure t
:config
(telephone-line-mode 1))
2020-06-20 00:22:44 +02:00
(use-package chess
:ensure t)
2020-04-08 02:07:43 +02:00
(use-package doom-themes
:ensure t
: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
2020-06-13 00:13:31 +02:00
(load-theme 'doom-one t)
2020-04-08 02:07:43 +02:00
;; Enable flashing mode-line on errors
; (doom-themes-visual-bell-config)
;; Enable custom neotree theme (all-the-icons must be installed!)
;(doom-themes-neotree-config)
;; or for treemacs users
(setq doom-themes-treemacs-theme "doom-colors") ; use the colorful treemacs theme
(doom-themes-treemacs-config) )
;; Corrects (and improves) org-mode's native fontification.
; (doom-themes-org-config))
(use-package heaven-and-hell
:ensure t
:init
(setq heaven-and-hell-theme-type 'dark) ;; Omit to use light by default
(setq heaven-and-hell-themes
'((light . doom-one-light)
(dark . doom-one))) ;; Themes can be the list: (dark . (tsdh-dark wombat))
;; Optionall, load themes without asking for confirmation.
(setq heaven-and-hell-load-theme-no-confirm t)
:hook (after-init . heaven-and-hell-init-hook)
:bind (("<f6>" . heaven-and-hell-toggle-theme)))
2020-04-08 02:07:43 +02:00
(global-set-key (kbd "M-RET T") 'treemacs)
(global-set-key (kbd "M-RET t") 'treemacs-select-window)
(global-set-key (kbd "M-RET s") 'treemacs-switch-workspace)
(global-set-key (kbd "M-RET S") 'treemacs-edit-workspaces)
2020-04-08 02:07:43 +02:00
(global-set-key (kbd "M-RET w") 'ace-window)
2020-07-09 03:31:09 +02:00
(global-set-key (kbd "M-RET r b") 'rustic-cargo-build)
(global-set-key (kbd "M-RET r t") 'rustic-cargo-test)
2020-07-09 03:31:09 +02:00
(global-set-key (kbd "M-RET r r") 'rustic-cargo-run)
(global-set-key (kbd "M-RET r c") 'rustic-cargo-clippy)
(global-set-key (kbd "M-RET r f") 'rustic-cargo-fmt)
2020-04-08 02:07:43 +02:00
(global-set-key (kbd "M-RET e") 'lsp-execute-code-action)
2020-07-09 03:31:09 +02:00
(global-set-key (kbd "M-RET R") 'lsp-rename)
2020-04-08 02:07:43 +02:00
(global-set-key (kbd "M-RET m") 'magit-status)
(global-set-key (kbd "<f11>") 'fullscreen)
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
;; show matching parenthesis
(show-paren-mode 1)
;(use-package key-chord
:ensure t
:init
;;Exit insert mode by pressing j and then j quickly
; (setq key-chord-two-keys-delay 0.5)
; (key-chord-define evil-insert-state-map "jj" 'evil-normal-state)
; (key-chord-mode 1))
;; move hjkl to jkl;
(define-key evil-motion-state-map "h" nil)
(define-key evil-motion-state-map "j" 'evil-backward-char)
(define-key evil-motion-state-map "k" 'evil-next-line)
(define-key evil-motion-state-map "l" 'evil-previous-line)
(define-key evil-motion-state-map ";" 'evil-forward-char)
(define-key treemacs-mode-map "h" nil)
(define-key evil-treemacs-state-map "j" 'treemacs-root-up)
(define-key evil-treemacs-state-map "k" 'treemacs-next-line)
(define-key treemacs-mode-map "l" 'treemacs-previous-line)
(define-key evil-treemacs-state-map ";" 'treemacs-root-down)
2020-04-08 02:07:43 +02:00
;; optimizations for emacs-lsp
(setq gc-cons-threshold 100000000)
(setq read-process-output-max (* 1024 1024))
;; enable ido
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode 1)
;; disable gtk stuff
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) ;; no toolbar
(menu-bar-mode -1) ;;no menubar
(scroll-bar-mode -1) ;; no scroll bar
;; set font
(set-frame-font "Droid Sans Mono 12" nil t)
;; enable parenthesis and quotes pairing thing
(electric-pair-mode)
;; fullscreen
(defun fullscreen ()
(interactive)
(set-frame-parameter nil 'fullscreen
(if (frame-parameter nil 'fullscreen) nil 'fullboth)))
;; :q should kill the current buffer rather than quitting emacs entirely
(evil-ex-define-cmd "q" 'kill-this-buffer)
;; Need to type out :quit to close emacs
(evil-ex-define-cmd "quit" 'evil-quit)
;; compositor based transparency
(set-frame-parameter (selected-frame) 'alpha '(90 . 90))
2020-04-08 02:07:43 +02:00
;(add-to-list 'default-frame-alist '(fullscreen . maximized))