Skip to content

Instantly share code, notes, and snippets.

@asheshambasta asheshambasta/init.el Secret
Created Mar 28, 2019

What would you like to do?
;; global variables
inhibit-startup-screen t
ispell-program-name "/usr/bin/ispell"
create-lockfiles nil
erc-prompt-for-password nil
make-backup-files nil
;; column-number-mode t
scroll-error-top-bottom t
show-paren-delay 0.5
use-package-always-ensure t
auto-hscroll-mode 'current-line
sentence-end-double-space nil)
;; (setq frame-title-format
;; (list (format "%s %%S: %%j" (system-name))
;; '("%f")))
(defun my/extract-package-module (str)
"Extract the module name from the incoming lines."
(replace-regexp-in-string "^\\(module\\|package\\)" "" str))
(setq buffer-substring-filters
(setq frame-title-format
(:eval (if (buffer-file-name)
(replace-regexp-in-string "^.*\\(centralapp\/\\|haskell\/\\|asheshambasta\/code\/\\|asheshambasta\/\\)" ".." (abbreviate-file-name (buffer-file-name)))
(add-to-list 'load-path "~/.emacs.d/custom-scripts/")
(when (fboundp 'winner-mode)
(winner-mode 1))
(ido-mode 1)
(setq auto-revert-check-vc-info t)
;; buffer local variables
indent-tabs-mode nil
tab-width 4
c-basic-offset 4)
;; modes
(electric-indent-mode 0)
;; (hs-minor-mode 1)
;; for frames-only-mode
(global-set-key (kbd "C-M-m") 'make-frame)
(global-set-key (kbd "C-M-g") 'delete-frame)
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
;; (global-set-key (kbd "C-z") 'make-frame)
;; This is your old M-x.
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)
;; (require 'grep-a-lot)
;; (grep-a-lot-setup-keys)
;; (grep-a-lot-advise igrep)
(require 'misc)
(require 'package)
package-archives '(("gnu" . "")
("org" . "")
("melpa" . "")
("melpa-stable" . ""))
package-archive-priorities '(("melpa-stable" . 3)
("gnu" . 2)
("melpa" . 1)))
;; (when (not package-archive-contents)
;; (package-refresh-contents)
;; (package-install 'use-package))
(require 'use-package)
;; 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.
[default default default italic underline success warning error])
["black" "red3" "ForestGreen" "yellow4" "blue" "magenta3" "DeepSkyBlue" "gray50"])
'(blink-cursor-mode t)
'("5f27195e3f4b85ac50c1e2fac080f0dd6535440891c54fcfa62cdcefedf56b1b" "26d49386a2036df7ccbe802a06a759031e4455f07bda559dcf221f53e8850e69" "4aafea32abe07a9658d20aadcae066e9c7a53f8e3dfbd18d8fa0b26c24f9082c" "b9cbfb43711effa2e0a7fbc99d5e7522d8d8c1c151a3194a4b176ec17c9a8215" "291588d57d863d0394a0d207647d9f24d1a8083bb0c9e8808280b46996f3eb83" "ba398421a1223adf55cf9ca3762d19c82c51610fce5246976f016c8afb33dab5" "33466731f5c1e020e91dbcf8a44e095b41805d0cac98cd20e8f437ba32c6134c" "e598fb69b8d73182d82e37015f0df7e31b47784e8f393bfa5962fabd9b77677b" "60853b29f9c7c6f9f8d05059e14a41fa908bdfad17bccf9ebe6d0e47bb3a9dff" "4c7a1f0559674bf6d5dd06ec52c8badc5ba6e091f954ea364a020ed702665aa1" "617341f1be9e584692e4f01821716a0b6326baaec1749e15d88f6cc11c288ec6" default))
'(custom-theme-directory "~/.emacs.d/custom-themes")
'(elfeed-feeds '(""))
'(erc-autoaway-idle-method 'emacs)
'(erc-autoaway-idle-seconds 600)
'(("" "#haskell" "#haskell-ide-engine" "#emacs")))
'(erc-autojoin-delay 120)
'(erc-autojoin-mode nil)
'(autojoin button completion fill irccontrols list match menu move-to-prompt netsplit networks noncommands readonly ring sound stamp track))
'(erc-nick "asheshambasta")
'(erc-notifications-bus "")
'(erc-notifications-mode nil)
'(erc-notify-mode t)
'(erc-pals '("kuribas"))
'(erc-prompt ">")
'(erc-server-reconnect-attempts t)
'(erc-server-reconnect-timeout 10)
'(erc-system-name "quasar-c")
'(erc-track-exclude-types '("JOIN" "KICK" "NICK" "QUIT" "333" "353"))
'(erc-track-showcount t)
'(erc-track-switch-direction 'newest)
'(erc-user-full-name "Ashesh Ambasta")
'(global-display-line-numbers-mode t)
'(haskell-process-auto-import-loaded-modules t)
'(haskell-process-log t)
'(haskell-process-suggest-remove-import-lines t)
'(haskell-stylish-on-save t)
'(haskell-tags-on-save t)
'(magithub-dashboard-show-unread-notifications t)
'(menu-bar-mode nil)
'(sqlup-mode evil-visual-mark-mode evil-commentary evil-surround evil-collection evil-magit powerline-evil evil url-util el-get-bundle intero free-keys monokai-theme ace-jump-buffer erc-terminal-notifier terminal-notifier autopair elfeed which-key company-lsp projectile-codesearch format-sql yaml-mode flx-ido projectile expand-region mysql sql-mode ghc dash-functional flycheck beacon moe-theme prodigy dimmer undo-tree shm company-mode smex rainbow-mode magit-gitflow yagist ghub-plus magithub dirtree use-package ensime magit hindent ace-window haskell-mode))
'(safe-local-variable-values '((dockerfile-image-name . "centralapp/vela-nginx")))
'(tool-bar-mode nil))
;; recentf mode
(recentf-mode 1)
;; some ERC stuff
(setq erc-hide-list '("JOIN" "PART" "QUIT"))
;; makes popup windows for messages etc.
(add-to-list 'load-path "~/.emacs.d/manual-install")
(add-to-list 'load-path "~/.emacs.d/manual-install/powerline")
(add-to-list 'load-path "~/.emacs.d/manual-install/dired-hacks")
(require 'popwin)
(popwin-mode 1)
;; done for Haskell autocompletion
(require 'company)
;; (use-package erc-terminal-notifier
;; :pin melpa)
(use-package ace-jump-buffer
:pin melpa)
;; (use-package zzz-to-char
;; :pin melpa
;; :config (require 'zzz-to-char)
;; )
(use-package flycheck
:pin melpa)
(use-package dash-functional
:pin melpa)
;; HaRe: Haskell refactoring
; (add-to-list 'load-path (expand-file-name "~/.stack/snapshots/x86_64-osx/lts-8.13/8.0.2/share/x86_64-osx-ghc-8.0.2/HaRe-"))
;; (require 'hare)
;; (autoload 'hare-init "hare" nil t)
;; enable highlight indentation
(require 'highlight-indentation)
;; api testing (restclient)
(add-to-list 'load-path "~/.emacs.d/manual-install/restclient")
(require 'restclient)
;; alignment
;; see:
(require 'align-by-current-symbol)
(global-set-key (kbd "C-c C-.") 'align-by-current-symbol)
;; format Haskell files using brittany
(defun brittany-format-buffer-file ()
"run brittany command on the current file and revert the buffer"
(format "brittany %s --write-mode=inplace --indent 2"
(shell-quote-argument (buffer-file-name)))
(revert-buffer t t t))
(add-hook 'haskell-mode-hook
(lambda ()
(local-set-key (kbd "C-c C-f") 'brittany-format-buffer-file)))
(eval-after-load 'haskell-mode
'(define-key haskell-mode-map [f8] 'haskell-navigate-imports))
(add-hook 'haskell-mode-hook (lambda() (turn-on-haskell-indentation)))
(add-hook 'haskell-mode-hook #'hindent-mode)
(add-hook 'haskell-mode-hook 'flycheck-mode)
(add-hook 'haskell-mode-hook 'yas-minor-mode)
(add-hook 'haskell-mode-hook 'subword-mode)
(add-hook 'haskell-mode-hook 'highlight-indentation-mode)
(add-hook 'haskell-mode-hook 'rainbow-delimiters-mode)
;; fix for
(setq haskell-process-args-ghci
'("-ferror-spans" "-fshow-loaded-modules"))
(setq haskell-process-args-cabal-repl
'("--ghc-options=-ferror-spans -fshow-loaded-modules"))
(setq haskell-process-args-stack-ghci
'("--ghci-options=-ferror-spans -fshow-loaded-modules"
"--no-build" "--no-load"))
(setq haskell
'("--ghc-options=-ferror-spans -fshow-loaded-modules"))
;; intero
;; (require 'intero)
(use-package intero
:pin melpa
:config (setq intero-blacklist '("/home/ashesh/.xmonad/"))
(add-hook 'haskell-mode-hook 'intero-global-mode)
(flycheck-add-next-checker 'intero '(warning . haskell-hlint))
(load "ghcid.el")
;; YAS
(require 'yasnippet)
(setq yas-snippet-dirs '("~/.emacs.d/snippets"))
(add-hook 'scala-mode-hook 'subword-mode)
;; load some customisations
(load "~/.emacs.d/custom-scripts/shell-pop.el")
(load "~/.emacs.d/custom-scripts/goto-last-change.el")
(load "~/.emacs.d/custom-scripts/magit-bindings.el")
(load "~/.emacs.d/custom-scripts/sbt.el")
(load "~/.emacs.d/custom-scripts/text-manip.el")
;; custom themes
(add-to-list 'custom-theme-load-path "~/.emacs.d/custom-themes")
(use-package helm
:pin melpa
;; sets cabal path
(let ((my-cabal-path (expand-file-name "~/.cabal/bin")))
(let ((my-stack-path (expand-file-name "~/.local/bin")))
(let ((usr-local-bin-path (expand-file-name "/usr/local/bin")))
(setenv "PATH" (concat my-cabal-path path-separator my-stack-path path-separator usr-local-bin-path path-separator (getenv "PATH")))
(add-to-list 'exec-path my-cabal-path))))
(setq exec-path (split-string (getenv "PATH") path-separator))
(setq ispell-program-name "/usr/bin/ispell")
;; saves sessions on exit
(desktop-save-mode 1)
;; interactive haskell commands
(eval-after-load 'haskell-mode '(progn
(define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-file)
(define-key haskell-mode-map (kbd "C-c C-z") 'haskell-interactive-switch)
(define-key haskell-mode-map (kbd "C-c C-n C-t") 'haskell-process-do-type)
(define-key haskell-mode-map (kbd "C-c C-n C-i") 'haskell-process-do-info)
(define-key haskell-mode-map (kbd "C-c C-n C-c") 'haskell-process-cabal-build)
(define-key haskell-mode-map (kbd "C-c C-n c") 'haskell-process-cabal)))
(eval-after-load 'haskell-cabal '(progn
(define-key haskell-cabal-mode-map (kbd "C-c C-z") 'haskell-interactive-switch)
(define-key haskell-cabal-mode-map (kbd "C-c C-k") 'haskell-interactive-mode-clear)
(define-key haskell-cabal-mode-map (kbd "C-c C-c") 'haskell-process-cabal-build)
(define-key haskell-cabal-mode-map (kbd "C-c c") 'haskell-process-cabal)))
(eval-after-load 'haskell-mode
'(define-key haskell-mode-map (kbd "C-c C-o") 'haskell-compile))
(eval-after-load 'haskell-cabal
'(define-key haskell-cabal-mode-map (kbd "C-c C-o") 'haskell-compile))
;; ace window lets you switch between windows
(global-set-key (kbd "M-[") 'ace-window)
(global-set-key (kbd "C-c j") 'ace-jump-buffer)
;;(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
;; haskell reformatting stuff (region, entire buffer)
(global-set-key (kbd "M-;") 'hindent-reformat-region)
(global-set-key (kbd "M-:") 'haskell-mode-stylish-buffer)
;; set frame font when running emacs normally
(when (member "Iosevka" (font-family-list))
(set-frame-font "Iosevka-9" nil t)))
;; source:
;; renames the current buffer
(defun rename-file-and-buffer (new-name)
"Renames both current buffer and file it's visiting to NEW-NAME."
(interactive "sNew name: ")
(let ((name (buffer-name))
(filename (buffer-file-name)))
(if (not filename)
(message "Buffer '%s' is not visiting a file!" name)
(if (get-buffer new-name)
(message "A buffer named '%s' already exists!" new-name)
(rename-file filename new-name 1)
(rename-buffer new-name)
(set-visited-file-name new-name)
(set-buffer-modified-p nil))))))
;; terminal stuff
(global-set-key (kbd "C-c t") 'ansi-term)
;; ensime
(use-package ensime
:ensure t
:pin melpa-stable)
(use-package sbt-mode
:pin melpa-stable)
(use-package scala-mode
("scala" . scala-mode))
;; browse dirs
(use-package dirtree
:pin melpa-stable)
;; github stuff
;; set the variable so that ghub looks for credentials
;; in an encrypted file
(setq auth-sources '("~/.authinfo.gpg"))
(use-package magit
:ensure t
:pin melpa-stable)
(use-package magit-gitflow
:ensure t
:after magit
:pin melpa-stable)
(use-package magithub
:after magit
:ensure t
;; fixme this is a temporary hack; see
(define-error 'ghub-404 "Not Found" 'ghub-http-error)
:config (magithub-feature-autoinject t))
;; (require 'magithub)
;; (ghub-get "/user" nil :auth 'magithub)
;; gitflow
(require 'magit-gitflow)
(add-hook 'magit-mode-hook 'turn-on-magit-gitflow)
;; handle gists
(use-package yagist
:pin melpa-stable)
(use-package dired-subtree
:pin melpa-stable)
(use-package free-keys
:pin melpa)
(use-package dired-hacks-utils
:pin melpa)
(use-package dired-subtree
:pin melpa)
(use-package dired-sidebar
:bind (("M-]" . dired-sidebar-toggle-sidebar))
:pin melpa
:ensure t
:commands (dired-sidebar-toggle-sidebar)
(setq dired-sidebar-subtree-line-prefix " .")
((eq system-type 'gnu/linux)
(if (display-graphic-p)
(setq dired-sidebar-theme 'nerd)
(setq dired-sidebar-theme 'nerd))
(setq dired-sidebar-face '(:family "Fira Code" :height 12)))
((eq system-type 'windows-nt)
(setq dired-sidebar-theme 'nerd)
(setq dired-sidebar-face '(:family "Fira Code" :height 11)))
(setq dired-sidebar-theme 'nerd)
(setq dired-sidebar-face '(:family "Fira Code" :height 10))))
(setq dired-sidebar-use-term-integration t)
;;(setq dired-sidebar-use-custom-font t)
(use-package all-the-icons-dired
;; M-x all-the-icons-install-fonts
:ensure t
:commands (all-the-icons-dired-mode)))
;; irc client
(use-package erc
:pin melpa-stable)
(use-package smex
:pin melpa-stable)
(use-package haskell-mode
:pin melpa-stable)
(use-package ghc
:pin melpa-stable)
(use-package company
:pin gnu)
(use-package shm
:pin melpa-stable)
;; undo tree bit
(use-package undo-tree
:pin gnu)
(use-package which-key
:commands which-key-mode
:pin melpa)
(use-package codesearch
:pin melpa
(require 'codesearch)
(setq codesearch-global-csearchindex nil))
(use-package projectile-codesearch
:pin melpa
(require 'projectile-codesearch))
;; dimmer
(use-package dimmer
:pin melpa)
(setq dimmer-fraction 0.3)
(use-package prodigy
:pin melpa)
(use-package moe-theme
:pin melpa)
(use-package expand-region
:pin melpa)
(use-package projectile
:pin melpa)
(projectile-mode +1)
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(use-package flx-ido
:pin melpa)
(require 'flx-ido)
(use-package format-sql
:pin melpa)
(use-package lua-mode
:pin melpa-stable)
(ido-mode 1)
(ido-everywhere 1)
(flx-ido-mode 1)
;; disable ido faces to see flx highlights.
(setq ido-enable-flex-matching t)
(setq ido-use-faces nil)
(setq ensime-startup-notification nil)
;; (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.
;; '(default ((((class color) (min-colors 4096)) (:foreground "#5f5f5f" :background "#fdfde7")) (((class color) (min-colors 256)) (:foreground "#5f5f5f" :background "#fdfde7")) (((class color) (min-colors 89)) (:foreground "#5f5f5f" :background "#fdfde7")))))
(global-set-key (kbd "C-c C-k") 'kill-current-buffer)
;; (speedbar 1)
(remove-hook 'erc-text-matched-hook 'erc-global-notify)
;; (require 'sr-speedbar)
(load-theme 'moe-dark t)
;; ace-jump mode
"Emacs quick move minor mode"
;; you can select the key you prefer to
(define-key global-map (kbd "C-c SPC") 'ace-jump-mode)
;; enable a more powerful jump back function from ace jump mode
"Ace jump back:-)"
(eval-after-load "ace-jump-mode"
(define-key global-map (kbd "C-x SPC") 'ace-jump-mode-pop-mark)
(require 'dockerfile-mode)
(add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode))
(require 'nginx-mode)
;; RSS
(use-package elfeed
:pin melpa-stable)
(use-package autopair
:pin melpa-stable
:config (autopair-global-mode)
(global-set-key (kbd "C-x w") 'elfeed)
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(unless (require 'el-get nil 'noerror)
(goto-char (point-max))
(add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipes")
(el-get 'sync)
(use-package evil
:ensure t
:init (setq evil-want-integration nil)
:config (evil-mode)
(define-key evil-visual-state-map (kbd "C-u") 'evil-scroll-up)
(define-key evil-normal-state-map (kbd "C-u") 'evil-scroll-up)
(define-key evil-insert-state-map (kbd "C-u")
(lambda ()
(evil-delete (point-at-bol) (point))))
(evil-define-key 'normal intero-mode-map
"gd" 'intero-goto-definition)
(use-package evil-collection
:after evil
:ensure t
:config (evil-collection-init)
;; visual markers
(use-package evil-visual-mark-mode
:pin melpa
:after evil
:config (evil-visual-mark-mode)
;; nicer powerline
(require 'powerline)
(use-package powerline-evil
:pin melpa
:after evil
:config (require 'powerline-evil)
;; (use-package powerline-evil
;; :pin melpa)
;; (powerline-center-evil-theme)
(use-package evil-commentary
:ensure t
:after evil
:config (evil-commentary-mode)
(use-package evil-surround
:ensure t
:after evil
:config (global-evil-surround-mode 1)
(use-package evil-magit
:after evil
:config (require 'evil-magit)
(use-package frames-only-mode
:pin melpa
:after frames-only-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.