summary refs log tree commit diff
path: root/configs/rcs/emacs.d/config/fcuny-prog.el
blob: c7d267c08df7aff1f4f49882d8daf57e42d2afdb (plain) (blame)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
(eval-when-compile
  (require 'use-package))

;; auto close bracket, parenthesis insertion
(electric-pair-mode 1)

(use-package paren
  :custom
  (show-paren-delay 0)
  :config
  (show-paren-mode 1))

(use-package lisp-mode
  :bind
  (("C-c C-e" . eval-buffer)
   ("C-c C-r" . eval-region)))

(use-package eldoc
  :ensure t
  :hook (emacs-lisp-mode-hook))

(use-package pants
  :load-path (lambda () (expand-file-name  "github.com/fcuny/pants.el/" fcuny-path-workspace))
  :custom
  (pants-completion-system 'ivy)
  (pants-source-tree-root (expand-file-name "git.twitter.biz/source" fcuny-path-workspace))
  (pants-bury-compilation-buffer t)
  (pants-extra-args "-q")
  :bind (("C-c b" . pants-find-build-file)
         ("C-c r" . pants-run-binary)
         ("C-c t" . pants-run-test))
  :init
  (if (fc/check-work-machine-p)
      (add-to-list 'auto-mode-alist '("BUILD" . python-mode))))

(use-package make-mode
  :ensure t
  :config
  (add-hook 'makefile-mode-hook (lambda () (setq-local tab-width 2))))

(use-package company
  :ensure t
  :diminish company-mode
  :config
  (global-company-mode)
  (setq company-global-modes '(not term-mode)
        company-idle-delay 0.3
        company-minimum-prefix-length 3
        company-selection-wrap-around t
        company-show-numbers t
        company-tooltip-align-annotations t
        company-require-match nil))

(use-package magit
  :ensure t
  :mode (("differential-update-comments" . git-commit-mode)
         ("new-commit"                   . git-commit-mode))
  :bind (("C-x g s" . magit-status)
         ("C-x g b" . magit-checkout))
  :init
  (progn
    (setq magit-completing-read-function 'ivy-completing-read))

  :config
  (progn
    (global-git-commit-mode)

    ;; I don't care about other VC backend for work
    (if (fc/check-work-machine-p)
      (setf vc-handled-backends nil
            vc-follow-symlinks t))

    (use-package git-commit :ensure t)

    (add-hook 'magit-log-edit-mode-hook
              #'(lambda ()
                  (set-fill-column 72)
                  (flyspell-mode)))))

(use-package go-mode
  :ensure t
  :after (company flycheck)
  :preface
  (defun fcuny/go-mode-setup ()
    (add-hook 'go-mode-hook 'flycheck-mode)
    (setq-default)
    (setq tab-width 2))
  :config
  (add-hook 'go-mode-hook #'fcuny/go-mode-setup))

(use-package go-eldoc
  :after go-mode
  :ensure t
  :hook (go-mode . go-eldoc-setup))

(use-package gotest
  :ensure t)

(use-package go-guru
  :ensure t)

(use-package go-imports
  :ensure t)

(use-package golint
  :ensure t)

(use-package go-projectile
  :ensure t)

(use-package company-go
  :ensure t
  :after (company go-mode)
  :custom
  (company-go-show-annotation t)
  :config
  (add-hook 'go-mode-hook 'company-mode)
  (add-to-list 'company-backends 'company-go))

(use-package python
  :mode (("\\.py$" . python-mode))
  :ensure t
  :commands python-mode
  :custom (python-indent-offset 2))

(use-package anaconda-mode
  :ensure t
  :after python
  :hook ((python-mode . anaconda-mode)
         (python-mode . eldoc-mode))
  :custom (anaconda-mode-eldoc-as-single-line t))

(use-package company-anaconda
  :ensure t
  :after anaconda-mode
  :init
  (add-to-list 'company-backends 'company-anaconda))

(use-package scala-mode :ensure t)

(use-package sh-script
  :mode ("bashrc" . sh-mode)
  :config
  (defun set-sh-mode-indent ()
    (setq sh-basic-offset 2
          sh-indentation 2))
  (add-hook 'sh-mode-hook 'set-sh-mode-indent)
  (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p))

(use-package dockerfile-mode
  :ensure t)

(use-package puppet-mode
  :ensure t
  :mode ("\\.pp\\'" . puppet-mode)
  ;:hook (flycheck-mode)
  :config
  (if (fc/check-work-machine-p)
    (setq flycheck-puppet-lint-rc fcuny-path-puppet-linter-svn)))

(provide 'fcuny-prog)