Skip to content

Instantly share code, notes, and snippets.

@marioidival marioidival/init.el
Last active Feb 11, 2018

What would you like to do?
my emacs config
(require 'package)
(add-to-list 'package-archives
'("melpa" . ""))
(require 'go-eldoc)
(add-hook 'go-mode-hook 'go-eldoc-setup)
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet")
;; (add-to-list 'yas-snippet-dirs "~/.emacs.d/snippets")
(defconst private-dir (expand-file-name "private" user-emacs-directory))
(defconst temp-dir
(format "%s/cache" private-dir)
"Hostname-based elisp temp directories")
(use-package yasnippet
("C-c y s" . yas-insert-snippet)
("C-c y v" . yas-visit-snippet-file)
(add-to-list 'yas-snippet-dirs "~/.emacs.d/snippets")
(yas-global-mode 1))
;; configs
(use-package ace-jump-mode
("C-c SPC" . ace-jump-mode))
(use-package anzu
(global-anzu-mode +1)
(global-set-key [remap query-replace] 'anzu-query-replace)
(global-set-key [remap query-replace-regexp] 'anzu-query-replace-regexp))
(use-package company
("M-TAB" . company-complete) ;; ALT-TAB ???????
(add-hook 'after-init-hook 'global-company-mode))
(use-package hungry-delete
(use-package hlinum
(use-package linum
(setq linum-format " %3d ")
(global-linum-mode nil))
(use-package ido
(ido-mode 'both)
(ido-everywhere t)
(setq ido-auto-merge-delay-time 4
ido-enable-flex-matching t
ido-max-window-height 1
ido-use-virtual-buffers t
ido-use-filename-at-point 'guess
ido-create-new-buffer 'always
ido-file-extensions-order '(".org" ".txt" ".py" ".emacs" ".xml" ".el"
".ini" ".cfg" ".cnf" ".conf" ".go" ".sh")
ido-ignore-extensions t
ido-ignore-files '("\\`CVS/" "\\`#" "\\`.#" "\\`\\.\\./" "\\`\\./"
(use-package ibuffer
("C-x C-b" . ibuffer))
(use-package ido-grid-mode
:ensure t
(ido-grid-mode 1)
(setq ido-grid-mode-max-rows 4
ido-grid-mode-min-rows 4)
(setq ido-max-window-height (+ ido-grid-mode-max-rows 1)))
(use-package flx-ido
:ensure t
(flx-ido-mode t)
(setq ido-enable-flex-matching t))
(use-package rotate
("C-c C-r w" . rotate-window)
("C-c C-r l" . rotate-layout))
(use-package smartparens)
(use-package smex
:ensure t
(setq smex-save-file (expand-file-name "smex-items" temp-dir))
("M-x" . smex)
("M-X" . smex-major-mode-commands)
;; if you want to be able to M-x without meta
("C-x C-m" . smex)
;; default Emacs M-x
("C-c C-c M-x" . execute-extended-command)
(use-package syntax-subword
("M-j" . syntax-subword-backward)
("M-l" . syntax-subword-forward))
(use-package undo-tree
(global-undo-tree-mode 1)
;; Remember undo history
(setq undo-tree-auto-save-history nil
undo-tree-history-directory-alist `(("." . ,(concat temp-dir "/undo/")))))
(use-package which-key
(use-package windmove
("C-c i" . windmove-up)
("C-c k" . windmove-down)
("C-c j" . windmove-left)
("C-c l" . windmove-right))
(use-package recentf
(setq recentf-exclude '("/elpa/" ;; ignore all files in elpa directory
"/tmp/" ;; ignore temporary files
recentf-save-file (recentf-expand-file-name "~/.emacs.d/private/cache/recentf"))
(recentf-mode 1))
(use-package neotree
(setq neo-theme 'arrow
neotree-smart-optn t
neo-window-fixed-size nil)
;; Disable linum for neotree
(add-hook 'neo-after-create-hook 'disable-neotree-hook)
("C-x C-t" . neotree-toggle))
(use-package web-mode
(setq web-mode-markup-indent-offset 2
web-mode-css-indent-offset 2
web-mode-code-indent-offset 2
web-mode-enable-current-element-highlight t)
(add-to-list 'auto-mode-alist '("\\.js\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tmpl\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.jsx$" . web-mode))
(add-hook 'web-mode-hook 'jsx-flycheck))
(use-package typescript-mode)
(use-package powerline)
;; colorscheme
;;(use-package rebecca-theme)
(use-package github-modern-theme)
;; (load-theme github-modern)
(use-package ediff
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
(setq-default ediff-highlight-all-diffs 'nil)
(setq ediff-diff-options "-w"))
;; Custom line number stuff
(set-face-attribute 'fringe nil)
(set-face-foreground 'linum-highlight-face "#00B3EF")
(set-face-background 'linum-highlight-face "#1f252b")
(use-package flycheck
:ensure t
:init (global-flycheck-mode))
(use-package go-mode
; Use goimports instead of go-fmt
(setq gofmt-command "goimports")
(add-hook 'go-mode-hook 'company-mode)
;; Call Gofmt before saving
(add-hook 'before-save-hook 'gofmt-before-save)
(add-hook 'go-mode-hook 'setup-go-mode-compile)
(add-hook 'go-mode-hook #'smartparens-mode)
;; (add-hook 'go-mode-hook #'go-guru-hl-identifier-mode)
(add-hook 'go-mode-hook (lambda ()
(setq tab-width 4)
(local-set-key (kbd "C-c C-r") 'go-remove-unused-imports)
(local-set-key (kbd "C-c C-g") 'go-goto-imports)
(set (make-local-variable 'company-backends) '(company-go))
;; end configs
;; Core settings
;; UTF-8 please
(set-charset-priority 'unicode)
(setq locale-coding-system 'utf-8) ; pretty
(set-terminal-coding-system 'utf-8) ; pretty
(set-keyboard-coding-system 'utf-8) ; pretty
(set-selection-coding-system 'utf-8) ; please
(prefer-coding-system 'utf-8) ; with sugar on top
(setq default-process-coding-system '(utf-8-unix . utf-8-unix))
(fset 'yes-or-no-p 'y-or-n-p)
(global-auto-revert-mode t)
confirm-kill-emacs 'y-or-n-p
confirm-nonexistent-file-or-buffer t
save-interprogram-paste-before-kill t
mouse-yank-at-point t
require-final-newline nil
visible-bell nil
ring-bell-function 'ignore
custom-file "~/.emacs.d/.custom.el"
'(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)
;; persistent bookmarks
bookmark-save-flag t
bookmark-default-file (concat temp-dir "/bookmarks")
;; Disable backups (that's what git/dropbox are for)
history-length 1000
auto-save-default nil
auto-save-list-file-name (concat temp-dir "/autosave")
make-backup-files nil
create-lockfiles nil
backup-directory-alist `((".*" . ,(concat temp-dir "/backup/")))
auto-save-file-name-transforms `((".*" ,(concat temp-dir "/auto-save-list/") t))
;; Disable non selected window highlight
cursor-in-non-selected-windows nil
highlight-nonselected-windows nil
exec-path (append exec-path '("/usr/local/bin/"))
;; Backups disabled
backup-inhibited t
make-backup-files nil
indent-tabs-mode nil
inhibit-startup-message t
fringes-outside-margins t
x-select-enable-clipboard t
use-package-always-ensure t
vc-follow-symlinks t
auto-revert-check-vc-info nil
frame-resize-pixelwise t)
;; Disable toolbar & menubar
(menu-bar-mode -1)
(when (fboundp 'tool-bar-mode)
(tool-bar-mode -1))
(when ( fboundp 'scroll-bar-mode)
(scroll-bar-mode -1))
(show-paren-mode 1)
(desktop-save-mode 0)
(set-default-font "Hack 10")
;; Delete trailing whitespace before save
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(add-to-list 'auto-mode-alist '("\\.psql$" . sql-mode))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.