Skip to content

Instantly share code, notes, and snippets.

@linw1995
Created June 20, 2020 06:51
Show Gist options
  • Select an option

  • Save linw1995/a57ce3da14108c41a7e460c188d094b8 to your computer and use it in GitHub Desktop.

Select an option

Save linw1995/a57ce3da14108c41a7e460c188d094b8 to your computer and use it in GitHub Desktop.
My Simple Emacs Configure
;;; Package Managing
;; Bootstrapping straight.el
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
;; Integration with use-package
;; Ref: https://github.com/jwiegley/use-package
(straight-use-package 'use-package)
;;; Package Managing end
;;; Editor Configure
;; Change cursor type
(setq-default cursor-type 'bar)
;; Show line number
(global-linum-mode 1)
;; Don't create backup files
(setq make-backup-files nil)
;; Delete selection while inserting
(delete-selection-mode 1)
;; Highlight line where cursor lying on
(global-hl-line-mode 1)
;;; Editor Configure End
;;; Key binding
;;; Key binding End
;;; Shell Configure
;; Ensure environment variables inside Emacs
;; look the same as in the user's shell.
(use-package exec-path-from-shell
:straight t
:if (memq window-system '(mac ns))
:config
(exec-path-from-shell-initialize))
;;; Shell Configure End
;;; Theme Configure
(use-package doom-themes
:straight 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)
;; 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))
;;; Theme Configure End
;;; MacOS Misc
(when (string= system-type "darwin")
(setq dired-use-ls-dired nil))
;;; MacOS Misc End
;;; GUI Configure
(when (eq system-type 'darwin)
;; Make the title bar and toolbar to be transparent.
(add-to-list 'default-frame-alist
'(ns-transparent-titlebar . t))
(add-to-list 'default-frame-alist
'(ns-appearance . dark))
;; Change the opacity of the frame.
(add-to-list 'default-frame-alist
'(alpha . (100 . 100))))
;; Disable dialog box
(setq use-file-dialog nil
use-dialog-box nil)
;; Hide toolbar
(when (fboundp 'tool-bar-mode)
(tool-bar-mode -1))
;; Hide scrollbar
(when (fboundp 'set-scroll-bar-mode)
(set-scroll-bar-mode nil))
;;; GUI Configure End
;;; Dashboard
(use-package dashboard
:straight t
:config
(dashboard-setup-startup-hook))
;; Hide the original startup screen while opening file.
(setq inhibit-startup-screen t)
;;; Dashboard End
;;; Icon
(use-package all-the-icons
:straight t)
;;; Icon end
;;; Neotree
;; Project Directory Tree View
(use-package neotree
:straight t
:bind ("<f8>" . neotree-toggle))
;;; Neotree End
;;; Projectile
;; Docs: https://docs.projectile.mx/projectile/index.html
(use-package projectile
:straight t
:bind-keymap ("C-c p" . projectile-command-map)
:config
(projectile-mode +1)
(setq projectile-switch-project-action 'neotree-projectile-action))
;;; Projectile End
;;; Ivy
;; Ref: https://github.com/abo-abo/swiper#ivy
(use-package ivy
:straight t
:config
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
(setq ivy-count-format "(%d/%d) ")
(ivy-mode 1))
;;; Ivy End
;;; Counsel
;; Ref: https://github.com/abo-abo/swiper#counsel
(use-package counsel
:straight t
:after ivy)
;;; Counsel End
;;; Swiper
(use-package swiper
:straight t
:after ivy)
;;; Swiper End
;;; Company Mode
;; a text completion framework
(use-package company
:straight t
:config
(setq company-minimum-prefix-length 2)
(setq company-idle-delay 0.1)
(setq company-tooltip-align-annotations t)
:hook ((emacs-lisp-mode . company-mode)
(racket-mode . company-mode)
(racket-xp-mode . company-mode)
(racket-repl-mode . company-mode)))
;;; Company Mode End
;;; Rainbow Delimiters
(use-package rainbow-delimiters
:straight t
:hook ((emacs-lisp-mode . rainbow-delimiters-mode)
(racket-mode . rainbow-delimiters-mode)
(racket-xp-mode . rainbow-delimiters-mode)
(racket-repl . rainbow-delimiters-mode)))
;;; Rainbow Delimiters End
;;; Paredit Mode
;; Ref: The Animated Guide to Paredit
;; http://danmidwood.com/content/2014/11/21/animated-paredit.html
;; REf: Paredit-mode | WikiEmacs
;; http://wikemacs.org/wiki/Paredit-mode
(use-package paredit
:straight t
:hook ((emacs-lisp-mode . paredit-mode)
(racket-mode . paredit-mode)))
;;; Paredit Mode End
;;; Racket-Mode
(use-package racket-mode
:straight t
:hook (racket-mode . racket-xp-mode)
:bind (:map racket-mode-map
;; overwrites the default key binding of racket-mode
("M-." . racket-xp-visit-definition)
("C-c C-d" . racket-xp-documentation)
("C-c C-." . racket-xp-describe))
:config
;; don't show the pos-tip, either the pseudo tip
(setq racket-show-functions '(racket-show-echo-area)))
;;; Racket End
;;; LSP Mode
(use-package lsp-mode
:straight t
:hook
(python-mode . lsp)
:commands lsp)
;;; LSP Mode End
;;; Org Mode
(straight-use-package 'org)
;;; Org Mode End
;;; Python-Mode
(use-package elpy
:straight t
:config
(elpy-enable))
;;; Python-Mode End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment