Skip to content

Instantly share code, notes, and snippets.

@richcole
Created July 5, 2019 17:53
Show Gist options
  • Save richcole/21b991fd0a376270d06d66567d46ac10 to your computer and use it in GitHub Desktop.
Save richcole/21b991fd0a376270d06d66567d46ac10 to your computer and use it in GitHub Desktop.
Dot Emacs
(menu-bar-mode 0)
(tool-bar-mode 0)
(set-background-color "darkslategray")
(set-foreground-color "wheat")
;;
;; Default Settings
;;
(setq make-backup-files nil)
;;
;; Key Mappings
;;
(global-set-key "\C-cm" 'compile)
(global-set-key "\C-cg" 'goto-line)
(global-set-key "\C-c\C-g" 'grep)
(global-set-key "\C-cr" 'replace-string)
(global-set-key (kbd "<f1>") 'flycheck-next-error)
(global-set-key (kbd "<f2>") 'flycheck-previous-error)
(global-set-key (kbd "<f3>") 'compile)
(global-set-key (kbd "M-<left>") 'xref-pop-marker-stack)
;;
;; Add MELPA
;;
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(when no-ssl
(warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
(defun rj-install-packages ()
(interactive)
(package-refresh-contents)
(dolist (package (list 'company 'irony 'company-irony 'flycheck-irony 'company-irony-c-headers 'ggtags))
(package-install package))
(concat "sudo apt-get install bear cmake libclang-4.0-dev exuberant-ctags python-pygments global")
(call-interactively 'irony-install-server))
;;
;; Configure Irony
;;
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'objc-mode-hook 'irony-mode)
(dolist
(action
(list 'irony-cdb-autosetup-compile-options 'flycheck-mode 'ggtags-mode 'company-mode))
(add-hook 'irony-mode-hook action))
(eval-after-load 'company
'(add-to-list 'company-backends 'company-irony))
;;
;; Customization Variables
;;
(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.
'(inhibit-startup-screen t)
'(package-selected-packages
(quote
(ggtags flycheck-irony company-irony-c-headers company-irony))))
(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.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment