Added support for golang.
This commit is contained in:
parent
ec7a5e8945
commit
c3add5d12e
3 changed files with 84 additions and 15 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -53,4 +53,4 @@ flycheck_*.el
|
||||||
/network-security.data
|
/network-security.data
|
||||||
|
|
||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/emacs
|
# End of https://www.toptal.com/developers/gitignore/api/emacs
|
||||||
|
|
|
||||||
54
Config.org
54
Config.org
|
|
@ -167,7 +167,9 @@ Repeated invocations toggle between the two most recently open buffers."
|
||||||
(use-package key-chord
|
(use-package key-chord
|
||||||
:config
|
:config
|
||||||
(key-chord-mode 1)
|
(key-chord-mode 1)
|
||||||
(key-chord-define evil-insert-state-map "kj" 'evil-normal-state))
|
(key-chord-define evil-insert-state-map "kj" 'evil-normal-state)
|
||||||
|
:custom
|
||||||
|
(key-chord-two-keys-delay 0.3))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Hydra
|
** Hydra
|
||||||
|
|
@ -638,7 +640,8 @@ Basic configuration for languages servers interactions.
|
||||||
"lgd" '(lsp-find-definition :which-key "go to definition")
|
"lgd" '(lsp-find-definition :which-key "go to definition")
|
||||||
"lgi" '(lsp-find-implementation :which-key "find implementation")
|
"lgi" '(lsp-find-implementation :which-key "find implementation")
|
||||||
"lr" '(:ignore t :which-key "refactor")
|
"lr" '(:ignore t :which-key "refactor")
|
||||||
"lrr" '(lsp-rename :which-key "rename"))
|
"lrr" '(lsp-rename :which-key "rename")
|
||||||
|
)
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
**** lsp ui
|
**** lsp ui
|
||||||
|
|
@ -738,8 +741,12 @@ Configuration for Python.
|
||||||
(python-black-on-save-mode)))
|
(python-black-on-save-mode)))
|
||||||
|
|
||||||
;; Use 4 spaces for the indent level.
|
;; Use 4 spaces for the indent level.
|
||||||
(add-hook 'python-mode-hook (lambda ()
|
(add-hook 'python-mode-hook (lambda ()
|
||||||
(setq python-indent-offset 4)))
|
(progn
|
||||||
|
(setq python-guess-indent nil)
|
||||||
|
(setq python-indent-guess-indent-offset nil)
|
||||||
|
(setq python-indent 4)
|
||||||
|
(setq python-indent-offset 4))))
|
||||||
|
|
||||||
;; If used withing a project that was a virtualenv, use a .dir-locals.el to set the proper interpreter.
|
;; If used withing a project that was a virtualenv, use a .dir-locals.el to set the proper interpreter.
|
||||||
;; ((python-mode . ((python-shell-interpreter . "~/dev/6502/eeprom_programmer/venv/bin/python")
|
;; ((python-mode . ((python-shell-interpreter . "~/dev/6502/eeprom_programmer/venv/bin/python")
|
||||||
|
|
@ -757,6 +764,25 @@ Mode package for YAML
|
||||||
(use-package yaml-mode
|
(use-package yaml-mode
|
||||||
:mode "\\.yml\\'")
|
:mode "\\.yml\\'")
|
||||||
#+end_src
|
#+end_src
|
||||||
|
*** Golang
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
|
||||||
|
(use-package go-mode
|
||||||
|
:config
|
||||||
|
(setq gofmt-command (concat (getenv "GOPATH") "/bin/goimports"))
|
||||||
|
(add-hook 'before-save-hook 'gofmt-before-save))
|
||||||
|
|
||||||
|
#+end_src
|
||||||
|
*** Prisma
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(load "~/.emacs.d/local-packages/emacs-prisma-mode/prisma-mode.el")
|
||||||
|
(require 'prisma-mode)
|
||||||
|
|
||||||
|
(setq auto-mode-alist
|
||||||
|
(cons '("\\.prisma$" . prisma-mode) auto-mode-alist))
|
||||||
|
(setq lsp-language-id-configuration
|
||||||
|
(cons '("\\.prisma$" . "prisma") lsp-language-id-configuration))
|
||||||
|
#+end_src
|
||||||
** Company mode
|
** Company mode
|
||||||
For this config, company mode will only be used with lsp mode. It provides a better workflow for code completion.
|
For this config, company mode will only be used with lsp mode. It provides a better workflow for code completion.
|
||||||
|
|
||||||
|
|
@ -777,8 +803,8 @@ For this config, company mode will only be used with lsp mode. It provides a bet
|
||||||
:hook (lsp-mode . company-mode) ;; Run whenever lsp-mode is active.
|
:hook (lsp-mode . company-mode) ;; Run whenever lsp-mode is active.
|
||||||
:bind (:map company-active-map
|
:bind (:map company-active-map
|
||||||
("<tab>" . 'mariano/company-select-first-and-complete)) ;; When pressing tab, insert the first candidate. Default is cycle.
|
("<tab>" . 'mariano/company-select-first-and-complete)) ;; When pressing tab, insert the first candidate. Default is cycle.
|
||||||
;; :map (lsp-mode-map
|
(:map lsp-mode-map
|
||||||
;; ("<tab>" . company-indent-or-complete-common)) ;; Activate if I want common completions in empty line.
|
("<tab>" . company-indent-or-complete-common)) ;; Activate if I want common completions in empty line.
|
||||||
:custom (company-minimum-prefix-length 1)
|
:custom (company-minimum-prefix-length 1)
|
||||||
(company-idle-delay 0.0))
|
(company-idle-delay 0.0))
|
||||||
|
|
||||||
|
|
@ -817,7 +843,8 @@ later use.
|
||||||
(mariano/leader-keys
|
(mariano/leader-keys
|
||||||
"p" '(:ignore t :which-key "Projectile")
|
"p" '(:ignore t :which-key "Projectile")
|
||||||
"pp" '(projectile-switch-project :which-key "switch project")
|
"pp" '(projectile-switch-project :which-key "switch project")
|
||||||
"pf" '(projectile-find-file :which-key "find file in project"))
|
"pf" '(projectile-find-file :which-key "find file in project")
|
||||||
|
"ps" '(projectile-ripgrep :which-key "search in whole project"))
|
||||||
|
|
||||||
;; Extra ivy actions for projectile commands.
|
;; Extra ivy actions for projectile commands.
|
||||||
(use-package counsel-projectile
|
(use-package counsel-projectile
|
||||||
|
|
@ -925,3 +952,16 @@ We use origami for folding, keybindings are automatically set by evil.
|
||||||
(mariano/leader-keys
|
(mariano/leader-keys
|
||||||
"j" '(dired-jump :which-key "Open in dired"))
|
"j" '(dired-jump :which-key "Open in dired"))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
* Config files
|
||||||
|
Leader keys to go to config files.
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
|
||||||
|
(defun mariano/open-zshell-config ()
|
||||||
|
(interactive)
|
||||||
|
(find-file "~/.zshrc"))
|
||||||
|
|
||||||
|
(mariano/leader-keys
|
||||||
|
"c" '(:ignore t :which-key "config files")
|
||||||
|
"cz" '(mariano/open-zshell-config :which-key "zshell config"))
|
||||||
|
|
||||||
|
#+end_src
|
||||||
|
|
|
||||||
43
init.el
43
init.el
|
|
@ -141,7 +141,9 @@ Repeated invocations toggle between the two most recently open buffers."
|
||||||
(use-package key-chord
|
(use-package key-chord
|
||||||
:config
|
:config
|
||||||
(key-chord-mode 1)
|
(key-chord-mode 1)
|
||||||
(key-chord-define evil-insert-state-map "kj" 'evil-normal-state))
|
(key-chord-define evil-insert-state-map "kj" 'evil-normal-state)
|
||||||
|
:custom
|
||||||
|
(key-chord-two-keys-delay 0.3))
|
||||||
|
|
||||||
;; Setup hydra.
|
;; Setup hydra.
|
||||||
(use-package hydra)
|
(use-package hydra)
|
||||||
|
|
@ -462,7 +464,8 @@ Repeated invocations toggle between the two most recently open buffers."
|
||||||
"lgd" '(lsp-find-definition :which-key "go to definition")
|
"lgd" '(lsp-find-definition :which-key "go to definition")
|
||||||
"lgi" '(lsp-find-implementation :which-key "find implementation")
|
"lgi" '(lsp-find-implementation :which-key "find implementation")
|
||||||
"lr" '(:ignore t :which-key "refactor")
|
"lr" '(:ignore t :which-key "refactor")
|
||||||
"lrr" '(lsp-rename :which-key "rename"))
|
"lrr" '(lsp-rename :which-key "rename")
|
||||||
|
)
|
||||||
|
|
||||||
(use-package lsp-ui
|
(use-package lsp-ui
|
||||||
:hook (lsp-mode . lsp-ui-mode)
|
:hook (lsp-mode . lsp-ui-mode)
|
||||||
|
|
@ -510,8 +513,12 @@ Repeated invocations toggle between the two most recently open buffers."
|
||||||
(python-black-on-save-mode)))
|
(python-black-on-save-mode)))
|
||||||
|
|
||||||
;; Use 4 spaces for the indent level.
|
;; Use 4 spaces for the indent level.
|
||||||
(add-hook 'python-mode-hook (lambda ()
|
(add-hook 'python-mode-hook (lambda ()
|
||||||
(setq python-indent-offset 4)))
|
(progn
|
||||||
|
(setq python-guess-indent nil)
|
||||||
|
(setq python-indent-guess-indent-offset nil)
|
||||||
|
(setq python-indent 4)
|
||||||
|
(setq python-indent-offset 4))))
|
||||||
|
|
||||||
;; If used withing a project that was a virtualenv, use a .dir-locals.el to set the proper interpreter.
|
;; If used withing a project that was a virtualenv, use a .dir-locals.el to set the proper interpreter.
|
||||||
;; ((python-mode . ((python-shell-interpreter . "~/dev/6502/eeprom_programmer/venv/bin/python")
|
;; ((python-mode . ((python-shell-interpreter . "~/dev/6502/eeprom_programmer/venv/bin/python")
|
||||||
|
|
@ -520,6 +527,19 @@ Repeated invocations toggle between the two most recently open buffers."
|
||||||
(use-package yaml-mode
|
(use-package yaml-mode
|
||||||
:mode "\\.yml\\'")
|
:mode "\\.yml\\'")
|
||||||
|
|
||||||
|
(use-package go-mode
|
||||||
|
:config
|
||||||
|
(setq gofmt-command (concat (getenv "GOPATH") "/bin/goimports"))
|
||||||
|
(add-hook 'before-save-hook 'gofmt-before-save))
|
||||||
|
|
||||||
|
(load "~/.emacs.d/local-packages/emacs-prisma-mode/prisma-mode.el")
|
||||||
|
(require 'prisma-mode)
|
||||||
|
|
||||||
|
(setq auto-mode-alist
|
||||||
|
(cons '("\\.prisma$" . prisma-mode) auto-mode-alist))
|
||||||
|
(setq lsp-language-id-configuration
|
||||||
|
(cons '("\\.prisma$" . "prisma") lsp-language-id-configuration))
|
||||||
|
|
||||||
(defun mariano/company-select-first-and-complete ()
|
(defun mariano/company-select-first-and-complete ()
|
||||||
"Selects the appropriate candidate in the company mode list and completes it."
|
"Selects the appropriate candidate in the company mode list and completes it."
|
||||||
(interactive)
|
(interactive)
|
||||||
|
|
@ -535,8 +555,8 @@ Repeated invocations toggle between the two most recently open buffers."
|
||||||
:hook (lsp-mode . company-mode) ;; Run whenever lsp-mode is active.
|
:hook (lsp-mode . company-mode) ;; Run whenever lsp-mode is active.
|
||||||
:bind (:map company-active-map
|
:bind (:map company-active-map
|
||||||
("<tab>" . 'mariano/company-select-first-and-complete)) ;; When pressing tab, insert the first candidate. Default is cycle.
|
("<tab>" . 'mariano/company-select-first-and-complete)) ;; When pressing tab, insert the first candidate. Default is cycle.
|
||||||
;; :map (lsp-mode-map
|
(:map lsp-mode-map
|
||||||
;; ("<tab>" . company-indent-or-complete-common)) ;; Activate if I want common completions in empty line.
|
("<tab>" . company-indent-or-complete-common)) ;; Activate if I want common completions in empty line.
|
||||||
:custom (company-minimum-prefix-length 1)
|
:custom (company-minimum-prefix-length 1)
|
||||||
(company-idle-delay 0.0))
|
(company-idle-delay 0.0))
|
||||||
|
|
||||||
|
|
@ -563,7 +583,8 @@ Repeated invocations toggle between the two most recently open buffers."
|
||||||
(mariano/leader-keys
|
(mariano/leader-keys
|
||||||
"p" '(:ignore t :which-key "Projectile")
|
"p" '(:ignore t :which-key "Projectile")
|
||||||
"pp" '(projectile-switch-project :which-key "switch project")
|
"pp" '(projectile-switch-project :which-key "switch project")
|
||||||
"pf" '(projectile-find-file :which-key "find file in project"))
|
"pf" '(projectile-find-file :which-key "find file in project")
|
||||||
|
"ps" '(projectile-ripgrep :which-key "search in whole project"))
|
||||||
|
|
||||||
;; Extra ivy actions for projectile commands.
|
;; Extra ivy actions for projectile commands.
|
||||||
(use-package counsel-projectile
|
(use-package counsel-projectile
|
||||||
|
|
@ -633,3 +654,11 @@ Repeated invocations toggle between the two most recently open buffers."
|
||||||
;; Dired leader keys.
|
;; Dired leader keys.
|
||||||
(mariano/leader-keys
|
(mariano/leader-keys
|
||||||
"j" '(dired-jump :which-key "Open in dired"))
|
"j" '(dired-jump :which-key "Open in dired"))
|
||||||
|
|
||||||
|
(defun mariano/open-zshell-config ()
|
||||||
|
(interactive)
|
||||||
|
(find-file "~/.zshrc"))
|
||||||
|
|
||||||
|
(mariano/leader-keys
|
||||||
|
"c" '(:ignore t :which-key "config files")
|
||||||
|
"cz" '(mariano/open-zshell-config :which-key "zshell config"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue