Skip to content

Instantly share code, notes, and snippets.

@avli
Last active August 29, 2015 14:07
Show Gist options
  • Save avli/d8ce797ace9f545f6501 to your computer and use it in GitHub Desktop.
Save avli/d8ce797ace9f545f6501 to your computer and use it in GitHub Desktop.
(setq inhibit-splash-screen t)
(setq default-directory "~")
;; I use cedet development branch, which install in
;; ~/.emacs.d/cedet. To install development branch do
;; (cd ~/.emacs.d && bzr checkout bzr://cedet.bzr.sourceforge.net/bzrroot/cedet/code/trunk cedet)
(let ((cedet-dir "~/.emacs.d/cedet"))
(if (file-directory-p cedet-dir)
(load-file "~/.emacs.d/cedet/cedet-devel-load.el")))
(setq default-input-method 'russian-computer)
(require 'package)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
(package-initialize)
(setq packages-exist (file-exists-p package-user-dir))
(unless packages-exist
(package-refresh-contents)
(dolist (package
'(magit
yasnippet
auto-complete
auto-complete-c-headers
color-theme-cobalt
jedi
autopair
auctex
evil
powerline
flycheck
tangotango-theme
twilight-theme
highlight-symbol
highlight-numbers
cmake-mode
yaml-mode
multi-term))
(package-install package)))
(setq scroll-step 1)
(setq scroll-conservatively 10000)
(set-default 'tab-width 4)
(add-hook 'text-mode 'visual-line-mode)
(color-theme-initialize)
(setq color-theme-name "cobalt")
(defun my-set-theme ()
(if (string= color-theme-name "cobalt")
(color-theme-cobalt)
(load-theme 'tangotango t)))
(defface font-lock-operator-face
`((((type tty) (class color))
(:background "blue" :foreground "white"))
(((type tty) (class mono))
(:inverse-video t))
(((class color) (background dark))
(:background "#09223F"))
(((class color) (background light))
(:background "lightblue"))
(t (:background "gray")))
"Basic face for highlighting the region."
:group 'basic-faces)
(defface font-lock-args-kwargs-face
`((((type tty) (class color))
(:background "blue" :foreground "white"))
(((type tty) (class mono))
(:inverse-video t))
(((class color) (background dark))
(:background "#09223F"))
(((class color) (background light))
(:background "lightblue"))
(t (:background "gray")))
"Basic face for highlighting the region."
:group 'basic-faces)
;; ;; You'll have a hard time missing these colors
(set-face-foreground 'font-lock-operator-face "red")
;(set-face-background 'font-lock-operator-face "blue")
(set-face-foreground 'font-lock-args-kwargs-face "DeepSkyBlue2")
(font-lock-add-keywords 'python-mode
'(("\\([~^&\|!<>=,.\\+*/%-]\\)" 1 'font-lock-operator-face)))
(font-lock-add-keywords 'python-mode
'(("\\(args\\|kwargs\\)" 1 'font-lock-args-kwargs-face)))
(if (display-graphic-p)
(progn
(set-face-attribute 'default nil :font "Monaco-12")
(set-fontset-font "fontset-default" 'cyrillic '("Monaco-12" . "ISO10646-1"))
(my-set-theme)
; (load-theme 'tangotango t)
; (color-theme-deep-blue)
)
)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(set-default 'cursor-type 'bar)
(defalias 'yes-or-no-p 'y-or-n-p)
(setq backup-inhibited t)
(setenv "PATH"
(concat (getenv "PATH")
":/usr/local/bin:/usr/texbin"))
(setq exec-path (setq exec-path
(append '("/usr/local/bin") '("/usr/texbin") exec-path)))
(setq ring-bell-function 'ignore)
;(tool-bar-mode 1)
(scroll-bar-mode 0)
(add-hook 'dired-mode-hook (lambda () (linum-mode 0)))
(add-hook 'inferior-python-mode-hook (lambda () (linum-mode 0)))
(add-hook 'magit-mode-hook (lambda () (linum-mode 0)))
(ido-mode 1)
(ido-everywhere 1)
;(powerline-default-theme)
(global-set-key (kbd "M-s h .") 'highlight-symbol-at-point)
(global-set-key (kbd "M-s h ,") 'highlight-indentation-mode)
(global-set-key (kbd "M-s h l") 'linum-mode)
(global-set-key (kbd "M-s h e") 'evil-mode)
(column-number-mode t)
(global-auto-revert-mode)
(add-hook 'text-mode-hook 'flyspell-mode)
(define-key global-map (kbd "RET") 'newline-and-indent)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(global-set-key (kbd "S-C-<left>") 'shrink-window-horizontally)
(global-set-key (kbd "S-C-<right>") 'enlarge-window-horizontally)
(global-set-key (kbd "S-C-<down>") 'shrink-window)
(global-set-key (kbd "S-C-<up>") 'enlarge-window)
(windmove-default-keybindings)
(require 'yasnippet)
(yas-global-mode 1)
(require 'auto-complete-config)
(ac-config-default)
(define-key ac-menu-map "\C-n" 'ac-next)
(define-key ac-menu-map "\C-p" 'ac-previous)
(setq ac-use-menu-map t)
(setq ac-stop-flymake-on-completing t)
(global-auto-complete-mode t)
(defun c-open-brace ()
(interactive)
(let ((electric-pair-mode nil))
(c-electric-brace nil)
(save-excursion (newline) (insert ?\}) (indent-according-to-mode))))
(defun my-c-mode-common-hook ()
(setq c-basic-offset 4)
(setq c-default-style "linux")
(local-set-key (kbd "{") 'c-open-brace)
(auto-complete-mode 0))
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
;; semantic magic
(defun my-ac-c-header-init ()
(require 'auto-complete-c-headers)
(add-to-list 'ac-sources 'ac-source-c-headers)
(add-to-list 'achead:include-directories '"/usr/include/c++/4.2.1"))
(add-hook 'c++-mode-hook 'my-ac-c-header-init)
(add-hook 'c-mode-hook 'my-ac-c-header-init)
(semantic-mode 1)
(require 'semantic/ia)
(defun my-c++-add-semantic-to-autocomplete ()
(add-to-list 'ac-sources 'ac-source-semantic))
;; Using semantic source makes emacs freeze sometimes,
;; probably it will be fixed one day. I've decided to
;; disable it for now.
;;(add-hook 'c++-mode-hook 'my-c++-add-semantic-to-autocomplete)
(defun my-c-add-semantic-to-autocomplete ()
(add-to-list 'ac-sources 'ac-source-semantic-raw))
(add-hook 'c-mode-hook 'my-c-add-semantic-to-autocomplete)
(semantic-add-system-include "/usr/include/c++/4.2.1" 'c++-mode)
(defun my-add-semantic-keybindings ()
(local-set-key [(control return)] 'semantic-ia-complete-symbol-menu)
(local-set-key "\C-c?" 'semantic-ia-complete-symbol)
(local-set-key "\C-c>" 'semantic-complete-analyze-inline)
(local-set-key "\C-c=" 'semantic-decoration-include-visit)
(local-set-key "\C-cj" 'semantic-ia-fast-jump)
(local-set-key "\C-cq" 'semantic-ia-show-doc)
(local-set-key "\C-cs" 'semantic-ia-show-summary)
(local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle))
(add-hook 'c-mode-common-hook 'my-add-semantic-keybindings)
;; end of the semantic related stuff
(defun my-prog-mode-hook ()
(visual-line-mode)
(flycheck-mode)
(autopair-mode)
(show-paren-mode)
(highlight-numbers-mode))
(add-hook 'prog-mode-hook 'my-prog-mode-hook)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(add-hook 'LaTeX-mode-hook 'visual-line-mode)
(add-hook 'LaTeX-mode-hook 'auto-complete-mode)
(add-hook 'LaTeX-mode-hook 'ac-flyspell-workaround)
(setq-default TeX-newline-function 'newline-and-indent)
(global-set-key (kbd "C-x m") 'multi-term-next)
(global-set-key (kbd "C-x M") 'multi-term)
(add-hook 'term-mode-hook
(lambda ()
(add-to-list 'term-bind-key-alist '("M-[" . multi-term-prev))
(add-to-list 'term-bind-key-alist '("M-]" . multi-term-next))
(add-to-list 'term-bind-key-alist '("C-c C-j" . term-line-mode))
(add-to-list 'term-bind-key-alist '("C-c C-k" . term-char-mode))
(add-to-list 'term-bind-key-alist '("C-c C-q" . term-pager-toggle))
(linum-mode 0)
(yas-minor-mode 0)))
(add-hook 'python-mode-hook (lambda ()
(setq jedi:server-args
'("--virtual-env" "/Users/andrey/.virtualenvs/evaluatemq"
"--virtual-env" "/Users/andrey/.virtualenvs/serverauditor"
"--virtual-env" "/Users/andrey/.virtualenvs/amplefind"))
(setq-local ac-auto-start nil)
(local-set-key (kbd "C-x C-o") 'jedi:complete)))
(add-hook 'python-mode-hook 'jedi:setup)
(add-hook 'python-mode-hook (lambda () (setq jedi:complete-on-dot t)))
(add-hook 'python-mode-hook (lambda () (setq jedi:tooltip-method nil)))
(add-hook 'python-mode-hook 'visual-line-mode)
(add-hook 'python-mode-hook (lambda () (semantic-mode 0)))
(ac-flyspell-workaround)
(setq load-path (cons "/usr/local/lib/erlang/lib/tools-2.7/emacs"
load-path))
(setq erlang-root-dir "/usr/local")
(setq exec-path (cons "/usr/local/bin" exec-path))
(require 'erlang-start)
(add-hook 'erlang-mode-hook 'linum-mode)
(add-hook 'erlang-mode-hook (lambda () (add-to-list 'ac-sources 'ac-source-yasnippet)))
(add-to-list 'ac-modes 'erlang-mode)
(add-hook 'cider-repl-mode-hook (lambda () (linum-mode 0)))
(setq inferior-lisp-program "/usr/local/bin/sbcl")
(setq slime-contribs '(slime-fancy))
;(server-start)
(if (string= color-theme-name "cobalt")
(custom-set-faces
'(cursor ((t (:background "white"))))
'(font-lock-comment-face ((t (:foreground "#008AFF" :slant italic))))
'(font-lock-function-name-face ((t (:foreground "#FFDD00" :weight bold))))
'(font-lock-type-face ((t (:foreground "#FFEF79" :weight bold))))
'(fringe ((t (:background "#111111"))))
'(linum ((t (:background "#111111" :foreground "#888888" :underline nil :slant normal))))
'(show-paren-match ((t (:underline "yellow"))))
'(vertical-border ((((type x ns tty)) (:background "#111111" :foreground "#111111"))))))
(if (string= color-theme-name "tangotango")
(custom-set-faces
'(linum ((t (:inherit (shadow default) :background "grey10"))))
'(magit-item-highlight ((t (:inherit secondary-selection :inverse-video nil :weight extra-bold))) t)
'(vertical-border ((((type x ns tty)) (:inherit mode-line-inactive :foreground "grey10"))))))
(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-safe-themes (quote ("6d78a562789b1c1e58d2fd7dcadbc1c88012584ec678f85817a451d4d7b370f0" "5d9351cd410bff7119978f8e69e4315fd1339aa7b3af6d398c5ca6fac7fd53c7" "e24180589c0267df991cf54bf1a795c07d00b24169206106624bb844292807b9" "758da0cfc4ecb8447acb866fb3988f4a41cf2b8f9ca28de9b21d9a68ae61b181" default))))
(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.
'(cursor ((t (:background "white"))))
'(font-lock-comment-face ((t (:foreground "#008AFF" :slant italic))))
'(font-lock-function-name-face ((t (:foreground "#FFDD00" :weight bold))))
'(font-lock-type-face ((t (:foreground "#FFEF79" :weight bold))))
'(fringe ((t (:background "#111111"))))
'(linum ((t (:background "#111111" :foreground "#888888" :underline nil :slant normal))))
'(region ((t (:background "brown"))))
'(show-paren-match ((t (:underline "yellow"))))
'(vertical-border ((((type x ns tty)) (:background "#111111" :foreground "#111111")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment