aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaul Benencia <raul@thousandeyes.com>2020-05-26 15:46:38 -0700
committerRaul Benencia <raul@thousandeyes.com>2020-05-26 15:46:38 -0700
commit65dea73b1362ba9ce03389e2148656bfba90d566 (patch)
treef95bb0f65d7160a2bee24fc18d682e3fd1fdf735
parent38f4e04a6aea11231d14de45774fa158dae3ff1d (diff)
lsp in go
-rw-r--r--.emacs1
-rw-r--r--.emacs.local.d/modes/company.el4
-rw-r--r--.emacs.local.d/modes/go-lang.el2
-rw-r--r--.emacs.local.d/modes/lsp.el19
-rw-r--r--.emacs.local.d/modes/org-pomodoro.el18
5 files changed, 39 insertions, 5 deletions
diff --git a/.emacs b/.emacs
index 895b907..bc622fd 100644
--- a/.emacs
+++ b/.emacs
@@ -29,6 +29,7 @@
(load-file "~/.emacs.local.d/modes/ido.el")
(load-file "~/.emacs.local.d/modes/imenu.el")
(load-file "~/.emacs.local.d/modes/latex.el")
+(load-file "~/.emacs.local.d/modes/lsp.el")
(load-file "~/.emacs.local.d/modes/mail-mode.el")
(load-file "~/.emacs.local.d/modes/markdown.el")
(load-file "~/.emacs.local.d/modes/magit.el")
diff --git a/.emacs.local.d/modes/company.el b/.emacs.local.d/modes/company.el
index dc80b33..cdc8c64 100644
--- a/.emacs.local.d/modes/company.el
+++ b/.emacs.local.d/modes/company.el
@@ -27,3 +27,7 @@
:init
(with-eval-after-load 'company
(add-to-list 'company-backends 'company-go)))
+
+(use-package company-lsp
+ :ensure t
+ :commands company-lsp)
diff --git a/.emacs.local.d/modes/go-lang.el b/.emacs.local.d/modes/go-lang.el
index 5d43e16..ad0b307 100644
--- a/.emacs.local.d/modes/go-lang.el
+++ b/.emacs.local.d/modes/go-lang.el
@@ -5,8 +5,6 @@
:ensure t
:init
(progn
- (setq gofmt-command "goimports")
- (add-hook 'before-save-hook 'gofmt-before-save)
(bind-key [remap find-tag] #'godef-jump))
:config
(add-hook 'go-mode-hook 'electric-pair-mode)
diff --git a/.emacs.local.d/modes/lsp.el b/.emacs.local.d/modes/lsp.el
new file mode 100644
index 0000000..30a5d8f
--- /dev/null
+++ b/.emacs.local.d/modes/lsp.el
@@ -0,0 +1,19 @@
+(use-package lsp-mode
+ :ensure t
+ :commands (lsp lsp-deferred)
+ :hook (go-mode . lsp-deferred))
+
+;;Set up before-save hooks to format buffer and add/delete imports.
+;;Make sure you don't have other gofmt/goimports hooks enabled.
+
+(defun lsp-go-install-save-hooks ()
+ (add-hook 'before-save-hook #'lsp-format-buffer t t)
+ (add-hook 'before-save-hook #'lsp-organize-imports t t))
+(add-hook 'go-mode-hook #'lsp-go-install-save-hooks)
+
+;;Optional - provides fancier overlays.
+(use-package lsp-ui
+ :ensure t
+ :commands lsp-ui-mode
+ :init
+)
diff --git a/.emacs.local.d/modes/org-pomodoro.el b/.emacs.local.d/modes/org-pomodoro.el
index b0bdb35..e8df41f 100644
--- a/.emacs.local.d/modes/org-pomodoro.el
+++ b/.emacs.local.d/modes/org-pomodoro.el
@@ -3,8 +3,20 @@
(use-package org-pomodoro
:ensure t
:commands (org-pomodoro)
+ :hook
+ (org-pomodoro-started . (lambda () (notifications-notify
+ :title "Pomodoro"
+ :body "Let's focus for 25 minutes!"
+ :app-icon "~/.emacs.d/img/001-food-and-restaurant.png")))
+ (org-pomodoro-finished . (lambda () (notifications-notify
+ :title "Pomodoro"
+ :body "Well done! Take a break."
+ :app-icon "~/.emacs.d/img/004-beer.png")))
:config
- (setq alert-user-configuration (quote ((((:category . "org-pomodoro")) libnotify nil)))))
+ (setq org-pomodoro-length 25)
+ (setq org-pomodoro-short-break-length 5)
+ (setq org-pomodoro-long-break-length 15)
+ (setq org-pomodoro-play-sounds nil))
(defun my/org-pomodoro-text-time ()
"Return status info about org-pomodoro and if org-pomodoro is not running, try to print info about org-clock.
@@ -13,8 +25,8 @@
(cond ((equal :none org-pomodoro-state)
(if (org-clock-is-active)
(format "Clocked task: %d minutes - %s"
- (org-clock-get-clocked-time) (substring-no-properties org-clock-heading)
- "No Active task")))
+ (org-clock-get-clocked-time) (substring-no-properties org-clock-heading))
+ "No Active task"))
((equal :pomodoro org-pomodoro-state)
(format "%d - Pomodoro: %d minutes - %s"
org-pomodoro-count (/ (org-pomodoro-remaining-seconds) 60) (substring-no-properties org-clock-heading)))
nihil fit ex nihilo