2 google style
2.1 google-cpplint
Some tools are required in your system
sudo pip install cpplint
Then your can configure your emacs.
(defun my:flymake-google-init()
(require 'flymake-google-cpplint)
(custom-set-variables
'(flymake-google-cpplint-command "/usr/local/bin/cpplint"))
(flymake-google-cpplint-load))
(add-hook 'c-mode-hook 'my:flymake-google-init)
(add-hook 'c++-mode-hook 'my:flymake-google-init)
(require 'google-c-style)
(add-hook 'c-mode-common-hook 'google-set-c-style)
(add-hook 'c-mode-common-hook 'google-make-newline-indent)
This is my configure and maybe your cpplint-command directory isn't "/usr/local/bin/cpplint". you can set the directory as below command.
whereis cpplint
Using cpplint, you will see some "!, " at the begging of line in your .cpp or .h file, because your code isn't fit with google style.
2.2 clang
sudo apt-get install clang3.5 libclang-dev
git clone https://github.com/Sarcasm/irony-mode.git
git clone https://github.com/MJPA/SimpleJSON.git
mv irony-mode* irony-mode
mv SimpleJSon* SimpleJSon
mv SimpleJSon irony-mode/lib
mv SimpleJSon ~/.emacs.d/
cd ~/.emacs.d/SimpleJSon/build
cmake ..
make
sudo make install
The clang version varies with diffrent systems. you can check the package version in your system as the below command:
sudo apptitude search clang
Then you can configure your emacs as below:
(setenv "LD_LIBRARY_PATH" "/usr/lib/llvm-3.5/lib/")
(add-to-list 'load-path (expand-file-name "~/.emacs.d/irony-mode/elisp/"))
(require 'irony)
(irony-enable 'ac)
(defun my:irony-enable()
(when (member major-mode irony-known-modes)
(irony-mode 1)))
(add-hook 'c++-mode-hook 'my:irony-enable)
(add-hook 'c-mode-hook 'my:irony-enable)
Maybe the llvm-lib directory isn't "usr/lib/llvm-3.5/lib". you can search llvm-lib directory as below:
find / -name "llvm"
In reality, We setenv llv-lib because of iron's run is dependent on llvm-lib and it equals with adding llvm-lib in "/etc/ld.so.conf" file.
3 project manager
3.1 projectile
(require 'projectile)
;; 默认全局使用
(projectile-global-mode)
;; 默认打开缓存
(setq projectile-enable-caching t)
;; 使用f5键打开默认文件搜索
(global-set-key [f5] 'projectile-find-file)