summaryrefslogtreecommitdiffstats
path: root/.config/emacs/jd-emacs/jd-emacs-dev.el
diff options
context:
space:
mode:
Diffstat (limited to '.config/emacs/jd-emacs/jd-emacs-dev.el')
-rw-r--r--.config/emacs/jd-emacs/jd-emacs-dev.el175
1 files changed, 0 insertions, 175 deletions
diff --git a/.config/emacs/jd-emacs/jd-emacs-dev.el b/.config/emacs/jd-emacs/jd-emacs-dev.el
deleted file mode 100644
index 620a7ad..0000000
--- a/.config/emacs/jd-emacs/jd-emacs-dev.el
+++ /dev/null
@@ -1,175 +0,0 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6(setq c-default-style "linux"
7 c-basic-offset 8)
8
9(setq gdb-many-windows t)
10
11(use-package lsp-mode
12 :commands (lsp lsp-deferred)
13 :init
14 (setq lsp-headerline-breadcrumb-enable nil)
15 (setq lsp-diagnostics-provider :none)
16 (setq lsp-modeline-diagnostics-enable nil)
17 (setq lsp-keymap-prefix "C-c l")
18 :config
19 (lsp-enable-which-key-integration t))
20
21(use-package lsp-ivy
22 :after lsp)
23
24(use-package paredit)
25(use-package evil-paredit)
26(use-package rainbow-delimiters)
27
28(defun jd/lisp-mode-setup ()
29 (rainbow-delimiters-mode)
30 (evil-paredit-mode)
31 (paredit-mode))
32
33(add-hook 'emacs-startup-hook
34 (lambda ()
35 (add-hook 'scheme-mode-hook 'jd/lisp-mode-setup)
36 (add-hook 'emacs-lisp-mode-hook 'jd/lisp-mode-setup)
37 (add-hook 'clojure-mode-hook 'jd/lisp-mode-setup)
38 (add-hook 'lisp-mode-hook 'jd/lisp-mode-setup)))
39
40
41(evil-define-key 'normal paredit-mode-map (kbd "g h") 'paredit-forward-barf-sexp)
42(evil-define-key 'normal paredit-mode-map (kbd "g l") 'paredit-forward-slurp-sexp)
43
44(evil-define-key 'normal paredit-mode-map (kbd "g H") 'paredit-backward-slurp-sexp)
45(evil-define-key 'normal paredit-mode-map (kbd "g L") 'paredit-backward-barf-sexp)
46
47(use-package geiser)
48(use-package geiser-guile)
49
50(defun jd/python-mode-setup ()
51 (let ((project-venv-path (concat (projectile-project-root) "venv/")))
52 (when (projectile--directory-p project-venv-path)
53 (pyvenv-activate project-venv-path)
54 (pyvenv-mode))))
55
56;; (use-package python-mode ;;TODO: find alternative
57;; :hook (python-mode . lsp-deferred)
58;; :hook (python-mode . jd/python-mode-setup)
59;; :config
60;; (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode)))
61
62(use-package pyvenv
63 :after python-mode)
64
65(use-package typescript-mode
66 :mode ("\\.ts\\'")
67 :config
68 (setq typescript-indent-level 2))
69
70(defun jd/activate-tide-mode ()
71 (when (and (stringp buffer-file-name)
72 (string-match "\\.[tj]sx?\\'" buffer-file-name))
73 (tide-setup)
74 (tide-hl-identifier-mode)))
75
76(use-package tide
77 :after (typescript-mode company web-mode))
78
79(use-package flycheck
80 :hook ((after-init . global-flycheck-mode)))
81
82(use-package web-mode
83 :hook ((web-mode . jd/activate-tide-mode))
84 :mode
85 ("\\.ejs\\'" "\\.hbs\\'" "\\.html\\'" "\\.php\\'" "\\.[jt]sx?\\'")
86 :config
87 (setq web-mode-content-types-alist '(("jsx" . "\\.[jt]sx?\\'")))
88 (setq web-mode-markup-indent-offset 2)
89 (setq web-mode-css-indent-offset 2)
90 (setq web-mode-code-indent-offset 2)
91 (setq web-mode-script-padding 2)
92 (setq web-mode-block-padding 2)
93 (setq web-mode-style-padding 2)
94 (setq web-mode-enable-auto-pairing t)
95 (setq web-mode-enable-auto-closing t)
96 (setq web-mode-enable-current-element-highlight t))
97
98(use-package yaml-mode)
99
100(use-package docker)
101
102(jd/leader-key-def
103 "d" '(:ignore t :which-key "Docker")
104 "dc" '(docker-containers :which-key "Docker containers")
105 "dd" '(docker :which-key "Docker"))
106
107(use-package company
108 :after lsp-mode
109 :hook (lsp-mode . company-mode)
110 :bind (:map company-active-map
111 ("<tab>" . company-complete-selection))
112 (:map lsp-mode-map
113 ("<tab>" . company-indent-or-complete-common))
114 :custom
115 (company-minimum-prefix-length 1)
116 (company-idle-delay 0.0)
117 :config
118 (global-company-mode))
119
120(use-package company-box
121 :hook (company-mode . company-box-mode))
122
123(use-package projectile
124 :diminish projectile-mode
125 :init
126 (when (file-directory-p "~/Documents/code")
127 (setq projectile-project-search-path '("~/Documents/code/")))
128 :custom ((projectile-Completion-system 'ivy))
129 :config
130 (setq projectile-switch-project-action #'projectile-dired)
131 (projectile-mode))
132
133(jd/leader-key-def
134 "p" '(projectile-command-map :which-key "Project")
135 "p <ESC>" '()
136 "SPC" '(projectile-find-file :which-key "Find file in project"))
137
138(defun jd/neotree-project-dir ()
139 "Open NeoTree using the git root."
140 (interactive)
141 (let ((project-dir (projectile-project-root))
142 (file-name (buffer-file-name)))
143 (neotree-toggle)
144 (if project-dir
145 (if (neo-global--window-exists-p)
146 (progn
147 (neotree-dir project-dir)
148 (neotree-find file-name)))
149 (message "Could not find git project root."))))
150
151(use-package neotree
152 :init
153 (setq neo-theme 'icons)
154 :config
155
156 (evil-define-key 'normal neotree-mode-map (kbd "TAB") 'neotree-enter)
157 (evil-define-key 'normal neotree-mode-map (kbd "C-RET") 'neotree-quick-look)
158 (evil-define-key 'normal neotree-mode-map (kbd "q") 'neotree-hide)
159 (evil-define-key 'normal neotree-mode-map (kbd "RET") 'neotree-enter)
160 (evil-define-key 'normal neotree-mode-map (kbd "g") 'neotree-refresh)
161 (evil-define-key 'normal neotree-mode-map (kbd "A") 'neotree-stretch-toggle)
162 (evil-define-key 'normal neotree-mode-map (kbd "H") 'neotree-hidden-file-toggle))
163
164(jd/leader-key-def
165 "op" '(jd/neotree-project-dir :which-key "Open neotree"))
166
167(use-package magit
168 :custom
169 (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
170
171(jd/leader-key-def
172 "g" '(:ignore t :which-key "Git")
173 "gg" '(magit-status-here :which-key "Magit status"))
174
175;;; jd-dev.el ends here