-
Notifications
You must be signed in to change notification settings - Fork 0
/
csharp.el
43 lines (36 loc) · 1.28 KB
/
csharp.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(require 'csharp-mode)
(require 'omnisharp)
(add-hook 'csharp-mode-hook 'omnisharp-mode)
(eval-after-load
'company
'(add-to-list 'company-backends 'company-omnisharp))
(add-hook 'csharp-mode-hook #'company-mode)
(add-hook 'csharp-mode-hook #'flycheck-mode)
(eval-after-load
'company
'(add-to-list 'company-backends #'company-omnisharp))
(defun my-csharp-mode-setup ()
(omnisharp-mode)
(company-mode)
(flycheck-mode)
(setq indent-tabs-mode nil)
(setq c-syntactic-indentation t)
(c-set-style "ellemtel")
(setq c-basic-offset 4)
(setq truncate-lines t)
(setq tab-width 4)
(setq evil-shift-width 4)
;csharp-mode README.md recommends this too
;(electric-pair-mode 1) ;; Emacs 24
;(electric-pair-local-mode 1) ;; Emacs 25
(local-set-key (kbd "C-c r r") 'omnisharp-run-code-action-refactoring)
(local-set-key (kbd "C-c C-c") 'recompile))
(add-hook 'csharp-mode-hook 'my-csharp-mode-setup t)
(when (darwin?)
;; You'll need to do:
;; $ brew install omnisharp/omnisharp-roslyn/omnisharp-mono
;; before you can use this.
;; You'll also probably want to install VS Code and the .NET core SDK.
;; You'll also need to M-x omnisharp-install-server
;; Then do M-x omnisharp-start-omnisharp-server
(setq omnisharp-server-executable-path "/usr/local/bin/omnisharp"))