======Emacs====== =====Set up custom lisp path===== (add-to-list 'load-path "~/.emacs.d/lisp/") =====Show trailing whitespace===== Show trailing whitespace as red blocks: (custom-set-variables '(show-trailing-whitespace t) ) =====Use Allman/BSD style===== Make curly braces placement as described by [[https://en.wikipedia.org/wiki/Indent_style#Allman_style|Allman from the BSD project]]: (setq c-default-style "bsd" c-basic-offset 4) =====Use SmartTabs===== Use [[http://www.emacswiki.org/emacs/SmartTabs|"SmartTabs"]], ie. tabs for indentation and spaces for alignment. Create the folder ~/.emacs.d/lisp and download [[https://raw.githubusercontent.com/jcsalomon/smarttabs/master/smart-tabs-mode.el|smart-tabs-mode.el]] and [[https://elpa.gnu.org/packages/cl-lib.html|cl-lib]] into it. Add the following lines to the ''.emacs'' file: (require 'smart-tabs-mode) (autoload 'smart-tabs-mode "Intelligently indent with tabs, align with spaces!") (autoload 'smart-tabs-mode-enable "smart-tabs-mode") (autoload 'smart-tabs-advice "smart-tabs-mode") (autoload 'smart-tabs-insinuate "smart-tabs-mode") (smart-tabs-insinuate 'c 'c++ 'java 'javascript 'cperl 'ruby 'nxml) =====Switch between cc/h files===== Switch between the header and implementation using Alt-o. Download [[http://www.emacswiki.org/emacs/SwitchFile|SwitchFile.el]] to the ~/emacs.d/lisp folder. (require 'switch-file) (global-set-key (kbd "M-o") 'switch-cc-to-h) =====Show whitespace===== Download [[http://emacswiki.org/emacs/WhiteSpace|whitespace.el]] into the ~/.emacs.d/lisp folder. Use it whenever in c++ mode: (require 'whitespace) (add-hook 'c++-mode-hook 'whitespace-mode) Use sane colors: (set-face-attribute 'whitespace-space nil :background nil :foreground "LightCyan2") (set-face-attribute 'whitespace-space-after-tab nil :background nil :foreground "LightCyan2") (set-face-attribute 'whitespace-tab nil :background nil :foreground "LightCyan2") (set-face-attribute 'whitespace-line nil :foreground nil :background nil :weight 'bold) Disable newlines and wierd rendering of long lines: (custom-set-variables '(whitespace-style (quote (face tabs spaces trailing space-before-tab indentation empty space-after-tab space-mark tab-mark)) )