Skip to content

Instantly share code, notes, and snippets.

@gnzlbg
Created May 12, 2015 10:37
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 gnzlbg/c97742bb08cb6568b8bd to your computer and use it in GitHub Desktop.
Save gnzlbg/c97742bb08cb6568b8bd to your computer and use it in GitHub Desktop.
clang-format layer
;;; packages.el --- clang-format Layer packages File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;; List of all packages to install and/or initialize. Built-in packages
;; which require an initialization must be listed explicitly in the list.
(defvar clang-format-packages
'(
clang-format
))
;; List of packages to exclude.
(defvar clang-format-excluded-packages '())
;; For each package, define a function clang-format/init-<package-clang-format>
;;
(defun clang-format/init-package-clang-format ()
"Initialize clang-format"
(use-package clang-format)
)
;;
;; Often the body of an initialize function uses `use-package'
;; For more info on `use-package', see readme:
;; https://github.com/jwiegley/use-package
;;; extensions.el --- clang-format Layer extensions File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(setq clang-format-pre-extensions
'(
;; pre extension clang-formats go here
))
(setq clang-format-post-extensions
'(
;; post extension clang-formats go here
))
;; For each extension, define a function clang-format/init-<extension-clang-format>
;;
;; (defun clang-format/init-my-extension ()
;; "Initialize my extension"
;; )
;;
;; Often the body of an initialize function uses `use-package'
;; For more info on `use-package', see readme:
;; https://github.com/jwiegley/use-package
;;; IN .spacemacs:
(defun dotspacemacs/config ()
"Configuration function.
This function is called at the very end of Spacemacs initialization after
layers configuration."
;; clang-format:
(global-set-key [C-M-tab] 'clang-format-region)
(add-hook 'c++-mode-hook 'clang-format-bindings)
(defun clang-format-bindings ()
(define-key c++-mode-map [tab] 'clang-format-region))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment