Skip to content

Instantly share code, notes, and snippets.

@2016rshah
Last active November 2, 2017 20:38
Show Gist options
  • Save 2016rshah/dd1ba708a85f23afc20eb90d73504ff7 to your computer and use it in GitHub Desktop.
Save 2016rshah/dd1ba708a85f23afc20eb90d73504ff7 to your computer and use it in GitHub Desktop.
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
(package-initialize)
;; Stuff for Haskell
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
(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.
'(haskell-process-auto-import-loaded-modules t)
'(haskell-process-log t)
'(haskell-process-suggest-remove-import-lines t)
'(haskell-process-type (quote stack-ghci))
'(safe-local-variable-values
(quote
((haskell-process-args-ghci "ghci")
(haskell-process-path-ghci . "stack")
(haskell-process-type . ghci)))))
(eval-after-load 'haskell-mode '(progn
(define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-or-reload)
(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)
(define-key haskell-mode-map (kbd "SPC") 'haskell-mode-contextual-space)))
(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)))
(global-set-key (kbd "C-c /") 'comment-or-uncomment-region)
(setq latex-run-command "pdflatex")
(setq column-number-mode t)
(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.
)
;; ---------Stuff for C-----------
;; Scrolls to the bottom of the compilation if no errors and to the first error if broken
(setq compilation-scroll-output 'first-error)
;; Compile command to clean and run tests
(setq compile-command "make clean test")
;; Compile with C-c C-l
(add-hook 'c-mode-common-hook
(lambda () (define-key c-mode-base-map (kbd "C-c C-l") 'compile)))
;; Automatically pair parens/brackets/etc.
(add-hook 'c-mode-common-hook 'electric-pair-mode)
;; ----------Stuff for Verilog------
(add-to-list 'auto-mode-alist '("\\.v\\'" . verilog-mode))
(defun my-verilog-hook ()
(setq verilog-indent-level 4)
(setq verilog-indent-level-behavioral 4)
(setq verilog-indent-level-declaration 4)
(setq verilog-indent-level-module 4)
(setq verilog-cexp-indent 4)
(setq verilog-case-indent 4))
(add-hook 'verilog-mode-hook 'my-verilog-hook)
;; ----------- Emacs stuff ----------
(global-set-key (kbd "M-h") 'windmove-left) ; move to left window
(global-set-key (kbd "M-l") 'windmove-right) ; move to right window
(global-set-key (kbd "M-k") 'windmove-up) ; move to upper window
(global-set-key (kbd "M-j") 'windmove-down) ; move to lower window
(global-set-key (kbd "C-c r") (lambda ()
(interactive)
(revert-buffer t t t)
(message "buffer is reverted")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment