User Tools

Site Tools


emacs:emacs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
emacs:emacs [2015/09/12 18:55]
deva [Switch between cc/h files]
emacs:emacs [2015/09/12 20:24] (current)
deva [Show whitespace]
Line 1: Line 1:
 ======Emacs====== ======Emacs======
 +
 +=====Set up custom lisp path=====
 +<code lisp>
 +(add-to-list 'load-path "~/.emacs.d/lisp/")
 +</code>
  
 =====Show trailing whitespace===== =====Show trailing whitespace=====
Line 5: Line 10:
 <code lisp> <code lisp>
 (custom-set-variables (custom-set-variables
- '(show-trailing-whitespace t))+ '(show-trailing-whitespace t) 
 +)
 </code> </code>
  
Line 21: Line 27:
 Add the following lines to the ''.emacs'' file: Add the following lines to the ''.emacs'' file:
 <code lisp> <code lisp>
-(add-to-list 'load-path "~/.emacs.d/lisp/"+(require 'smart-tabs-mode)
-(load-file "~/.emacs.d/lisp/cl-lib-0.5.el"+
-(load-file "~/.emacs.d/lisp/smart-tabs-mode.el")+
  
 (autoload 'smart-tabs-mode "Intelligently indent with tabs, align with spaces!") (autoload 'smart-tabs-mode "Intelligently indent with tabs, align with spaces!")
Line 32: Line 36:
 (smart-tabs-insinuate 'c 'c++ 'java 'javascript 'cperl 'ruby 'nxml) (smart-tabs-insinuate 'c 'c++ 'java 'javascript 'cperl 'ruby 'nxml)
 </code> </code>
- 
 =====Switch between cc/h files===== =====Switch between cc/h files=====
 Switch between the header and implementation using Alt-o. Switch between the header and implementation using Alt-o.
Line 40: Line 43:
 (require 'switch-file) (require 'switch-file)
 (global-set-key (kbd "M-o") 'switch-cc-to-h) (global-set-key (kbd "M-o") 'switch-cc-to-h)
 +</code>
 +
 +=====Show whitespace=====
 +Download [[http://emacswiki.org/emacs/WhiteSpace|whitespace.el]] into the ~/.emacs.d/lisp folder.
 +
 +Use it whenever in c++ mode:
 +<code lisp>
 +(require 'whitespace)
 +(add-hook 'c++-mode-hook 'whitespace-mode)
 +</code>
 +
 +Use sane colors:
 +<code lisp>
 +(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)
 +</code>
 +
 +Disable newlines and wierd rendering of long lines:
 +<code lisp>
 +(custom-set-variables
 + '(whitespace-style (quote (face tabs spaces trailing space-before-tab indentation empty space-after-tab space-mark tab-mark))
 +)
 </code> </code>
emacs/emacs.1442076944.txt.gz · Last modified: 2015/09/12 18:55 by deva