Update init.el
This commit is contained in:
parent
c4ea15315f
commit
f3afdcbbdc
1 changed files with 34 additions and 269 deletions
303
emacs.d/init.el
303
emacs.d/init.el
|
@ -1,38 +1,12 @@
|
||||||
;;; GNU/EMACS --- Rawley Fowler's init.el.
|
;;; package --- Rawley Fowler's init.el
|
||||||
;; I was a long time Vim user. But emacs stole my heart.
|
;;; Commentary:
|
||||||
|
;;; I used Vim for quite a few years, but evil mode Emacs
|
||||||
|
;;; is so much nicer.
|
||||||
;;; Code:
|
;;; Code:
|
||||||
;; Borrowed this from https://github.com/aaronbieber/dotfiles/blob/master/configs/emacs.d/init.el
|
|
||||||
(setq initial-scratch-message
|
|
||||||
(concat
|
|
||||||
";; This buffer is for text that is not saved, and for Lisp evaluation.\n"
|
|
||||||
";; To create a file, visit it with C-x C-f and enter text in its buffer.\n"
|
|
||||||
";;\n"
|
|
||||||
";; __ __ _ \n"
|
|
||||||
";; \\ \\ / / | | \n"
|
|
||||||
";; \\ \\ /\\ / /__| | ___ ___ _ __ ___ ___ \n"
|
|
||||||
";; \\ \\/ \\/ / _ \\ |/ __/ _ \\| '_ ` _ \\ / _ \\ \n"
|
|
||||||
";; \\ /\\ / __/ | (_| (_) | | | | | | __/_ \n"
|
|
||||||
";; \\/ \\/ \\___|_|\\___\\___/|_| |_| |_|\\___(_)\n"))
|
|
||||||
|
|
||||||
(when (version<= "26.0.50" emacs-version)
|
|
||||||
(global-display-line-numbers-mode)) ;; Line numbers
|
|
||||||
(defalias 'yes-or-no-p 'y-or-n-p)
|
|
||||||
|
|
||||||
(add-to-list 'default-frame-alist '(fullscreen . maximized))
|
|
||||||
|
|
||||||
;; Backups
|
|
||||||
(setq backup-directory-alist
|
|
||||||
`((".*" . ,temporary-file-directory)))
|
|
||||||
(setq auto-save-file-name-transforms
|
|
||||||
`((".*" ,temporary-file-directory t)))
|
|
||||||
|
|
||||||
;; Disabling bars
|
|
||||||
(menu-bar-mode -1)
|
(menu-bar-mode -1)
|
||||||
(scroll-bar-mode -1)
|
(scroll-bar-mode -1)
|
||||||
(tool-bar-mode -1)
|
(tool-bar-mode -1)
|
||||||
|
|
||||||
;; UTF-8 and spacing
|
|
||||||
(set-language-environment "UTF-8")
|
(set-language-environment "UTF-8")
|
||||||
(set-terminal-coding-system 'utf-8)
|
(set-terminal-coding-system 'utf-8)
|
||||||
(set-keyboard-coding-system 'utf-8)
|
(set-keyboard-coding-system 'utf-8)
|
||||||
|
@ -41,12 +15,8 @@
|
||||||
(transient-mark-mode)
|
(transient-mark-mode)
|
||||||
(show-paren-mode 1)
|
(show-paren-mode 1)
|
||||||
|
|
||||||
(setq font-lock-maximum-decoration t)
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
||||||
(setq-default indent-tabs-mode nil)
|
|
||||||
(setq tab-width 4)
|
|
||||||
(setq c-basic-offset 4)
|
|
||||||
|
|
||||||
;;;; Package management
|
|
||||||
(require 'package)
|
(require 'package)
|
||||||
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/"))
|
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/"))
|
||||||
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
|
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
|
||||||
|
@ -58,36 +28,39 @@
|
||||||
|
|
||||||
(eval-and-compile
|
(eval-and-compile
|
||||||
(setq use-package-always-ensure t
|
(setq use-package-always-ensure t
|
||||||
use-package-expand-minimally t))
|
use-package-expand-minimally t))
|
||||||
|
|
||||||
(require 'use-package)
|
(require 'use-package)
|
||||||
|
|
||||||
;;;; Packages.
|
;; Misc Packages
|
||||||
;; EVIL!!!
|
(use-package restart-emacs)
|
||||||
|
|
||||||
|
;; Theme
|
||||||
|
(use-package modus-themes
|
||||||
|
:init
|
||||||
|
(setq modus-themes-italic-constructs t
|
||||||
|
modus-themes-bold-constructs nil
|
||||||
|
modus-themes-region '(bg-only no-extend))
|
||||||
|
(modus-themes-load-themes)
|
||||||
|
:config
|
||||||
|
(modus-themes-load-operandi)
|
||||||
|
:bind
|
||||||
|
("<f5>" . modus-themes-toggle))
|
||||||
|
|
||||||
|
;; Evil.
|
||||||
(use-package evil
|
(use-package evil
|
||||||
:ensure t ;; Install evil if not installed
|
:ensure t
|
||||||
:init ;; Tweak the config before loading it
|
:init
|
||||||
(setq evil-want-integration t)
|
(setq evil-want-integration t)
|
||||||
(setq evil-want-keybinding nil)
|
(setq evil-want-keybinding nil)
|
||||||
(setq evil-vsplit-window-right t)
|
(setq evil-vsplit-window-right t)
|
||||||
(setq evil-split-window-below t)
|
(setq evil-split-window-below t)
|
||||||
(evil-mode))
|
(evil-mode))
|
||||||
|
|
||||||
(defun selective-window-kill ()
|
(defun save-and-kill-this-buffer ()
|
||||||
(interactive)
|
|
||||||
(when (> (count-windows) 1)
|
|
||||||
(delete-window)))
|
|
||||||
|
|
||||||
(defun save-kill-buffer () ;; Saves and kills a buffer, vim style
|
|
||||||
(interactive)
|
(interactive)
|
||||||
(save-buffer)
|
(save-buffer)
|
||||||
(selective-window-kill))
|
(kill-current-buffer))
|
||||||
|
|
||||||
(evil-ex-define-cmd "wq" 'save-and-kill-buffer)
|
|
||||||
(evil-ex-define-cmd "q" 'selective-window-kill)
|
|
||||||
(evil-ex-define-cmd "kb" '(lambda ()
|
|
||||||
(interactive)
|
|
||||||
(kill-buffer-and-window)))
|
|
||||||
|
|
||||||
(use-package evil-collection
|
(use-package evil-collection
|
||||||
:after evil
|
:after evil
|
||||||
|
@ -97,232 +70,24 @@
|
||||||
|
|
||||||
(use-package evil-org)
|
(use-package evil-org)
|
||||||
|
|
||||||
;; Project mangement
|
;; Other configs
|
||||||
(use-package projectile
|
(load-file "~/.emacs.d/lsp.el")
|
||||||
:config
|
(load-file "~/.emacs.d/modes.el")
|
||||||
(projectile-mode +1)
|
(load-file "~/.emacs.d/extra.el")
|
||||||
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map))
|
(load-file "~/.emacs.d/bind.el")
|
||||||
|
|
||||||
(use-package hydra)
|
|
||||||
|
|
||||||
;; Treemacs
|
|
||||||
(use-package lsp-treemacs)
|
|
||||||
(use-package treemacs
|
|
||||||
:ensure t
|
|
||||||
:defer t
|
|
||||||
:config
|
|
||||||
(progn
|
|
||||||
(setq treemacs-display-in-side-window t
|
|
||||||
treemacs-follow-after-init t
|
|
||||||
treemacs-expand-after-init t
|
|
||||||
treemacs-indentation 2
|
|
||||||
treemacs-hide-dot-git-directory t
|
|
||||||
treemacs-indentation-string " "
|
|
||||||
treemacs-max-git-entries 5000
|
|
||||||
treemacs-width 40
|
|
||||||
treemacs-width-increment 1
|
|
||||||
treemacs-width-is-initially-locked t))
|
|
||||||
:bind
|
|
||||||
(:map global-map
|
|
||||||
("C-x w s" . treemacs-select-window)
|
|
||||||
("C-x w 1" . treemacs-delete-other-windows)
|
|
||||||
("C-x w w" . treemacs)))
|
|
||||||
|
|
||||||
(require 'treemacs)
|
|
||||||
(treemacs-follow-mode t)
|
|
||||||
(treemacs-filewatch-mode t)
|
|
||||||
(treemacs-fringe-indicator-mode 'always)
|
|
||||||
(treemacs-git-mode 'simple)
|
|
||||||
(define-key treemacs-mode-map [mouse-1] #'treemacs-single-click-expand-action)
|
|
||||||
(use-package treemacs-evil
|
|
||||||
:after (treemacs evil)
|
|
||||||
:ensure t)
|
|
||||||
(use-package treemacs-projectile
|
|
||||||
:after (treemacs projectile)
|
|
||||||
:ensure t)
|
|
||||||
|
|
||||||
;; Icons
|
|
||||||
(use-package all-the-icons
|
|
||||||
:if (display-graphic-p))
|
|
||||||
|
|
||||||
;; Ivy
|
|
||||||
(use-package ivy)
|
|
||||||
(use-package counsel)
|
|
||||||
(use-package swiper)
|
|
||||||
|
|
||||||
(require 'ivy)
|
|
||||||
(ivy-mode 1)
|
|
||||||
(setq ivy-use-virtual-buffers t)
|
|
||||||
(setq ivy-count-format "(%d/%d) ")
|
|
||||||
|
|
||||||
;; Parens
|
|
||||||
(use-package paren
|
|
||||||
:ensure nil
|
|
||||||
:init
|
|
||||||
(setq show-paren-delay 0)
|
|
||||||
:config
|
|
||||||
(show-paren-mode +1))
|
|
||||||
|
|
||||||
(use-package smartparens
|
|
||||||
:config
|
|
||||||
(smartparens-global-mode 1))
|
|
||||||
(require 'smartparens)
|
|
||||||
(use-package evil-smartparens
|
|
||||||
:hook ('smartparens-enabled-hook #'evil-smartparens-mode))
|
|
||||||
|
|
||||||
;; Which key
|
|
||||||
(use-package which-key)
|
|
||||||
|
|
||||||
;; LSP/Complete packages
|
|
||||||
(use-package yasnippet
|
|
||||||
:config
|
|
||||||
(yas-global-mode))
|
|
||||||
|
|
||||||
(use-package lsp-mode
|
|
||||||
:commands (lsp lsp-deferred)
|
|
||||||
:init
|
|
||||||
(setq lsp-keymap-prefix "C-c l")
|
|
||||||
:config
|
|
||||||
(lsp-enable-which-key-integration t))
|
|
||||||
|
|
||||||
(use-package company)
|
|
||||||
(add-hook 'after-init-hook 'global-company-mode)
|
|
||||||
|
|
||||||
(use-package lsp-ui)
|
|
||||||
(require 'lsp-ui)
|
|
||||||
(lsp-ui-sideline-enable t)
|
|
||||||
|
|
||||||
(use-package lsp-java)
|
|
||||||
(add-hook 'java-mode-hook #'lsp)
|
|
||||||
|
|
||||||
(use-package dap-mode
|
|
||||||
:after lsp-mode
|
|
||||||
:config
|
|
||||||
(dap-auto-configure-mode))
|
|
||||||
(use-package dap-java
|
|
||||||
:ensure nil)
|
|
||||||
|
|
||||||
(use-package helm-lsp)
|
|
||||||
(use-package helm
|
|
||||||
:config
|
|
||||||
(helm-mode))
|
|
||||||
|
|
||||||
;; Language modes
|
|
||||||
; Java stuff
|
|
||||||
(use-package meghanada)
|
|
||||||
(add-hook 'java-mode-hook
|
|
||||||
(lambda ()
|
|
||||||
(meghanada-mode t)
|
|
||||||
(setq c-basic-offset 2)
|
|
||||||
(add-hook 'before-save-hook 'meghanada-code-beautify-before-save)))
|
|
||||||
(setq meghanada-java-path "java")
|
|
||||||
(setq meghanada-maven-path "mvn")
|
|
||||||
|
|
||||||
(use-package typescript-mode
|
|
||||||
:mode ("\\.tsx?\\'" . typescript-mode)
|
|
||||||
:hook (typescript-mode . lsp-deferred)
|
|
||||||
:config
|
|
||||||
(setq typescript-indent-level 2))
|
|
||||||
|
|
||||||
(use-package clojure-mode
|
|
||||||
:mode ("\\.cljs?\\'" . clojure-mode)
|
|
||||||
:hook (clojure-mode . lsp-deferred)
|
|
||||||
:config
|
|
||||||
(setq clojure-indent-level 2))
|
|
||||||
|
|
||||||
(use-package go-mode
|
|
||||||
:mode ("\\.go\\'" . go-mode)
|
|
||||||
:hook (go-mode . lsp-deferred))
|
|
||||||
|
|
||||||
(use-package markdown-mode
|
|
||||||
:mode ("\\.md\\'" . markdown-mode)
|
|
||||||
:hook (markdown-mode . auto-fill-mode))
|
|
||||||
|
|
||||||
(use-package dart-mode)
|
|
||||||
(use-package json-mode)
|
|
||||||
(use-package vimrc-mode)
|
|
||||||
(use-package yaml-mode)
|
|
||||||
|
|
||||||
(use-package flycheck
|
|
||||||
:config
|
|
||||||
(global-flycheck-mode))
|
|
||||||
(use-package exec-path-from-shell
|
|
||||||
:config
|
|
||||||
(exec-path-from-shell-initialize))
|
|
||||||
|
|
||||||
;;;; Bindings
|
|
||||||
|
|
||||||
;; Splits
|
|
||||||
(defun split-and-follow-horizontally ()
|
|
||||||
(interactive)
|
|
||||||
(split-window-below)
|
|
||||||
(balance-windows)
|
|
||||||
(other-window 1))
|
|
||||||
(global-set-key (kbd "C-x 2") 'split-and-follow-horizontally)
|
|
||||||
|
|
||||||
(defun split-and-follow-vertically ()
|
|
||||||
(interactive)
|
|
||||||
(split-window-right)
|
|
||||||
(balance-windows)
|
|
||||||
(other-window 1))
|
|
||||||
(global-set-key (kbd "C-x 3") 'split-and-follow-vertically)
|
|
||||||
|
|
||||||
;; Split and open terminal
|
|
||||||
(defun split-and-open-terminal ()
|
|
||||||
(interactive)
|
|
||||||
(split-window-below)
|
|
||||||
(other-window 1)
|
|
||||||
(shell))
|
|
||||||
(global-set-key (kbd "C-x t") 'split-and-open-terminal)
|
|
||||||
|
|
||||||
;; Ivy
|
|
||||||
(global-set-key (kbd "C-s") 'swiper-isearch)
|
|
||||||
(global-set-key (kbd "M-x") 'counsel-M-x)
|
|
||||||
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
|
|
||||||
(global-set-key (kbd "M-y") 'counsel-yank-pop)
|
|
||||||
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
|
|
||||||
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
|
|
||||||
(global-set-key (kbd "<f1> l") 'counsel-find-library)
|
|
||||||
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
|
|
||||||
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
|
|
||||||
(global-set-key (kbd "<f2> j") 'counsel-set-variable)
|
|
||||||
(global-set-key (kbd "C-x b") 'ivy-switch-buffer)
|
|
||||||
(global-set-key (kbd "C-c v") 'ivy-push-view)
|
|
||||||
(global-set-key (kbd "C-c V") 'ivy-pop-view)
|
|
||||||
|
|
||||||
(global-set-key (kbd "C-c c") 'counsel-compile)
|
|
||||||
(global-set-key (kbd "C-c g") 'counsel-git)
|
|
||||||
(global-set-key (kbd "C-c j") 'counsel-git-grep)
|
|
||||||
(global-set-key (kbd "C-c L") 'counsel-git-log)
|
|
||||||
(global-set-key (kbd "C-c k") 'counsel-rg)
|
|
||||||
(global-set-key (kbd "C-c m") 'counsel-linux-app)
|
|
||||||
(global-set-key (kbd "C-c n") 'counsel-fzf)
|
|
||||||
(global-set-key (kbd "C-x l") 'counsel-locate)
|
|
||||||
(global-set-key (kbd "C-c J") 'counsel-file-jump)
|
|
||||||
(global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
|
|
||||||
(global-set-key (kbd "C-c w") 'counsel-wmctrl)
|
|
||||||
|
|
||||||
(global-set-key (kbd "C-c C-r") 'ivy-resume)
|
|
||||||
(global-set-key (kbd "C-c b") 'counsel-bookmark)
|
|
||||||
(global-set-key (kbd "C-c d") 'counsel-descbinds)
|
|
||||||
(global-set-key (kbd "C-c g") 'counsel-git)
|
|
||||||
(global-set-key (kbd "C-c o") 'counsel-outline)
|
|
||||||
(global-set-key (kbd "C-c t") 'counsel-load-theme)
|
|
||||||
(global-set-key (kbd "C-c F") 'counsel-org-file)
|
|
||||||
|
|
||||||
;;;; Themes
|
|
||||||
;; I use the default emacs color scheme, with Consolas font.
|
|
||||||
(custom-set-variables
|
(custom-set-variables
|
||||||
;; custom-set-variables was added by Custom.
|
;; custom-set-variables was added by Custom.
|
||||||
;; If you edit it by hand, you could mess it up, so be careful.
|
;; If you edit it by hand, you could mess it up, so be careful.
|
||||||
;; Your init file should contain only one such instance.
|
;; Your init file should contain only one such instance.
|
||||||
;; If there is more than one, they won't work right.
|
;; If there is more than one, they won't work right.
|
||||||
'(helm-minibuffer-history-key "M-p")
|
'(helm-minibuffer-history-key "M-p")
|
||||||
'(package-selected-packages
|
'(package-selected-packages '(evil-org evil-collection evil use-package)))
|
||||||
'(yaml-mode vimrc-mode json-mode clojure-mode typescript-mode use-package restart-emacs lsp-mode evil-collection)))
|
|
||||||
(custom-set-faces
|
(custom-set-faces
|
||||||
;; custom-set-faces was added by Custom.
|
;; custom-set-faces was added by Custom.
|
||||||
;; If you edit it by hand, you could mess it up, so be careful.
|
;; If you edit it by hand, you could mess it up, so be careful.
|
||||||
;; Your init file should contain only one such instance.
|
;; Your init file should contain only one such instance.
|
||||||
;; If there is more than one, they won't work right.
|
;; If there is more than one, they won't work right.
|
||||||
)
|
)
|
||||||
|
|
||||||
|
;;; init.el ends here
|
||||||
|
|
Loading…
Reference in a new issue