Skip to content

Instantly share code, notes, and snippets.

@eli-oat
Forked from huytd/customize.material-dark-theme.md
Created July 5, 2018 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eli-oat/30c886fb13c5046132d32c98c757bec4 to your computer and use it in GitHub Desktop.
Save eli-oat/30c886fb13c5046132d32c98c757bec4 to your computer and use it in GitHub Desktop.
My minimal Emacs config

Screenshot:

Custom keybinding:

  General:
    SPC /     : ripgrep
    SPC TAB   : previous buffer
    SPC SPC   : Open M-x
  
  Files:
    SPC p f   : find files
  
  Buffers:
    SPC b b   : buffers list
    
  Window:
    SPC w l   : move right
    SPC w h   : move left 
    SPC w j   : move down
    SPC w k   : move up
    SPC w /   : split right
    SPC w -   : split bottom
    SPC w x   : close window
  
  Other:
    SPC a t   : open terminal in current buffer
;; Package configs
(require 'package)
(setq package-enable-at-startup nil)
(setq package-archives '(("org" . "http://orgmode.org/elpa/")
("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")))
(package-initialize)
;; Bootstrap `use-package`
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(require 'use-package)
;; Other configs
(add-to-list 'exec-path "/usr/local/bin/")
(setq make-backup-files nil)
(setq auto-save-default nil)
;; Splash Screen
(setq inhibit-startup-screen t)
(setq initial-scratch-message ";; Happy Hacking")
;; Show matching parens
(setq show-paren-delay 0)
(show-paren-mode 1)
;; Paragraph movement
(global-set-key (kbd "s-j") 'forward-paragraph)
(global-set-key (kbd "s-k") 'backward-paragraph)
;; OrgMode Configs
(setq org-html-validation-link nil)
(setq org-todo-keywords
'((sequence "TODO" "WORKING" "HOLD" "|" "DONE")))
(setq org-todo-keyword-faces
'(("TODO" . "blue")
("WORKING" . "yellow")
("HOLD" . "red")
("DONE" . "green")))
;; UI configurations
(scroll-bar-mode -1)
(tool-bar-mode -1)
(tooltip-mode -1)
(menu-bar-mode -1)
(global-linum-mode 1)
(add-to-list 'default-frame-alist '(font . "mononoki-12"))
(add-to-list 'default-frame-alist '(height . 24))
(add-to-list 'default-frame-alist '(width . 80))
;; Vim mode
(use-package evil
:ensure t
:config
(evil-mode 1))
(use-package evil-escape
:ensure t
:init
(setq-default evil-escape-key-sequence "jk")
:config
(evil-escape-mode 1))
;; Theme
(use-package doom-themes
:ensure t
:config
(load-theme 'doom-one t))
;; Helm
(use-package helm
:ensure t
:init
(setq helm-M-x-fuzzy-match t
helm-mode-fuzzy-match t
helm-buffers-fuzzy-matching t
helm-recentf-fuzzy-match t
helm-locate-fuzzy-match t
helm-semantic-fuzzy-match t
helm-imenu-fuzzy-match t
helm-completion-in-region-fuzzy-match t
helm-candidate-number-list 80
helm-split-window-in-side-p t
helm-move-to-line-cycle-in-source t
helm-echo-input-in-header-line t
helm-autoresize-max-height 0
helm-autoresize-min-height 20)
:config
(helm-mode 1))
;; RipGrep
(use-package helm-rg :ensure t)
;; Projectile
(use-package projectile
:ensure t
:init
(setq projectile-require-project-root nil)
:config
(projectile-mode 1))
;; Helm Projectile
(use-package helm-projectile
:ensure t
:init
(setq helm-projectile-fuzzy-match t)
:config
(helm-projectile-on))
;; All The Icons
(use-package all-the-icons :ensure t)
;; NeoTree
(use-package neotree
:ensure t
:init
(setq neo-theme (if (display-graphic-p) 'icons 'arrow)))
;; Which Key
(use-package which-key
:ensure t
:init
(setq which-key-separator " ")
(setq which-key-prefix-prefix "+")
:config
(which-key-mode))
;; Custom keybinding
(use-package general
:ensure t
:config (general-define-key
:states '(normal visual insert emacs)
:prefix "SPC"
:non-normal-prefix "M-SPC"
"/" '(helm-projectile-rg :which-key "ripgrep")
"TAB" '(switch-to-prev-buffer :which-key "previous buffer")
"SPC" '(helm-M-x :which-key "M-x")
"pf" '(helm-projectile-find-file :which-key "find files")
"pp" '(helm-projectile-switch-project :which-key "switch project")
"pb" '(helm-projectile-switch-to-buffer :which-key "switch buffer")
"pr" '(helm-show-kill-ring :which-key "show kill ring")
;; Buffers
"bb" '(helm-mini :which-key "buffers list")
;; Window
"wl" '(windmove-right :which-key "move right")
"wh" '(windmove-left :which-key "move left")
"wk" '(windmove-up :which-key "move up")
"wj" '(windmove-down :which-key "move bottom")
"w/" '(split-window-right :which-key "split right")
"w-" '(split-window-below :which-key "split bottom")
"wx" '(delete-window :which-key "delete window")
"qz" '(delete-frame :which-key "delete frame")
"qq" '(kill-emacs :which-key "quit")
;; NeoTree
"ft" '(neotree-toggle :which-key "toggle neotree")
;; Others
"at" '(ansi-term :which-key "open terminal")
))
;; Fancy titlebar for MacOS
(add-to-list 'default-frame-alist '(ns-transparent-titlebar . t))
(add-to-list 'default-frame-alist '(ns-appearance . dark))
(setq ns-use-proxy-icon nil)
(setq frame-title-format nil)
(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.
'(package-selected-packages
(quote
(general which-key helm doom-themes evil 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