Skip to content

Instantly share code, notes, and snippets.

@Kova93
Last active January 14, 2020 09:42
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 Kova93/abb48cd394ce94bb1da7cbfcc1b3014e to your computer and use it in GitHub Desktop.
Save Kova93/abb48cd394ce94bb1da7cbfcc1b3014e to your computer and use it in GitHub Desktop.
emacs init
;; auto-generated
;;
(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
("0598c6a29e13e7112cfbc2f523e31927ab7dce56ebb2016b567e1eff6dc1fd4f" default)))
'(package-selected-packages
(quote
(spotify solarized-theme adoc-mode flycheck-pos-tip flycheck-color-mode-line flycheck-irony flycheck company-statistics company-quickhelp company-flx company-irony-c-headers company-irony company-c-headers company use-package))))
(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.
)
;; 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)
;; use-package
;;
(eval-when-compile
(require 'use-package))
;; company-mode
;;
(use-package company
:ensure t
:bind
([C-tab] . company-complete)
:init
(global-company-mode)
:config
; (add-to-list 'company-backends 'company-rtag)
(add-to-list 'company-backends 'company-irony)
(add-to-list 'company-backends '(company-irony-c-headers company-irony))
(company-flx-mode +1)
(company-quickhelp-mode)
(company-statistics-mode)
:after
(company-irony company-irony-c-headers company-c-headers company-flx company-quickhelp company-statistics))
(use-package company-c-headers
:ensure t)
(use-package company-irony
:ensure t)
(use-package company-irony-c-headers
:ensure t)
(use-package company-flx
:ensure t)
(use-package company-quickhelp
:ensure t)
(use-package company-statistics
:ensure t)
;; flycheck
;;
(use-package flycheck
:ensure t
:init
(global-flycheck-mode)
:config
(flycheck-irony-setup)
(flycheck-pos-tip-mode)
:hook
(flycheck-mode . flycheck-color-mode-line-mode)
:after
(flycheck-color-mode-line flycheck-irony flycheck-pos-tip))
(use-package flycheck-irony
:ensure t)
(use-package flycheck-color-mode-line
:ensure t)
(use-package flycheck-pos-tip
:ensure t)
;; google-c-style
;;
;; (use-package google-c-style
;; :ensure t
;; :hook
;; (((c++-mode c-mode objc-mode) . google-set-c-style)
;; ((c++-mode c-mode objc-mode) . google-make-newline-indent)))
;; irony-mode
;;
(use-package irony
:ensure t
:bind
("s-i" . irony-get-type)
:hook
(((c++-mode c-mode objc-mode) . irony-mode)
(irony-mode . irony-cdb-autosetup-compile-options)))
;; adoc-mode
;;
(use-package adoc-mode
:ensure t)
;; raml-mode
;;
(use-package raml-mode
:load-path "raml-mode/")
;; formatting
;;
(defun format-on-save ()
(untabify (point-min) (point-max))
(delete-trailing-whitespace))
(setq c-default-style "linux"
c-basic-offset 4)
(c-set-offset 'innamespace 0)
(c-set-offset 'inline-open 0)
(defun setup-c++-style ()
(setq show-trailing-whitespace t)
(setq indent-tabs-mode nil)
(add-hook 'before-save-hook 'format-on-save nil t)
(column-number-mode))
(add-hook 'c++-mode-hook 'setup-c++-style)
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
(setq python-indent-offset 4)
(defun setup-python-style ()
(setq show-trailing-whitespace t)
(setq indent-tabs-mode nil)
(add-hook 'before-save-hook 'format-on-save nil t)
(column-number-mode))
(add-hook 'python-mode-hook 'setup-python-style)
(setq read-buffer-completion-ignore-case t
read-file-name-completion-ignore-case t)
;; lambda indent
;;
;; (defun vr-c++-looking-at-lambda_as_param ()
;; "Return t if text after point matches '[...](' or '[...]{'"
;; (looking-at ".*[,(][ \t]*\\[[^]]*\\][ \t]*[({][^}]*?[ \t]*[({][^}]*?$"))
;; (defun vr-c++-looking-at-lambda_in_uniform_init ()
;; "Return t if text after point matches '{[...](' or '{[...]{'"
;; (looking-at ".*{[ \t]*\\[[^]]*\\][ \t]*[({][^}]*?[ \t]*[({][^}]*?$"))
;; (defun vr-c++-indentation-examine (langelem looking-at-p)
;; (and (equal major-mode 'c++-mode)
;; (ignore-errors
;; (save-excursion
;; (goto-char (c-langelem-pos langelem))
;; (funcall looking-at-p)))))
;; (defun vr-c++-indentation-setup ()
;; (require 'google-c-style)
;; (google-set-c-style)
;; (c-set-offset
;; 'block-close
;; (lambda (langelem)
;; (if (vr-c++-indentation-examine
;; langelem
;; #'vr-c++-looking-at-lambda_in_uniform_init)
;; '-
;; 0)))
;; (c-set-offset
;; 'statement-block-intro
;; (lambda (langelem)
;; (if (vr-c++-indentation-examine
;; langelem
;; #'vr-c++-looking-at-lambda_in_uniform_init)
;; 0
;; '+)))
;; (defadvice c-lineup-arglist (around my activate)
;; "Improve indentation of continued C++11 lambda function opened as argument."
;; (setq ad-return-value
;; (if (vr-c++-indentation-examine
;; langelem
;; #'vr-c++-looking-at-lambda_as_param)
;; 0
;; ad-do-it))))
;; theme
;;
(use-package solarized-theme
:ensure t
:load-path "themes"
:init
;; make the fringe stand out from the background
(setq solarized-distinct-fringe-background t)
;; Don't change the font for some headings and titles
(setq solarized-use-variable-pitch nil)
;; make the modeline high contrast
(setq solarized-high-contrast-mode-line t)
;; Use less bolding
(setq solarized-use-less-bold t)
;; Use more italics
(setq solarized-use-more-italic t)
;; Use less colors for indicators such as git:gutter, flycheck and similar
(setq solarized-emphasize-indicators t)
;; Don't change size of org-mode headlines (but keep other size-changes)
(setq solarized-scale-org-headlines nil)
;; Avoid all font-size changes
(setq solarized-height-minus-1 1.0)
(setq solarized-height-plus-1 1.0)
(setq solarized-height-plus-2 1.0)
(setq solarized-height-plus-3 1.0)
(setq solarized-height-plus-4 1.0)
:config
(load-theme 'solarized-dark))
;; spotify
;;
(use-package spotify
:ensure t
:bind
(([s-pause] . spotify-playpause)
([s-M-pause] . spotify-next)
([s-S-pause] . spotify-previous)
([s-C-pause] . spotify-current))
:init
(spotify-enable-song-notifications))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment