Browse Source

Some C++ stuff

master
Taylor Bockman 6 years ago
parent
commit
00625b5b5b
  1. 38
      dotfiles/emacs.d/init.el

38
dotfiles/emacs.d/init.el

@ -192,24 +192,9 @@
;; Add new line if using C-n navigates to the end of the buffer
(setq next-line-add-newlines t)
;;--------------------------------------------------------------------------------------
;; Fill column indicator (currently set to 120 characters)
;;--------------------------------------------------------------------------------------
(require 'fill-column-indicator)
(setq fci-rule-color "red")
(setq fci-rule-column 120)
(setq fci-rule-width 1)
(setq fci-rule-character ?\u2503) ; Solid line unicode character
;; A hack to work around FCI wanting to put itself everywhere
(define-globalized-minor-mode global-fci-mode fci-mode
(lambda ()
(unless buffer-read-only
(fci-mode t))))
(global-fci-mode t)
(require 'whitespace)
(setq whitespace-style '(face lines-tail))
(add-hook 'prog-mode-hook 'whitespace-mode)
;;--------------------------------------------------------------------------------------
;; If python.el is loaded, change the rule column to 80 characters.
@ -217,7 +202,7 @@
(eval-after-load "python"
'(progn
(setq fci-rule-column 80)))
(setq whitespace-line-column 80)))
;;--------------------------------------------------------------------------------------
;; Expand region settings
@ -344,19 +329,32 @@
;; Keep character limit to 80
(eval-after-load "c-mode"
'(progn
(setq fci-rule-column 80)))
(setq whitespace-line-column 80)))
(eval-after-load "c++-mode"
'(progn
(setq whitespace-line-column 80)))
(setq-default c-basic-offset 4) ;; NASA Style Guide says 4 spaces is optimal
(setq-default c++-basic-offset 4) ;;
(setq-default c-default-style "linux") ;; Use Linux code style
(setq-default c++-default-style "linux") ;;
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'c++-mode-hook 'irony-mode)
;; Backend for Company
(defun my-c-mode-hook ()
(eval-after-load 'company
'(add-to-list 'company-backends 'company-irony)))
(defun my-c++-mode-hook ()
(eval-after-load 'company
'(add-to-list 'company-backends 'company-irony)))
(add-hook 'c-mode-hook 'my-c-mode-hook)
(add-hook 'c++-mode-hook 'my-c++-mode-hook)
;; I use meson mostly for C/C++ development so this hook lives here
(add-hook 'meson-mode-hook 'company-mode)

Loading…
Cancel
Save