This commit is contained in:
Mikaël Capelle 2016-03-29 20:18:49 +02:00
parent 637991cc0b
commit d1cb094b67
2 changed files with 156 additions and 44 deletions

132
.emacs.el
View File

@ -25,6 +25,22 @@
(column-number-mode t)
(line-number-mode t)
;; Command rebinding
;; M-f (forward-word) : Déplacement d'un mot vers la droite du curseur.
;; M-b (backward-word) : Déplacement d'un mot vers la gauche du curseur.
;; C-a (beginning-of-line) : Déplacement au début de la ligne courante.
;; C-e (end-of-line) : Déplacement à la fin de la ligne courante.
;; M-{ (backward-paragraph) : Déplacement vers le paragraphe précédent.
(global-set-key (kbd "M-p") 'backward-paragraph)
;; M-} (forward-paragraph) : Déplacement vers le paragraphe suivant.
(global-set-key (kbd "M-n") 'forward-paragraph)
;; C-v (scroll-up) : Déplacement d'un écran vers le bas.
;; M-v (scroll-down) : Déplacement d'un écran vers le haut.
;; M-> (end-of-buffer) : Déplacement à la fin du buffer.
;; M-< (beginning-of-buffer) : Déplacement au début du buffer.
;; No split screen at startup
(setq inhibit-startup-screen t)
@ -38,32 +54,50 @@
(setq-default indent-tabs-mode nil)
(setq tab-width 4)
;; Compilation coloration
(ignore-errors
(require 'ansi-color)
(defun my-colorize-compilation-buffer ()
(when (eq major-mode 'compilation-mode)
(ansi-color-apply-on-region compilation-filter-start (point-max))))
(add-hook 'compilation-filter-hook 'my-colorize-compilation-buffer))
;; Auto complete + Yasnippet
(use-package sr-speedbar
:config
(setq speedbar-show-unknown-files t)
(setq speedbar-use-images nil)
(setq sr-speedbar-right-side nil))
(use-package semantic/sb
:config
;; (semantic-mode)
(global-set-key (kbd "C-c C-k C-l") 'sr-speedbar-toggle))
(use-package helm-config
:config
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "C-x r b") 'helm-filtered-bookmarks)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
(global-set-key (kbd "C-x C-b") 'helm-buffers-list)
(helm-mode 1))
(use-package yasnippet
:config
(yas-global-mode 1))
(use-package auto-complete
:config
(require 'auto-complete-config)
(ac-config-default)
(require 'ac-c-headers)
(require 'ac-math)
(add-to-list 'ac-modes 'latex-mode)
(add-to-list 'ac-modes 'org-mode)
(add-to-list 'ac-sources 'ac-source-c-headers)
(defun ac-latex-mode-setup () ; add ac-sources to default ac-sources
(setq ac-sources
(append '(ac-source-math-unicode
ac-source-math-latex
ac-source-latex-commands)
ac-sources)))
(add-hook 'LaTeX-mode-hook 'ac-latex-mode-setup)
(global-auto-complete-mode t)
(ac-flyspell-workaround)
:config
(setq ac-math-unicode-in-math-p t))
(use-package company
:init
(require 'company-auctex)
(setq company-backends (append company-backends '(company-c-headers
company-jedi
company-web-html)))
(add-hook 'LaTeX-mode-hook 'company-auctex-init)
:config
(add-hook 'after-init-hook 'global-company-mode)
(global-set-key (kbd "M-/") 'company-complete))
;; Latex
(use-package tex-mik
@ -145,7 +179,6 @@
(setq show-paren-delay 0)
;; C mode
(setq c-default-style "k&r")
(setq c-basic-offset 4)
@ -154,8 +187,8 @@
(defun ac-cc-mode-setup ()
"Initialization hook for CC-mode runs before any other hooks."
(hide-ifdef-mode)
(setq hide-ifdef-shadow t)
(hs-minor-mode))
(hs-minor-mode)
(setq hide-ifdef-shadow t))
(add-hook 'c-mode-common-hook 'ac-cc-mode-setup)
(add-hook 'c++-mode-common-hook 'ac-cc-mode-setup)
@ -171,7 +204,6 @@
;; Run C programs directly from within emacs
(setq execute-command nil)
(setq compile-command nil)
(setq execute-buffer-name "*output*")
(setq execute-process-name "execute")
@ -195,24 +227,13 @@
(end-of-buffer)
(insert (concat (propertize execute-command 'face 'bold) "\n"))
(switch-to-buffer-other-window old-buffer)
(start-process-shell-command execute-process-name execute-buffer-name execute-command)
)
(defun set-compile-command ()
(interactive)
(setq compile-command (read-from-minibuffer "Compile command: ")))
(defun compile-c-program ()
(interactive)
(if (not compile-command) (set-compile-command))
(compile compile-command))
(start-process-shell-command execute-process-name execute-buffer-name execute-command))
(defun key-c-mode-setup ()
(local-set-key [f1] 'compile-c-program)
(local-set-key [f2] 'execute-c-program)
(local-set-key (kbd "C-c C-c") 'smart-compile)
(local-set-key (kbd "C-c C-r") 'execute-c-program)
(local-set-key [f3] 'kill-execute-c-program)
(local-set-key [f4] 'set-execute-command)
(local-set-key [f5] 'set-compile-command))
(local-set-key [f4] 'set-execute-command))
(add-hook 'c++-mode-common-hook 'key-c-mode-setup)
(add-hook 'c-mode-common-hook 'key-c-mode-setup)
@ -230,3 +251,36 @@
(local-set-key [f8] 'fd-switch-dictionary))
(add-hook 'LaTeX-mode-hook 'key-latex-mode-setup)
;; python
(use-package python-mode
:mode "\\.py\\'")
;; (use-package jedi
;; :config
;; (add-hook 'python-mode-hook 'jedi:setup)
;; (setq jedi:complete-on-dot t))
(use-package cython-mode
:init
(require 'python-mode)
(setq python-indent 4)
(setq python-indent-offset 4)
:mode "\\.pyx\\'")
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(safe-local-variable-values
(quote
((encoding . utf-8)
(company-clang-arguments "-std=c++14" "-I/home/mcapelle/Dev/cpp/include/" "-I/home/mcapelle/Dev/cpp/lns/lib/build/include/")))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)

View File

@ -8,8 +8,66 @@
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line
(package-install auto-complete)
(package-install ac-math)
(package-install ac-c-headers)
(package-install ac-octave)
(package-install auto-complete-clang-async)
(package-install '2048-game)
(package-install 'ac-c-headers)
(package-install 'ac-math)
(package-install 'ac-octave)
(package-install 'async)
(package-install 'auctex)
(package-install 'auto-complete)
(package-install 'company)
(package-install 'company-auctex)
(package-install 'company-c-headers)
(package-install 'company-dict)
(package-install 'company-jedi)
(package-install 'company-math)
(package-install 'company-web)
(package-install 'concurrent)
(package-install 'ctable)
(package-install 'cython-mode)
(package-install 'dash)
(package-install 'dash-functional)
(package-install 'deferred)
(package-install 'diffview)
(package-install 'epc)
(package-install 'f)
(package-install 'fish-mode)
(package-install 'helm)
(package-install 'helm-bibtex)
(package-install 'helm-core)
(package-install 'helm-ls-git)
(package-install 'helm-package)
(package-install 'helm-spotify)
(package-install 'hydandata-light)
(package-install 'java-imports)
(package-install 'java-snippets)
(package-install 'javadoc-lookup)
(package-install 'jdee)
(package-install 'jedi)
(package-install 'jedi-core)
(package-install 'js-comint)
(package-install 'json-mode)
(package-install 'json-reformat)
(package-install 'json-snatcher)
(package-install 'markdown-mode)
(package-install 'math-symbol-lists)
(package-install 'multi)
(package-install 'nvm)
(package-install 'openwith)
(package-install 'parsebib)
(package-install 'pcache)
(package-install 'php-mode)
(package-install 'poker)
(package-install 'popup)
(package-install 'pos-tip)
(package-install 'python-environment)
(package-install 'python-mode)
(package-install 'pythonic)
(package-install 's)
(package-install 'smart-compile)
(package-install 'sokoban)
(package-install 'sr-speedbar)
(package-install 'web-completion-)
(package-install 'web-mode)
(package-install 'yaml-mode)
(package-install 'yasnippet)