Created
May 20, 2016 18:13
-
-
Save momchil-velikov/bef868ec545f217cb57a6f91684be107 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'package) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.org/packages/") t) | |
(package-initialize) | |
(require 'ido) | |
(ido-mode) | |
(require 'cc-mode) | |
(require 'clang-format) | |
(define-key c-mode-map [(control meta f)] 'clang-format-buffer) | |
(define-key c++-mode-map [(control meta f)] 'clang-format-buffer) | |
(defun clang-format-before-save() | |
(if (eq major-mode 'c++-mode) | |
(clang-format-buffer)) | |
) | |
(add-hook 'before-save-hook 'clang-format-before-save) | |
(require 'auto-complete-config) | |
(ac-config-default) | |
(require 'auto-complete-clang) | |
(define-key c++-mode-map [(super return)] 'ac-complete-clang) | |
(define-key c++-mode-map [(meta return)] 'ac-complete-clang) | |
;;(define-key c++-mode-map (kbd "m-<return>") 'ac-complete-clang) | |
(require 'flycheck) | |
(add-hook 'after-init-hook 'global-flycheck-mode) | |
(add-hook 'c++-mode-hook (lambda () (setq flycheck-clang-language-standard "c++14"))) | |
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup) | |
(require 'go-mode) | |
(require 'go-autocomplete) | |
(add-hook 'before-save-hook 'gofmt-before-save) | |
(require 'autopair) | |
(autopair-global-mode) | |
(c-add-style "velco" | |
'( "cc-mode" | |
(c-basic-offset . 4) | |
(c-comment-only-line-offset . 0) | |
(c-offsets-alist . | |
( (substatement-open . 0 ) | |
(label . 0 ) | |
(case-label . + ) | |
(comment-intro . -3) | |
(statement-cont . 0) | |
(statement-case-intro . 5 ) | |
(statement-case-open . 5) | |
(arglist-close . 0) | |
(inline-open . 0) | |
) | |
) | |
) | |
) | |
(c-add-style "java" | |
'( "cc-mode" | |
(c-basic-offset . 4) | |
(c-comment-only-line-offset . 0) | |
(c-offsets-alist . | |
( (substatement-open . 0 ) | |
(label . 0 ) | |
(case-label . + ) | |
(comment-intro . -3) | |
(statement-cont . 0) | |
(statement-case-intro . 5 ) | |
(statement-case-open . 5) | |
(arglist-close . 0) | |
(inline-open . 0) | |
) | |
) | |
) | |
) | |
(c-add-style "webkit" | |
'( "cc-mode" | |
(c-basic-offset . 4) | |
) | |
) | |
;;(require 'google-c-style) | |
;;(c-add-style "google" google-c-style) | |
;; (c-add-style "google" | |
;; '( "cc-mode" | |
;; (c-basic-offset . 2) | |
;; (c-offsets-alist . | |
;; ( (arglist-intro . +) | |
;; ) | |
;; ) | |
;; ) | |
;; ) | |
(global-set-key [f7] 'compile) | |
(global-set-key [f10] 'undo) | |
(global-set-key [f12] 'query-replace) | |
(global-set-key [(control f12)] 'query-replace-regexp) | |
(global-set-key [apps] 'execute-extended-command) | |
(global-set-key [(meta p)] 'fill-paragraph) | |
(global-set-key [delete] 'delete-char) | |
(global-set-key [(meta j)] 'join-line) | |
(global-set-key [(meta down)] 'cua-scroll-up) | |
(global-set-key [(meta up)] 'cua-scroll-down) | |
;; (global-set-key [(meta left)] 'beginning-of-line) | |
;; (global-set-key [(meta right)] 'end-of-line) | |
(global-set-key [(super down)] 'cua-scroll-up) | |
(global-set-key [(super up)] 'cua-scroll-down) | |
(global-set-key [(super left)] 'beginning-of-line) | |
(global-set-key [(super right)] 'end-of-line) | |
(global-set-key [(control /)] 'comment-or-uncomment-region) | |
(setq mouse-wheel-scroll-amount '(1 ((shift) . 4) ((control) . nil))) | |
(setq mouse-wheel-progressive-speed nil) | |
; Literal tab insert | |
;(defun tab-insert () | |
; "Interactive insert tab" | |
; (interactive) (insert-tab)) | |
; | |
;(global-set-key [(control tab)] 'tab-insert) | |
;; Kill all buffers | |
(defun kill-buffers (list) | |
(cond | |
((null list) nil) | |
(t (kill-buffer (car list)) (kill-buffers (cdr list))))) | |
(defun kill-all-buffers () | |
(interactive) | |
(kill-buffers (buffer-list))) | |
(global-set-key [(control x) (a) (k)] 'kill-all-buffers) | |
(defun search-word-forward () | |
(interactive) | |
(let* ((begin (+ 1 (re-search-backward "[^a-zA-Z]"))) | |
(end (re-search-forward "[a-zA-Z]+")) | |
(pos (re-search-forward | |
(concat "[^a-zA-Z]" | |
(buffer-substring-no-properties begin end) | |
"[^a-zA-Z]")))) | |
(goto-char (- pos 1)))) | |
(defun search-word-backward () | |
(interactive) | |
(let* ((begin (+ 1 (re-search-backward "[^a-zA-Z]"))) | |
(end (re-search-forward "[a-zA-Z]+")) | |
(pos (re-search-backward | |
(concat "[^a-zA-Z]" | |
(buffer-substring-no-properties begin end) | |
"[^a-zA-Z]")))) | |
(goto-char (+ pos 1)))) | |
(global-set-key [(kp-multiply)] 'search-word-forward) | |
(global-set-key [(meta kp-multiply)] 'search-word-backward) | |
(defun move-text-internal (arg) | |
(cond | |
((and mark-active transient-mark-mode) | |
(if (> (point) (mark)) | |
(exchange-point-and-mark)) | |
(let ((column (current-column)) | |
(text (delete-and-extract-region (point) (mark)))) | |
(forward-line arg) | |
(move-to-column column t) | |
(set-mark (point)) | |
(insert text) | |
(exchange-point-and-mark) | |
(setq deactivate-mark nil))) | |
(t | |
(beginning-of-line) | |
(when (or (> arg 0) (not (bobp))) | |
(forward-line) | |
(when (or (< arg 0) (not (eobp))) | |
(transpose-lines arg)) | |
(forward-line -1))))) | |
(defun move-text-down (arg) | |
"Move region (transient-mark-mode active) or current line | |
arg lines down." | |
(interactive "*p") | |
(move-text-internal arg)) | |
(defun move-text-up (arg) | |
"Move region (transient-mark-mode active) or current line | |
arg lines up." | |
(interactive "*p") | |
(move-text-internal (- arg))) | |
(global-set-key [(meta shift up)] 'move-text-up) | |
(global-set-key [(meta shift down)] 'move-text-down) | |
(defun my-set-frame-width (arg) | |
(interactive "n") | |
(set-frame-width (window-frame (get-buffer-window)) arg)) | |
(global-set-key [(control meta W)] 'my-set-frame-width) | |
(setq ring-bell-function 'ignore) | |
(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. | |
'(ac-clang-executable "~/opt/clang-master/bin/clang") | |
'(clang-format-executable "~/opt/clang-master/bin/clang-format") | |
'(cua-mode t nil (cua-base)) | |
'(current-language-environment "UTF-8") | |
'(default-frame-alist (quote ((vertical-scroll-bars) (width . 90) (height . 50)))) | |
'(diff-switches "-udp") | |
'(erc-server-auto-reconnect nil) | |
'(fill-column 80) | |
'(flycheck-c/c++-clang-executable "~/opt/clang-master/bin/clang") | |
'(flycheck-go-golint-executable "true") | |
'(global-auto-complete-mode t) | |
'(global-font-lock-mode t nil (font-lock)) | |
'(gofmt-command "goimports") | |
'(grep-find-command | |
"find . -name .git -prune -o -type f -print0 | xargs -0 -e grep -nH -e ") | |
'(ido-default-buffer-method (quote selected-window)) | |
'(ido-default-file-method (quote selected-window)) | |
'(ido-everywhere t) | |
'(indent-tabs-mode nil) | |
'(inhibit-startup-screen t) | |
'(magit-emacsclient-executable "~/bin/emacsclient") | |
'(mouse-avoidance-mode (quote animate) nil (avoid)) | |
'(scroll-bar-mode nil) | |
'(tab-width 8) | |
'(tool-bar-mode nil nil (tool-bar)) | |
'(undo-ask-before-discard t) | |
'(user-mail-address "momchil.velikov@gmail.com")) | |
(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 "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 105 :width normal :foundry "unknown" :family "DejaVu Sans Mono")))) | |
'(isearch ((((class color) (background light)) (:background "gray" :foreground "black"))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment