Skip to content

Instantly share code, notes, and snippets.

@EkoAdiWijayanto
Last active December 12, 2017 05:55
Show Gist options
  • Save EkoAdiWijayanto/ed0b75ad1025f5b81ae34d9a3a91d376 to your computer and use it in GitHub Desktop.
Save EkoAdiWijayanto/ed0b75ad1025f5b81ae34d9a3a91d376 to your computer and use it in GitHub Desktop.
(require 'package)
(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.
'(auto-save-default nil)
'(backup-inhibited t t)
'(blink-cursor-mode nil)
'(column-number-mode t)
'(cursor-type (quote box))
'(custom-enabled-themes (quote (misterioso)))
'(delete-selection-mode t)
'(global-company-mode t)
'(global-hl-line-mode t)
'(global-hungry-delete-mode t)
'(global-linum-mode t)
'(global-undo-tree-mode t)
'(inhibit-startup-screen t)
'(initial-frame-alist (quote ((fullscreen . maximized))))
'(org-confirm-babel-evaluate nil)
'(org-src-fontify-natively 1)
'(package-archives
(quote
(("melpa" . "https://melpa.org/packages/")
("gnu" . "http://elpa.gnu.org/packages/"))))
'(package-enable-at-startup nil)
'(package-selected-packages
(quote
(beacon yasnippet which-key web-mode web-beautify visual-regexp use-package undo-tree smartparens rainbow-delimiters projectile plantuml-mode org-bullets ob-restclient neotree multiple-cursors move-text magit json-reformat js2-mode hungry-delete flymd expand-region emmet-mode dumb-jump counsel company-web company-restclient ace-window)))
'(show-smartparens-global-mode t)
'(smartparens-global-mode nil)
'(standard-indent 2)
'(tab-width 2)
'(tool-bar-mode nil)
'(truncate-lines t)
'(winner-mode t)
'(yas-global-mode t))
'(package-archives (quote (("melpa" . "http://melpa.org/packages/"))))
'(package-selected-packages
(quote
(org-bullets hungry-delete beacon counsel swiper flymd ace-window yasnippet which-key web-mode web-beautify visual-regexp use-package undo-tree smartparens rainbow-delimiters plantuml-mode ob-restclient neotree multiple-cursors move-text magit json-reformat js2-mode expand-region emmet-mode dumb-jump company-web company-restclient)))
(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.
'(aw-leading-char-face ((t (:inherit ace-jump-face-foreground :height 3.0))))
'(org-document-title ((t (:inherit default :weight bold :foreground "black" :font "Source Sans Pro" :height 1.5 :underline nil))))
'(org-level-1 ((t (:inherit default :weight bold :foreground "black" :font "Source Sans Pro" :height 1.75))))
'(org-level-2 ((t (:inherit default :weight bold :foreground "black" :font "Source Sans Pro" :height 1.5))))
'(org-level-3 ((t (:inherit default :weight bold :foreground "black" :font "Source Sans Pro" :height 1.25))))
'(org-level-4 ((t (:inherit default :weight bold :foreground "black" :font "Source Sans Pro" :height 1.1))))
'(org-level-5 ((t (:inherit default :weight bold :foreground "black" :font "Source Sans Pro"))))
'(org-level-6 ((t (:inherit default :weight bold :foreground "black" :font "Source Sans Pro"))))
'(org-level-7 ((t (:inherit default :weight bold :foreground "black" :font "Source Sans Pro"))))
'(org-level-8 ((t (:inherit default :weight bold :foreground "black" :font "Source Sans Pro"))))
'(rainbow-delimiters-depth-1-face ((t (:foreground "dark orange"))))
'(rainbow-delimiters-depth-2-face ((t (:foreground "deep pink"))))
'(rainbow-delimiters-depth-3-face ((t (:foreground "chartreuse"))))
'(rainbow-delimiters-depth-4-face ((t (:foreground "deep sky blue"))))
'(rainbow-delimiters-depth-5-face ((t (:foreground "yellow"))))
'(rainbow-delimiters-depth-6-face ((t (:foreground "orchid"))))
'(rainbow-delimiters-depth-7-face ((t (:foreground "spring green"))))
'(rainbow-delimiters-depth-8-face ((t (:foreground "sienna1")))))
(package-initialize)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(setq frame-title-format
(list (format "%s %%S: %%j " (system-name))
'(buffer-file-name "%f" (dired-directory dired-directory "%b"))))
(defalias 'yes-or-no-p 'y-or-n-p)
(let* ((variable-tuple (cond ((x-list-fonts "Source Sans Pro") '(:font "Source Sans Pro"))
((x-list-fonts "Lucida Grande") '(:font "Lucida Grande"))
((x-list-fonts "Verdana") '(:font "Verdana"))
((x-family-fonts "Sans Serif") '(:family "Sans Serif"))
(nil (warn "Cannot find a Sans Serif Font. Install Source Sans Pro."))))
(base-font-color (face-foreground 'default nil 'default))
(headline `(:inherit default :weight bold :foreground ,base-font-color)))
(custom-theme-set-faces 'user
`(org-level-8 ((t (,@headline ,@variable-tuple))))
`(org-level-7 ((t (,@headline ,@variable-tuple))))
`(org-level-6 ((t (,@headline ,@variable-tuple))))
`(org-level-5 ((t (,@headline ,@variable-tuple))))
`(org-level-4 ((t (,@headline ,@variable-tuple :height 1.1))))
`(org-level-3 ((t (,@headline ,@variable-tuple :height 1.25))))
`(org-level-2 ((t (,@headline ,@variable-tuple :height 1.5))))
`(org-level-1 ((t (,@headline ,@variable-tuple :height 1.75))))
`(org-document-title ((t (,@headline ,@variable-tuple :height 1.5 :underline nil))))))
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(use-package which-key
:ensure t
:config (which-key-mode))
(use-package emmet-mode
:ensure t
:init
(add-hook 'sgml-mode-hook 'emmet-mode) ;; Auto-start on any markup modes
(add-hook 'css-mode-hook 'emmet-mode)) ;; enable Emmet's css abbreviation.
(use-package undo-tree
:ensure t
:init
(global-undo-tree-mode 1)
(global-set-key (kbd "C-z") 'undo)
(global-set-key (kbd "C-S-z") 'redo)
(global-set-key (kbd "M-/") 'undo-tree-visualize))
(use-package js2-mode
:ensure t
:config
(setq js-indent-level 2)
(setq js2-basic-offset 2)
:mode (("\\.js\\'" . js2-mode)))
(use-package neotree
:ensure t
:init
(global-set-key [f8] 'neotree-toggle))
(use-package expand-region
:ensure t
:init
(global-set-key (kbd "C-=") 'er/expand-region))
(use-package web-mode
:ensure t
:init
(add-hook 'web-mode-hook 'emmet-mode))
(use-package smartparens
:ensure t
:config
(show-smartparens-global-mode t)
(smartparens-global-mode t))
(use-package ace-window
:ensure t
:init
(progn
(global-set-key [remap other-window] 'ace-window)
(custom-set-faces
'(aw-leading-char-face
((t (:inherit ace-jump-face-foreground :height 3.0)))))
))
(use-package yasnippet
:ensure t
:init
(yas-global-mode))
(use-package visual-regexp
:ensure t
:init
;;visual regexp search replace
(define-key global-map (kbd "C-c r") 'vr/replace)
(define-key global-map (kbd "C-c q") 'vr/query-replace)
;; if you use multiple-cursors, this is for you:
(define-key global-map (kbd "C-c m") 'vr/mc-mark))
(use-package flymd
:ensure t
:init
(defun my-flymd-browser-function (url)
(let ((browse-url-browser-function 'browse-url-firefox))
(browse-url url)))
(setq flymd-browser-open-function 'my-flymd-browser-function))
(use-package rainbow-delimiters
:ensure t)
(use-package plantuml-mode
:ensure t
:mode ("\\.plantuml\\'" . plantuml-mode))
(use-package ob-restclient
:ensure t)
(use-package multiple-cursors
:ensure t
:init
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this))
(use-package hungry-delete
:ensure t
:config
(global-hungry-delete-mode))
(use-package org-bullets
:ensure t
:init
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
(use-package beacon
:ensure t
:config
:init
(setq beacon-push-mark 35)
(setq beacon-color "#ff0000")
(beacon-mode))
;; (use-package helm
;; :ensure t
;; :config
;; (setq helm-ff-transformer-show-only-basename nil
;; helm-adaptive-history-file "~/.emacs.d/data/helm-history"
;; helm-yank-symbol-first t
;; helm-move-to-line-cycle-in-source t
;; helm-buffers-fuzzy-matching t
;; helm-ff-auto-update-initial-value t)
;; :init
;; (autoload 'helm-descbinds "helm-descbinds" t)
;; (autoload 'helm-eshell-history "helm-eshell" t)
;; (autoload 'helm-esh-pcomplete "helm-eshell" t)
;; (add-hook 'eshell-mode-hook
;; #'(lambda ()
;; (define-key eshell-mode-map (kbd "TAB") #'helm-esh-pcomplete)
;; (define-key eshell-mode-map (kbd "C-c C-l") #'helm-eshell-history)))
;; :bind (("M-x" . helm-M-x)
;; ("C-x b" . helm-mini)
;; ("C-x C-b" . helm-buffers-list)
;; ("C-x C-f" . helm-find-files)
;; ("C-x C-r" . helm-recentf)
;; ("C-x r l" . helm-filtered-bookmarks)
;; ("M-y" . helm-show-kill-ring)
;; ("M-s o" . helm-swoop)
;; ("M-s /" . helm-multi-swoop)))
;;move-text magit json-reformat js2-mode helm-projectile expand-region emmet-mode dumb-jump company-web company-restclient
(use-package company
:ensure t
:config
(global-company-mode))
(use-package company-web
:ensure t)
(use-package company-restclient
:ensure t
:init
(add-to-list 'company-backends 'company-restclient))
(use-package projectile
:ensure t)
;; (use-package helm-projectile
;; :ensure t)
(use-package move-text
:ensure t)
(use-package json-reformat
:ensure t)
(use-package dumb-jump
:ensure t)
(use-package magit
:ensure t)
(use-package counsel
:ensure t)
(use-package swiper
:ensure t
:config
(progn
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
(global-set-key "\C-s" 'swiper)
(global-set-key (kbd "C-c C-r") 'ivy-resume)
(global-set-key (kbd "<f6>") 'ivy-resume)
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
(global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
(global-set-key (kbd "C-c g") 'counsel-git)
(global-set-key (kbd "C-c j") 'counsel-git-grep)
(global-set-key (kbd "C-c k") 'counsel-ag)
(global-set-key (kbd "C-x l") 'counsel-locate)
(global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)))
(org-babel-do-load-languages
'org-babel-load-languages
'((js . t)
(restclient . t)))
;; scroll zoom
(global-set-key [C-mouse-4] 'text-scale-increase)
(global-set-key [C-mouse-5] 'text-scale-decrease)
(eval-after-load 'js
'(add-hook 'js2-mode-hook
(lambda ()
(add-hook 'before-save-hook 'web-beautify-js-buffer t t))))
(eval-after-load 'json-mode
'(add-hook 'json-mode-hook
(lambda ()
(message "json-mode %s" "sds")
(add-hook 'before-save-hook 'web-beautify-js-buffer t t))))
(eval-after-load 'sgml-mode
'(add-hook 'html-mode-hook
(lambda ()
(message "sgml-mode %s" "sds")
(add-hook 'before-save-hook 'web-beautify-html-buffer t t))))
(eval-after-load 'web-mode
'(add-hook 'web-mode-hook
(lambda ()
(message "web-mode %s" "sds")
(add-hook 'before-save-hook 'web-beautify-html-buffer t t))))
(eval-after-load 'css-mode
'(add-hook 'css-mode-hook
(lambda ()
(add-hook 'before-save-hook 'web-beautify-css-buffer t t))))
(defun duplicate-current-line-or-region (arg)
"Duplicates the current line or region ARG times."
"If there's no region, the current line will be duplicated. However, if"
"there's a region, all lines that region covers will be duplicated."
(interactive "p")
(let (beg end (origin (point)))
(if (and mark-active (> (point) (mark)))
(exchange-point-and-mark))
(setq beg (line-beginning-position))
(if mark-active
(exchange-point-and-mark))
(setq end (line-end-position))
(let ((region (buffer-substring-no-properties beg end)))
(dotimes (i arg)
(goto-char end)
(newline)
(insert region)
(setq end (point)))
(goto-char (+ origin (* (length region) arg) arg)))))
(global-set-key (kbd "C-c d") 'duplicate-current-line-or-region)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment