Skip to content

Instantly share code, notes, and snippets.

@giupo
Created March 19, 2018 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giupo/c79d2c05e5ad9ace837bae80b643a5fe to your computer and use it in GitHub Desktop.
Save giupo/c79d2c05e5ad9ace837bae80b643a5fe to your computer and use it in GitHub Desktop.
Emacs config
;; 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.
(package-initialize)
(server-start)
(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))
(setq exec-path (append exec-path '("/usr/local/bin")))
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
(require 'ido)
(ido-mode t)
;; color compilation buffer
(require 'ansi-color)
(defun colorize-compilation-buffer ()
(toggle-read-only)
(ansi-color-apply-on-region compilation-filter-start (point))
(toggle-read-only))
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer)
(elpy-enable)
(setq elpy-rpc-python-command "/usr/local/bin/python")
;; dash at point
(add-to-list 'load-path "/Users/giupo/projects/dash-at-point")
(autoload 'dash-at-point "dash-at-point"
"Search the word at point with Dash." t nil)
(global-set-key "\C-cs" 'dash-at-point)
(global-set-key "\C-ce" 'dash-at-point-with-docset)
;;(add-to-list 'dash-at-point-mode-alist '(c++-mode . "SDL"))
(global-set-key (kbd "<f5>") 'recompile)
(global-set-key (kbd "<f7>") 'compile)
;; jedi
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t) ; optional
(defalias 'yes-or-no-p 'y-or-n-p)
(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 ((t (:inherit nil :stipple nil :background "#2e3434" :foreground "#eeeeec" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 160 :width normal :foundry "nil" :family "Inconsolata")))))
(setq inhibit-splash-screen t) ; hide welcome screen
(require 'projectile)
(projectile-global-mode)
(global-set-key (kbd "<f8>") 'ibuffer)
;; load solarized color theme
(add-to-list 'load-path "~/.emacs.d/emacs-color-theme-solarized-master/")
;; (require 'color-theme)
;; (require 'color-theme-solarized)
;; (color-theme-initialize)
;; set dark theme
;; (color-theme-solarized-dark)
;; set light theme
;; (color-theme-solarized-light)
(require 'powerline)
(powerline-default-theme)
;; this fixes powerline rendering
(setq ns-use-srgb-colorspace nil)
(setq powerline-default-separator 'wave)
(require 'doxymacs)
(add-hook 'c-mode-common-hook 'doxymacs-mode)
(defun my-doxymacs-font-lock-hook ()
(if (or (eq major-mode 'c-mode) (eq major-mode 'c++-mode))
(doxymacs-font-lock)))
(add-hook 'font-lock-mode-hook 'my-doxymacs-font-lock-hook)
(add-hook 'c-mode-common-hook
(lambda()
(local-set-key (kbd "C-c o") 'ff-find-other-file)))
(defvar my-cpp-other-file-alist '(("\\.cpp\\'" (".h")) ("\\.h\\'" (".cpp"))))
(setq-default ff-other-file-alist 'my-cpp-other-file-alist)
(setq ff-search-directories
'("." "../src" "../include"))
(defun my-backup-file-name (fpath)
"Return a new file path of a given file path.
If the new path's directories does not exist, create them."
(let* (
(backupRootDir "~/.emacs.d/emacs-backup/")
(filePath (replace-regexp-in-string "[A-Za-z]:" "" fpath )) ; remove Windows driver letter in path, for example, “C:”
(backupFilePath (replace-regexp-in-string "//" "/" (concat backupRootDir filePath "~") ))
)
(make-directory (file-name-directory backupFilePath) (file-name-directory backupFilePath))
backupFilePath
)
)
(setq make-backup-file-name-function 'my-backup-file-name)
;; Add cmake listfile names to the mode list.
(setq auto-mode-alist
(append
'(("CMakeLists\\.txt\\'" . cmake-mode))
'(("\\.cmake\\'" . cmake-mode))
auto-mode-alist))
(add-to-list 'load-path "~/.emacs.d/dockerfile-mode/")
(require 'dockerfile-mode)
(add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode))
(add-to-list 'load-path "~/.emacs.d/multi-compile")
(require 'multi-compile)
(global-set-key (kbd "<f5>") (multi-compile build))
(global-set-key (kbd "<f6>") (multi-compile test :command "make test"))
(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 (tangotango)))
'(custom-safe-themes
(quote
("4e63466756c7dbd78b49ce86f5f0954b92bf70b30c01c494b37c586639fa3f6f" default)))
'(package-selected-packages
(quote
(feature-mode mocha rjsx-mode tangotango-theme rtags projectile powerline nyan-mode neotree magit-gitflow jedi irony-eldoc hydra ess-smart-underscore elpy company-irony cmake-mode cmake-ide ac-js2))))
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'objc-mode-hook 'irony-mode)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
(require 'rtags) ;; optional, must have rtags installed
(require 'subr-x)
(cmake-ide-setup)
(setq js-indent-level 2)
(add-to-list 'auto-mode-alist '("components\\/.*\\.js\\'" . rjsx-mode))
(require 'yaml-mode)
(add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))
(defadvice ansi-term (after advise-ansi-term-coding-system)
(set-buffer-process-coding-system 'utf-8-unix 'utf-8-unix))
(ad-activate 'ansi-term)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment