Skip to content

Instantly share code, notes, and snippets.

@aaronyoo
Created July 20, 2020 15:25
Show Gist options
  • Save aaronyoo/e99be994cc248050e952bbb9c567589f to your computer and use it in GitHub Desktop.
Save aaronyoo/e99be994cc248050e952bbb9c567589f to your computer and use it in GitHub Desktop.
(setq inhibit-startup-message t)
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(package-initialize)
;; Bootstrap `use-package'
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
;; Disable all the visual clutter
(menu-bar-mode -1)
(toggle-scroll-bar -1)
(tool-bar-mode -1)
;; Keybind help
(use-package which-key
:ensure t
:config
(which-key-mode))
;; enable ido everywhere
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode 1)
(use-package ido-vertical-mode
:ensure t
:config
(ido-vertical-mode 1))
(setq ido-vertical-define-keys 'C-n-and-C-p-only)
;; Flip the super and meta keys for easier reach
;;(setq x-super-keysym 'meta)
;;(setq x-meta-keysym 'super)
(setq mac-command-modifier 'meta) ; make cmd key do Meta
(setq mac-option-modifier 'super) ; make opt key do Super
(use-package treemacs
:ensure t
:bind ("C-c t" . treemacs))
;; Ace window
(use-package ace-window
:ensure t
:init
(setq aw-scope 'frame ; limit to single frame (useful when using exwm)
aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
:bind
("M-o" . ace-window))
;; Avy for fast jumping
(use-package avy
:ensure t
:bind
("C-;" . avy-goto-char-2))
;; Allow undo, redo of window moves
(winner-mode 1)
;; Some doom themes for nicer configuration. All the icons is neeeded.
(use-package all-the-icons
:ensure t)
(use-package solaire-mode
:hook
((change-major-mode after-revert ediff-prepare-buffer) . turn-on-solaire-mode)
(minibuffer-setup . solaire-mode-in-minibuffer)
:config
(solaire-global-mode +1)
(solaire-mode-swap-bg))
(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
(load-theme 'doom-one t)
;; Enable flashing mode-line on errors
(doom-themes-visual-bell-config)
;; Let treemacs have a theme too.
(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)
)
;; Show matching parens
(show-paren-mode 1)
(add-hook 'prog-mode-hook 'electric-pair-mode)
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
;; If you never want whitespace at the end of a line
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; Add Rust support
(use-package rust-mode
:ensure t
:bind (:map rust-mode-map
("C-c C-c" . rust-run))
:init
(setq rust-format-on-save t))
(add-hook 'rust-mode-hook
(lambda () (setq indent-tabs-mode nil)))
(use-package flycheck
:ensure t
:init (global-flycheck-mode))
(use-package lsp-mode
:ensure t
:hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode)
(rust-mode . lsp)
;; if you want which-key integration
(lsp-mode . lsp-enable-which-key-integration))
:commands lsp)
(use-package lsp-ui :ensure t :commands lsp-ui-mode)
(use-package lsp-treemacs :ensure t :commands lsp-treemacs-errors-list)
;; Projectile to manage projects
(use-package projectile
:ensure t
:config
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(projectile-mode +1))
;; Adding org-journal for note taking
(use-package org-journal
:ensure t
:config
(setq org-journal-dir "~/Documents/journal"
org-journal-date-format "%A, %d %B %Y"))
;; Put saves in a different location
(setq backup-directory-alist `(("." . "~/.saves")))
;; Add a python3 interpreter
(setq python-shell-interpreter "/usr/local/bin/python3")
;; Use company
(use-package company
:ensure t
:init
(setq company-tooltip-align-annotations t)
:hook (after-init . global-company-mode)
:bind
(:map prog-mode-map
("C-i" . company-indent-or-complete-common)
("C-M-i" . completion-at-point)))
;; Use lsp-company
(use-package company-lsp
:ensure t)
(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.
'(org-export-backends (quote (ascii html icalendar latex md odt)))
'(package-selected-packages (quote (lsp-ui lsp-mode doom-themes treemacs use-package))))
(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.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment