Skip to content

Instantly share code, notes, and snippets.

@yilinwei
Created May 16, 2016 01:03
Show Gist options
  • Save yilinwei/9ea61f179c4c82a6a83c46e5019f52e7 to your computer and use it in GitHub Desktop.
Save yilinwei/9ea61f179c4c82a6a83c46e5019f52e7 to your computer and use it in GitHub Desktop.
;; global variables
(setq
inhibit-startup-screen t
create-lockfiles nil
make-backup-files nil
column-number-mode t
scroll-error-top-bottom t
show-paren-delay 0.5
use-package-always-ensure t
sentence-end-double-space nil)
;; buffer local variables
(setq-default
indent-tabs-mode nil
tab-width 4
c-basic-offset 4)
;; modes
(electric-indent-mode 0)
;; global keybindings
(global-unset-key (kbd "C-z"))
;; the package manager
(require 'package)
(setq
use-package-always-ensure t
package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("org" . "http://orgmode.org/elpa/")
("melpa" . "http://melpa.org/packages/")))
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents)
(package-install 'use-package))
(require 'use-package)
;;projectile
(use-package projectile
:demand
:init (setq projectile-use-git-grep t)
:config (projectile-global-mode t)
:bind (("s-f" . projectile-find-file)
("s-F" . projectile-grep)))
;;flx-ido
(use-package flx-ido
:demand
:init
(setq
ido-enable-flex-matching t
;; C-d to open directories
;; C-f to revert to find-file
ido-show-dot-for-dired nil
ido-enable-dot-prefix t)
:config
(ido-mode 1)
(ido-everywhere 1)
(flx-ido-mode 1))
;;company-mode
(use-package company
:diminish company-mode
:commands company-mode
:init
(setq
company-dabbrev-ignore-case nil
company-dabbrev-code-ignore-case nil
company-dabbrev-downcase nil
company-idle-delay 0
company-minimum-prefix-length 4)
:config
;; disables TAB in company-mode, freeing it for yasnippet
(define-key company-active-map [tab] nil))
;;YAS snippet
(use-package yasnippet
:diminish yas-minor-mode
:commands yas-minor-mode
:config (yas-reload-all))
;;Smart parens
(use-package smartparens
:diminish smartparens-mode
:commands
smartparens-strict-mode
smartparens-mode
sp-restrict-to-pairs-interactive
sp-local-pair
:init
(setq sp-interactive-dwim t)
:config
(require 'smartparens-config)
(sp-use-smartparens-bindings)
(sp-pair "(" ")" :wrap "C-(") ;; how do people live without this?
(sp-pair "[" "]" :wrap "s-[") ;; C-[ sends ESC
(sp-pair "{" "}" :wrap "C-{")
;; WORKAROUND https://github.com/Fuco1/smartparens/issues/543
(bind-key "C-<left>" nil smartparens-mode-map)
(bind-key "C-<right>" nil smartparens-mode-map)
(bind-key "s-<delete>" 'sp-kill-sexp smartparens-mode-map)
(bind-key "s-<backspace>" 'sp-backward-kill-sexp smartparens-mode-map))
;;popup imenu
(use-package popup-imenu
:commands popup-imenu
:bind ("M-i" . popup-imenu))
(use-package magit
:commands magit-status magit-blame
:init (setq
magit-revert-buffers nil)
:bind (("s-g" . magit-status)
("s-b" . magit-blame)))
;; ensime
(use-package ensime
:commands ensime ensime-mode)
(add-hook 'scala-mode-hook
(lambda()
(show-paren-mode)
(smartparens-mode)
(yas-minor-mode)
(company-mode)
(ensime-mode)
(linum-mode)
))
(setenv "SBT_OPTS" (concat (getenv "SBT_OPTS") " -Djline.terminal=jline.UnsupportedTerminal" ) )
(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-enabled-themes (quote (wombat))))
(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.
)
(put 'downcase-region 'disabled nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment