Add programming section
- Setup company/ivory/flycheck - basic setup
This commit is contained in:
parent
ef4b87f560
commit
70662a4f65
2 changed files with 98 additions and 30 deletions
114
config.org
114
config.org
|
|
@ -446,22 +446,6 @@ https://github.com/remyferre/comment-dwim-2
|
||||||
)
|
)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
* Yasnippet
|
|
||||||
|
|
||||||
Template system for Emacs.
|
|
||||||
|
|
||||||
https://github.com/joaotavora/yasnippet
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(use-package yasnippet
|
|
||||||
:ensure t
|
|
||||||
:config
|
|
||||||
(add-to-list 'load-path
|
|
||||||
"~/.emacs.d/plugins/yasnippet")
|
|
||||||
(yas-global-mode 1)
|
|
||||||
)
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
* Expand-region
|
* Expand-region
|
||||||
|
|
||||||
Expand region increases the selected region by semantic units.
|
Expand region increases the selected region by semantic units.
|
||||||
|
|
@ -661,6 +645,104 @@ TODO: need to document this
|
||||||
)
|
)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
* Programming
|
||||||
|
|
||||||
|
** Yasnippet
|
||||||
|
|
||||||
|
Template system for Emacs.
|
||||||
|
|
||||||
|
https://github.com/joaotavora/yasnippet
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package yasnippet
|
||||||
|
:ensure t
|
||||||
|
:init
|
||||||
|
(add-to-list 'load-path
|
||||||
|
"~/.emacs.d/plugins/yasnippet")
|
||||||
|
:config
|
||||||
|
(add-hook 'prog-mode-hook 'yas-minor-mode)
|
||||||
|
)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Flycheck
|
||||||
|
|
||||||
|
On-the-fly syntax checking.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package flycheck
|
||||||
|
:ensure t
|
||||||
|
:config
|
||||||
|
(add-hook 'prog-mode-hook 'flycheck-mode)
|
||||||
|
)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Company mode
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package company
|
||||||
|
:ensure t
|
||||||
|
:config
|
||||||
|
(setq company-idle-delay 0)
|
||||||
|
(setq company-minimum-prefix-length 3))
|
||||||
|
(add-hook 'prog-mode-hook 'company-mode)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** C/C++ mode
|
||||||
|
|
||||||
|
*** Flycheck
|
||||||
|
|
||||||
|
Clang static analyzer with flycheck
|
||||||
|
|
||||||
|
https://github.com/alexmurray/flycheck-clang-analyzer
|
||||||
|
https://github.com/Sarcasm/flycheck-irony
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package flycheck-clang-analyzer
|
||||||
|
:ensure t
|
||||||
|
:config
|
||||||
|
(with-eval-after-load 'flycheck
|
||||||
|
(require 'flycheck-clang-analyzer)
|
||||||
|
(flycheck-clang-analyzer-setup)))
|
||||||
|
|
||||||
|
(use-package flycheck-irony
|
||||||
|
:ensure t
|
||||||
|
:config
|
||||||
|
(eval-after-load 'flycheck
|
||||||
|
'(add-hook 'flycheck-mode-hook #'flycheck-irony-setup))
|
||||||
|
)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Company
|
||||||
|
|
||||||
|
https://github.com/ikirill/irony-eldoc
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package company-c-headers
|
||||||
|
:ensure t)
|
||||||
|
|
||||||
|
(use-package company-irony
|
||||||
|
:ensure t
|
||||||
|
:config
|
||||||
|
(setq company-backends '((company-c-headers
|
||||||
|
;; company-dabbrev-code ;; not sure what this is
|
||||||
|
company-irony))))
|
||||||
|
|
||||||
|
(use-package irony
|
||||||
|
:ensure t
|
||||||
|
:config
|
||||||
|
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
|
||||||
|
(add-hook 'c++-mode-hook 'irony-mode)
|
||||||
|
(add-hook 'c-mode-hook 'irony-mode)
|
||||||
|
(add-hook 'objc-mode-hook 'irony-mode)
|
||||||
|
)
|
||||||
|
|
||||||
|
(use-package irony-eldoc
|
||||||
|
:ensure t
|
||||||
|
:config
|
||||||
|
(add-hook 'irony-mode-hook 'irony-eldoc)
|
||||||
|
)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
* Old stuff, maybe usefull for lookup later
|
* Old stuff, maybe usefull for lookup later
|
||||||
|
|
||||||
** Diff mode stuff
|
** Diff mode stuff
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,7 @@
|
||||||
(add-hook 'after-init-hook 'global-company-mode)
|
|
||||||
|
|
||||||
;; Add irony as company-backend
|
|
||||||
(eval-after-load 'company
|
|
||||||
'(add-to-list 'company-backends 'company-irony))
|
|
||||||
|
|
||||||
;; Add irony as flycheck hook
|
;; Add irony as flycheck hook
|
||||||
(eval-after-load 'flycheck
|
(eval-after-load 'flycheck
|
||||||
'(add-hook 'flycheck-mode-hook 'flycheck-irony-setup))
|
'(add-hook 'flycheck-mode-hook 'flycheck-irony-setup))
|
||||||
|
|
||||||
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
|
|
||||||
(add-hook 'irony-mode-hook 'irony-eldoc)
|
|
||||||
|
|
||||||
;; Add irony-, flycheck-, company-mode to c-mode
|
|
||||||
(add-hook 'c-mode-hook 'irony-mode)
|
|
||||||
(add-hook 'c-mode-hook 'flycheck-mode)
|
|
||||||
(add-hook 'c-mode-hook 'company-mode)
|
|
||||||
|
|
||||||
;; Set tab to autocomplete or indent depending on context
|
;; Set tab to autocomplete or indent depending on context
|
||||||
(global-set-key (kbd "<tab>") 'company-indent-or-complete-common)
|
(global-set-key (kbd "<tab>") 'company-indent-or-complete-common)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue