Last active
August 10, 2018 10:29
-
-
Save namtx/aa4465f9703f134f71692d10b64b1409 to your computer and use it in GitHub Desktop.
emacs config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Minimal UI | |
(scroll-bar-mode -1) | |
(tool-bar-mode -1) | |
(tooltip-mode -1) | |
(menu-bar-mode -1) | |
(add-to-list 'default-frame-alist '(font . "Inconsolata Bold")) | |
(add-to-list 'default-frame-alist '(height . 24)) | |
(add-to-list 'default-frame-alist '(width . 80)) | |
;; Package config | |
(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) | |
;; VIM mode | |
(use-package evil | |
:ensure t | |
:config | |
(evil-mode 1)) | |
;; Themes | |
(use-package spacemacs-theme | |
:defer t | |
:init | |
(load-theme 'spacemacs-dark 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 150 | |
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 | |
helm-locate-project-list t) | |
:config | |
(helm-mode 1)) | |
;; Which Key | |
(use-package which-key | |
:ensure t | |
:init | |
(setq which-key-separator " ") | |
(setq which-key-prefix-prefix "+") | |
:config | |
(which-key-mode 1)) | |
;; Custom keybinding | |
(use-package general | |
:ensure t | |
:config (general-define-key | |
:states '(normal visual insert emacs) | |
:prefix "SPC" | |
:non-normal-prefix "M-SPC" | |
;; "/" '(counsel-rg :which-key "ripgrep") ; You'll need to counsel package for this | |
"TAB" '(switch-to-prev-buffer :which-key "previous buffer") | |
"SPC" '(helm-M-x :which-key "M-x") | |
"ps" '(helm-projectile-switch-project :which-key "switch project") | |
;; Buffers | |
"bb" '(helm-buffers-list :which-key "buffers lits") | |
;; Windows | |
"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 down") | |
"w/" '(split-window-right :which-key "split right") | |
"w-" '(split-window-below :which-key "split bottom") | |
"wx" '(delete-window :which-key "delete window") | |
;; Neotree | |
"ft" '(neotree-toggle :which-key "toggle neotree") | |
;; Magit | |
"gs" '(magit-status :which-key "magit status") | |
"gd" '(magit-diff-popup :which-key "magit diff popup") | |
;; Files | |
"fg" '(helm-do-grep-ag :which-key "files grep") | |
;; Winum | |
"1" '(winum-select-window-1 :which-key "select window 1") | |
"2" '(winum-select-window-2 :which-key "select window 2") | |
"3" '(winum-select-window-3 :which-key "select window 3") | |
"4" '(winum-select-window-4 :which-key "select window 4") | |
"5" '(winum-select-window-5 :which-key "select window 5") | |
;; Helm Projectiles | |
"pf" '(helm-projectile-find-file :which-key "find files") | |
;; Other5 | |
"at" '(ansi-term :which-key "open terminal"))) | |
;; Projectile | |
(use-package projectile | |
:ensure t | |
:init | |
(setq projectile-require-project-root nil) | |
:config | |
(projectile-mode 1)) | |
;; All The Icons | |
(use-package all-the-icons :ensure t) | |
(use-package neotree | |
:ensure t | |
:init | |
(setq neo-theme (if (display-graphic-p) 'icons 'arrow))) | |
;; Open neotree after init | |
;; (add-hook 'after-init-hook #'neotree-toggle) | |
;; Show matching parens | |
(setq show-paren-delay 0) | |
(show-paren-mode 1) | |
;; Show num line | |
(global-linum-mode t) | |
;;Winum mode on | |
(winum-mode t) | |
;; Helm Projectile | |
(use-package helm-projectile | |
:ensure t | |
:init | |
(setq helm-projectile-fuzzy-match t) | |
:config | |
(helm-projectile-on)) | |
;; Commentary | |
(use-package evil-commentary | |
:ensure t | |
:config | |
(evil-commentary-mode t)) | |
;; Company mode | |
(use-package company | |
:ensure t | |
:init | |
(setq company-minimum-prefix-length 3) | |
(setq company-auto-complete nil) | |
(setq company-idle-delay 0) | |
(setq company-require-match 'never) | |
(setq company-frontends | |
'(company-pseudo-tooltip-unless-just-one-frontend | |
company-preview-frontend | |
company-echo-metadata-frontend)) | |
(setq tab-always-indent 'complete) | |
(defvar completion-at-point-functions-saved nil) | |
:config | |
(global-company-mode 1) | |
(define-key company-active-map (kbd "TAB") 'company-complete-common-or-cycle) | |
(define-key company-active-map (kbd "<tab>") 'company-complete-common-or-cycle) | |
(define-key company-active-map (kbd "S-TAB") 'company-select-previous) | |
(define-key company-active-map (kbd "<backtab>") 'company-select-previous) | |
(define-key company-mode-map [remap indent-for-tab-command] 'company-indent-for-tab-command) | |
(defun company-indent-for-tab-command (&optional arg) | |
(interactive "P") | |
(let ((completion-at-point-functions-saved completion-at-point-functions) | |
(completion-at-point-functions '(company-complete-common-wrapper))) | |
(indent-for-tab-command arg))) | |
(defun company-complete-common-wrapper () | |
(let ((completion-at-point-functions completion-at-point-functions-saved)) | |
(company-complete-common)))) | |
(use-package company-lsp | |
:ensure t | |
:init | |
(push 'company-lsp company-backends)) | |
;; Powerline | |
(use-package spaceline | |
:ensure t | |
:init | |
(setq powerline-default-separator 'slant) | |
:config | |
(spaceline-emacs-theme) | |
(spaceline-toggle-minor-modes-off) | |
(spaceline-toggle-buffer-size-off) | |
(spaceline-toggle-evil-state-on)) | |
(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. | |
'(custom-safe-themes | |
(quote | |
("bffa9739ce0752a37d9b1eee78fc00ba159748f50dc328af4be661484848e476" default))) | |
'(package-selected-packages | |
(quote | |
(evil-commentary spacemacs-theme helm-projectile winum evil-magit magit 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