Browse Source

Initial DCT changeset

master
David Trudgian 2 years ago
parent
commit
784f53815b
  1. 3
      .gitignore
  2. 26
      README.md
  3. 6
      base/spacelite-base.el
  4. 36
      base/spacelite-emacs.el
  5. 16
      base/spacelite-evil.el
  6. 16
      base/spacelite-flycheck.el
  7. 12
      base/spacelite-git.el
  8. 29
      base/spacelite-helm.el
  9. 3
      base/spacelite-osx.el
  10. 79
      base/spacelite-shell.el
  11. 61
      base/spacelite-treemacs.el
  12. 10
      base/spacelite-windows.el
  13. 11
      core/core-config.el
  14. 95
      core/core-makeup.el
  15. 18
      core/core-spacelite.el
  16. 26
      init.el
  17. 10
      lang/spacelite-langs.el
  18. 106
      lang/spacelite-lsp.el
  19. 4
      lang/spacelite-markdown.el
  20. 290
      lang/spacelite-org.el
  21. 58
      lang/spacelite-scala.el
  22. 24
      utils/spacelite-utils.el

3
.gitignore

@ -6,6 +6,9 @@
*.elc
auto-save-list
tramp
recentf
network-security.data
transient/
.\#*
# Org-mode

26
README.md

@ -1,5 +1,16 @@
# Spacelite (minimal yet functional emacs)
This is a fork of https://github.com/hzenginx/spacelite which has been modified by me, adding/changing:
- remove scala language support
- use lsp for languages
- add the spacemace 0.300 org key bindings
- flycheck
- treemacs
- theme changes
----
Spacelite is just a minimal evil + emacs configuration with following:
- `evil` with `evil-escape`, `evil-iedit`
- `use-package` for dependencies
@ -12,10 +23,9 @@ Spacelite is just a minimal evil + emacs configuration with following:
- `magit` with `evil-magit`
- some simple `MacOs` keybindings (only enabled in OSX/emacs)
- `which-key` for shortcut help
- `solarized-dark` theme
- `highlight-parentheses`, `evil-anzu`, `restart-emacs`, `emacs-shell` etc.
- `zero-dark` theme
- `highlight-parentheses`, `evil-anzu`, `restart-emacs` etc.
- `scala` support with cutting edge `ensime` (you can(should if you are not using ensime snapshot builds already) disable this in `init.el`)
- a ligh but useful modeline with [spaceline](https://github.com/TheBB/spaceline).
All of above with proper(for me) evil(-like) key bindings.
@ -23,7 +33,9 @@ Note: This "thing" is my personal configuration that I use at work and personal
# Installation
`git clone https://github.com/hzenginx/spacelite ~/.emacs.d`
`git clone https://github.com/dctrud/spacelite ~/.emacs.d`
The theme Spacelite using(zerodark) uses `all-the-icons` package. So you need to call(`M-x` a.k.a. `SPC SPC`) `all-the-icons-install-fonts` function once in first run to get icons working.
# Why
There is [spacemacs](https://github.com/syl20bnr/spacemacs) as we all know. But for me it comes with too much unnecessary packages. Also I don't like the concept of layers as it doesn't feels flexible enough.
@ -31,8 +43,8 @@ Also this can be a start point for people who wants to start with `emacs` and `e
# Screenshot
![Scala](https://i.imgur.com/C9fVcyM.png)
![ELisp](https://i.imgur.com/fMeimgG.png)
![Scala](http://i.imgur.com/tAL3Gce.png)
![ELisp](http://i.imgur.com/cx7tWpf.png)
# Contribution
@ -44,7 +56,7 @@ If you use this configuration and want to improve just open a issue and/or a pul
- Spacemacs like toggles
- Optimization on package loading. There may be some packages needs to be deferred.
- Generic goto defination like Spacemacs. (I want to be able to use this configuration for multiple programming languages at the same time.)
- ~~Spaceline~~
- Better powerline like [spaceline](https://github.com/TheBB/spaceline).
# License
The license is GPLv3.

6
base/spacelite-base.el

@ -11,22 +11,24 @@
(require 'spacelite-buffers)
(require 'spacelite-windows)
(require 'spacelite-helm)
(require 'spacelite-flycheck)
(require 'spacelite-projectile)
(require 'spacelite-emacs)
(require 'spacelite-git)
(require 'spacelite-osx)
(require 'spacelite-shell)
(require 'spacelite-treemacs)
(defun spacelite/init-base ()
(spacelite/init-evil-base)
(spacelite/init-buffers)
(spacelite/init-windows)
(spacelite/init-helm)
(spacelite/init-flycheck)
(spacelite/init-projectile)
(spacelite/init-emacs)
(spacelite/init-git)
(spacelite/init-shell)
(when (eq system-type 'darwin)
(spacelite/init-osx)))
(spacelite/init-treemacs)
(provide 'spacelite-base)

36
base/spacelite-emacs.el

@ -8,8 +8,6 @@
;;; License: GPLv3
(defun spacelite/init-emacs ()
(setq initial-major-mode config-scratch-mode)
(setq initial-scratch-message nil)
(use-package
restart-emacs)
(use-package
@ -25,17 +23,26 @@
(global-undo-tree-mode)
;; init company mode
(use-package
company
:diminish 'company-mode)
(define-key company-active-map (kbd "C-j") 'company-select-next)
(define-key company-active-map (kbd "C-k") 'company-select-previous)
(define-key company-active-map (kbd "C-l") 'company-complete-selection)
(define-key company-active-map (kbd "<escape>") 'company-abort)
(define-key company-active-map [tab] nil)
(define-key company-active-map (kbd "TAB") nil)
(use-package company
:defer t
:init
(progn
(setq company-idle-delay 0.2
company-minimum-prefix-length 2
company-require-match nil
company-dabbrev-ignore-case nil
company-dabbrev-downcase nil))
:config
(setq company-backends
'( (company-files
company-keywords
company-capf
company-yasnippet)
(company-abbrev company-dabbrev)))
(global-company-mode)
)
;; init whitespace cleanup for prog modes
;; init whitespace cleanup for prog modes
(use-package
whitespace-cleanup-mode
:defer t
@ -65,8 +72,9 @@
:defer t
:init (add-hook 'prog-mode-hook 'highlight-numbers-mode))
;; keep backups
(setq make-backup-files config-keep-backups)
;; recent files
(recentf-mode 1)
(setq-default recent-save-file "~/.emacs.d/recentf")
(spacelite/set-leader-keys "qr" 'spacelite/restart-emacs "qq" 'spacelite/prompt-kill-emacs))

16
base/spacelite-evil.el

@ -11,12 +11,14 @@
(spacelite/init-evil-escape)
(spacelite/init-evil-iedit)
(use-package
evil-surround
evil-surround
:ensure t
:config (global-evil-surround-mode 1)))
(defun spacelite/init-evil-escape ()
(use-package
evil-escape
evil-escape
:ensure t
:diminish 'evil-escape-mode)
(setq-default evil-escape-key-sequence "fd")
(evil-escape-mode)
@ -35,10 +37,10 @@
evil-iedit-state
:defer t
:commands (evil-iedit-state evil-iedit-state/iedit-mode)
:init
(setq iedit-current-symbol-default t iedit-only-at-symbol-boundaries t
iedit-toggle-key-default nil)
(spacelite/set-leader-keys "se" 'evil-iedit-state/iedit-mode)
:config (define-key evil-iedit-state-map (kbd config-leader-key) spacelite-default-map)))
:init (progn
(setq iedit-current-symbol-default t iedit-only-at-symbol-boundaries t
iedit-toggle-key-default nil)
(spacelite/set-leader-keys "se" 'evil-iedit-state/iedit-mode))
:config (define-key evil-iedit-state-map (kbd config-leader-key) spacelite-default-map)))
(provide 'spacelite-evil)

16
base/spacelite-flycheck.el

@ -0,0 +1,16 @@
;; Copyright (c) 2019 David Trudgian
;;
;; Author: David Trudgian
;; URL: https://github.com/dctrud/spacelite
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defun spacelite/init-flycheck ()
(use-package
flycheck
:ensure t
:init (global-flycheck-mode)))
(provide 'spacelite-flycheck)

12
base/spacelite-git.el

@ -12,11 +12,19 @@
magit
:diminish 'auto-revert-mode
:defer t)
(spacelite/set-leader-keys "gb" 'magit-blame "gm" 'magit-dispatch-popup)
(spacelite/set-leader-keys
"gb" 'magit-blame
"gl" 'magit-repolist
"gm" 'magit-dispatch-popup
"gs" `magit-status)
(setq auto-revert-buffer-list-filter 'magit-auto-revert-repository-buffers-p)
(custom-set-variables '(with-editor-emacsclient-executable "/usr/local/bin/emacsclient"))
(use-package
evil-magit
:defer t))
(use-package
git-gutter-fringe
:diminish git-gutter-mode)
(setq-default git-gutter:update-interval 2)
(global-git-gutter-mode +1)
(provide 'spacelite-git)

29
base/spacelite-helm.el

@ -9,10 +9,11 @@
(defun spacelite/init-helm ()
(use-package
helm
helm
:init
(setq helm-ff-file-name-history-use-recentf t)
:diminish 'helm-mode)
(helm-mode 1)
(helm-autoresize-mode 1)
(use-package
ag)
(use-package
@ -20,24 +21,18 @@
:diminish 'helm-mode)
(setq helm-prevent-escaping-from-minibuffer t helm-bookmark-show-location 'bottom
helm-display-header-line nil helm-split-window-in-side-p t helm-always-two-windows t
helm-echo-input-in-header-line t helm-imenu-execute-action-at-once-if-one nil
helm-display-function 'spacelite/display-helm-window)
helm-echo-input-in-header-line t helm-imenu-execute-action-at-once-if-one nil)
; Fix helm to the bottom
(add-to-list 'display-buffer-alist
`(,(rx bos "*helm" (* not-newline) "*" eos)
(display-buffer-in-side-window)
(inhibit-same-window . t)
(window-height . 0.3)))
(spacelite/helm-init-keybindings))
(defvar helm-display-buffer-regexp
`("*.*helm.**" (display-buffer-in-side-window)
(inhibit-same-window . t)
(side . ,'bottom)
(window-width . 0.6)
(window-height . 0.4)))
(defun spacelite/display-helm-window (buffer &optional resume)
"Display the Helm window always at bottom and full width."
(let ((display-buffer-alist (list helm-display-buffer-regexp)))
(helm-default-display-buffer buffer)))
(defun spacelite/helm-init-keybindings ()
(spacelite/set-leader-keys "<SPC>" 'helm-M-x "bb" 'helm-buffers-list "ff" 'helm-find-files "ji" 'helm-imenu "ry" 'helm-show-kill-ring)
(spacelite/set-leader-keys ":" 'helm-M-x "<SPC>" 'helm-M-x "bb" 'helm-buffers-list "ff" 'helm-find-files "fr" 'helm-recentf "ji"
'helm-imenu)
;; tab to provide completation
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
(define-key helm-map (kbd "C-j") 'helm-next-line)

3
base/spacelite-osx.el

@ -12,7 +12,6 @@
(setq mac-command-modifier 'super)
(global-set-key (kbd "s-c") 'evil-yank)
(global-set-key (kbd "s-w") 'evil-delete-buffer)
(global-set-key (kbd "s-v") 'yank)
(when config-enable-ligatures (mac-auto-operator-composition-mode)))
(global-set-key (kbd "s-v") 'yank))
(provide 'spacelite-osx)

79
base/spacelite-shell.el

@ -1,79 +0,0 @@
;; Copyright (c) 2017 Hüseyin Zengin
;;
;; Author: Hüseyin Zengin <hzenginx@gmail.com>
;; URL: https://github.com/hzenginx/spacelite
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defun spacelite/init-shell ()
(spacelite//init-eshell)
(spacelite//init-shellpop))
(defun spacelite//eshell-auto-end ()
(when (and (eq major-mode 'eshell-mode)
;; Not on last line, we might want to edit within it.
(not (eq (line-end-position) (point-max))))
(end-of-buffer)))
(defun spacelite//readonly-eshell ()
(let ((end eshell-last-output-end))
(save-excursion
(goto-char end)
(end-of-line 0)
(setq end (point)))
(when (< eshell-last-output-block-begin end)
(put-text-property eshell-last-output-block-begin end 'read-only "Read-only interactive eshell output"))))
(defun spacelite//make-eshell-readonly ()
(add-hook 'eshell-output-filter-functions 'spacelite//readonly-eshell 'append))
(defun spacelite//protect-eshell-prompt ()
(let ((inhibit-field-text-motion t))
(add-text-properties
(point-at-bol)
(point)
'(rear-nonsticky t
inhibit-line-move-field-capture t
field output
read-only t
front-sticky (field inhibit-line-move-field-capture)))))
(defun spacelite/projectile-shell-pop ()
(interactive)
(let ((default-directory (projectile-project-root)))
(call-interactively 'shell-pop)))
(defun spacelite//init-eshell ()
(use-package eshell :defer t
:init (progn
(setq eshell-cmpl-cycle-completions nil
eshell-buffer-maximum-lines 20000
eshell-history-size 350
eshell-hist-ignoredups t
eshell-buffer-shorthand t
eshell-highlight-prompt nil
eshell-plain-echo-behavior t
eshell-directory-name (concat user-emacs-directory ".cache/eshell/"))))
(use-package eshell-prompt-extras :defer t)
(use-package eshell-z :defer t)
(add-hook 'evil-insert-state-entry-hook 'spacelite//eshell-auto-end)
(add-hook 'eshell-after-prompt-hook 'spacelite//protect-eshell-prompt)
(add-hook 'eshell-mode-hook 'spacelite//make-eshell-readonly))
(defun spacelite//init-shellpop ()
(use-package shell-pop
:defer t
:init
(progn
(setq
shell-pop-window-position 'bottom
shell-pop-window-size 30
shell-pop-term-shell shell-file-name
shell-pop-shell-type (quote ("eshell" "*eshell*" (lambda nil (eshell))))
shell-pop-full-span t)
(spacelite/set-leader-keys "p'" 'spacelite/projectile-shell-pop)
)))
(provide 'spacelite-shell)

61
base/spacelite-treemacs.el

@ -0,0 +1,61 @@
;; Copyright (c) 2017 David Trudgian
;;
;; Author: David Trudgian <dave@trudgian.net>
;; URL: https://github.com/dctrud/spacelite
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defun spacelite/init-treemacs ()
; treemacs needs, hydra, which needs lv
(use-package lv
:ensure t)
(use-package treemacs
:ensure t
:init
(with-eval-after-load 'winum
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
:config
(progn
(setq treemacs-follow-after-init t
treemacs-width 35
treemacs-indentation 2
treemacs-git-integration t
treemacs-collapse-dirs (if (executable-find "python") 3 0)
treemacs-silent-refresh nil
treemacs-change-root-without-asking nil
treemacs-sorting 'alphabetic-desc
treemacs-show-hidden-files t
treemacs-never-persist nil
treemacs-is-never-other-window nil
treemacs-goto-tag-strategy 'refetch-index)
(treemacs-follow-mode t)
(treemacs-filewatch-mode t)
(treemacs-fringe-indicator-mode t))
(pcase (cons (not (null (executable-find "git")))
(not (null (executable-find "python3"))))
(`(t . t)
(treemacs-git-mode 'deferred))
(`(t . _)
(treemacs-git-mode 'simple))))
(spacelite/set-leader-keys "ft" 'treemacs))
(use-package treemacs-evil
:after treemacs evil
:ensure t)
(use-package treemacs-projectile
:after treemacs projectile
:ensure t)
(use-package treemacs-icons-dired
:after treemacs dired
:ensure t
:config (treemacs-icons-dired-mode))
(use-package treemacs-magit
:after treemacs magit
:ensure t)
(provide 'spacelite-treemacs)

10
base/spacelite-windows.el

@ -11,7 +11,9 @@
;; init keys
(spacelite/set-leader-keys "w/" 'spacelite/split-window-right-and-focus "w-"
'spacelite/split-window-below-and-focus "wh" 'evil-window-left "wj" 'evil-window-down "wk"
'evil-window-up "wl" 'evil-window-right "wd" 'delete-window "w TAB" 'spacelite/alternate-window))
'evil-window-up "wl" 'evil-window-right "wd" 'delete-window "w TAB" 'spacelite/alternate-window
"wF" 'make-frame)
(windmove-default-keybindings))
(defun spacelite/alternate-window ()
(interactive)
@ -35,4 +37,10 @@
(split-window-right)
(windmove-right))
(defun spacelite/disable-scroll-bars (frame)
(modify-frame-parameters frame
'((vertical-scroll-bars . nil)
(horizontal-scroll-bars . nil))))
(add-hook 'after-make-frame-functions 'spacelite/disable-scroll-bars)
(provide 'spacelite-windows)

11
core/core-config.el

@ -17,15 +17,10 @@
(defvar config-command-key "SPC")
(defvar config-which-key-delay 0.4)
(defvar config-keep-backups nil)
(defvar config-which-key-delay 0.2)
;; font settings
(defvar config-font-family "Hasklig")
(defvar config-font-height 140)
;; enable only if you are using emacs-mac
(defvar config-enable-ligatures t)
(defvar config-font-family "Fira Mono")
(defvar config-font-height 120)
(provide 'core-config)

95
core/core-makeup.el

@ -8,6 +8,18 @@
;;; License: GPLv3
(defun spacelite/init-makeup ()
;; theme
(use-package
color-theme-sanityinc-tomorrow
:ensure t)
(load-theme 'sanityinc-tomorrow-night t)
;; font
(set-face-attribute 'default nil
:family config-font-family
:height config-font-height)
;; hide column numbers
(setq column-number-mode nil)
@ -29,80 +41,47 @@
(menu-bar-mode -1)
(toggle-scroll-bar -1)
;; font
(set-face-attribute 'default nil
:family config-font-family
:height config-font-height)
(set-frame-parameter nil 'fullscreen 'fullboth)
(spacelite//init-theme)
(spacelite//init-spaceline)
;; window numbers
(use-package winum)
(use-package
winum)
(winum-mode)
(setq winum-auto-setup-mode-line nil)
;; evil-anzu for improving search result rendering
(use-package
evil-anzu
:ensure t
:config (global-anzu-mode +1)
:diminish 'anzu-mode)
;; relative line numbers + centered mode FTW
;; line numbers
(use-package
linum-relative
:diminish 'linum-relative-mode
:init (setq linum-relative-current-symbol "")
:config (linum-relative-global-mode))
(use-package
centered-cursor-mode
:config (global-centered-cursor-mode)
:diminish 'centered-cursor-mode)
linum
:ensure t
:config
(add-hook 'prog-mode-hook 'linum-mode))
;; parenthesis
(show-paren-mode 1)
(use-package
highlight-parentheses
:ensure t
:diminish 'highlight-parentheses-mode
:config (add-hook 'prog-mode-hook #'highlight-parentheses-mode)))
:config
(add-hook 'prog-mode-hook #'highlight-parentheses-mode))
(defun spacelite//init-theme ()
;; rainbow delimiters
(use-package
solarized-theme :config (load-theme 'solarized-dark t))
;; face attributes for helm
(eval-after-load 'helm
(lambda ()
(set-face-attribute
'helm-selection nil :background "#268bd2" :underline nil :foreground "black"))))
(defun spacelite//init-spaceline ()
(setq-default
powerline-height 24
powerline-default-separator 'wave)
;; prevent winum to insert windows numbers to mode line
(setq winum-auto-setup-mode-line nil)
;; prevent anzu to matched numbers to mode line
(setq anzu-cons-mode-line-p nil)
(use-package spaceline :ensure t)
(use-package spaceline-config :ensure spaceline
:config
(spaceline-helm-mode 1)
(spaceline-emacs-theme))
(setq spaceline-highlight-face-func 'spaceline-highlight-face-evil-state)
(spaceline-compile "spacelite" '(
(window-number :face highlight-face)
(buffer-modified)
(line-column)
(anzu :priority 4)
(major-mode)
(process :when active)
(minor-modes :when active)
(version-control :when active)
) '(buffer-position buffer-id :seperator "|"))
(setq-default mode-line-format '("%e" (:eval (spaceline-ml-spacelite)))))
rainbow-delimiters
:ensure t
:diminish 'rainbow-delimiters-mode
:config
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode))
;; dashboard
(use-package dashboard
:ensure t
:config
(dashboard-setup-startup-hook)))
(provide 'core-makeup)

18
core/core-spacelite.el

@ -9,14 +9,15 @@
(require 'core-config)
(require 'core-keybindings)
(require 'core-makeup)
(defun spacelite/init ()
(spacelite/init-use-package)
(spacelite/init-better)
(spacelite/init-diminish)
(spacelite/init-bind-map)
(spacelite/init-evil)
(spacelite/init-which-key)
(require 'core-makeup)
(spacelite/init-makeup))
(defun spacelite/init-diminish ()
@ -24,9 +25,8 @@
diminish))
(defun spacelite/init-use-package ()
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package)))
@ -61,7 +61,8 @@
(spacelite/init-which-key--default-prefixes))
(defun spacelite/init-which-key--default-prefixes ()
(setq prefixes '(("f" "file")
(setq prefixes '(("a" "apps")
("f" "file")
("s" "search")
("b" "buffer")
("p" "projectile")
@ -69,10 +70,13 @@
("q" "quit")
("g" "git")
("j" "jump")
("w" "window")
("n" "note")))
("w" "window")))
(mapc (lambda (x)
(apply #'spacelite/declare-prefix x)) prefixes))
(defun spacelite/init-better ()
(use-package
better-defaults))
(provide 'core-spacelite)

26
init.el

@ -2,24 +2,38 @@
(load-file (concat (file-name-directory user-emacs-directory)
"core/core-load-paths.el"))
(setq use-package-always-ensure t)
(setq gc-cons-threshold most-positive-fixnum)
;; init core first so use-package properly available
(require 'core-spacelite)
(spacelite/init)
(require 'spacelite-base)
(require 'spacelite-langs)
(require 'spacelite-utils)
(spacelite/init)
(spacelite/init-base)
(spacelite/init-langs)
(spacelite/init-utils)
(use-package exec-path-from-shell :defer t :config
(when (memq window-system '(mac ns x))
(exec-path-from-shell-initialize)))
(exec-path-from-shell-initialize)))
(setq custom-file "~/.emacs.d/custom.el")
(unless (file-exists-p custom-file) (write-region "" nil custom-file))
(load custom-file)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(org-agenda-files nil)
'(package-selected-packages
(quote
(neotree powerline git-gutter-fringe google-this markdown-mode deft highlight-parentheses esup centered-cursor-mode linum-relative exec-path-from-shell zerodark-theme which-key evil bind-map use-package)))
'(with-editor-emacsclient-executable "/usr/local/bin/emacsclient"))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)

10
lang/spacelite-langs.el

@ -6,12 +6,14 @@
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(require 'spacelite-scala)
(require 'spacelite-markdown)
(require 'spacelite-lsp)
(require 'spacelite-org)
(defun spacelite/init-langs ()
(spacelite/init-scala)
(spacelite/init-markdown))
(spacelite/init-markdown)
(spacelite/init-lsp)
(spacelite/init-org)
)
(provide 'spacelite-langs)

106
lang/spacelite-lsp.el

@ -0,0 +1,106 @@
;; Copyright (c) 2017 David Trudgian
;;
;; Author: David Trudgian <dave@trudgian.net>
;; URL: https://github.com/dctrud/spacelite
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defun spacelite/init-lsp ()
(use-package lsp-mode
:commands lsp)
(use-package lsp-ui :commands lsp-ui-mode)
(use-package company-lsp :commands company-lsp)
(add-hook `python-mode-hook #'lsp)
(spacelite//lsp-keys-for-mode 'python-mode)
(add-hook `go-mode-hook #'lsp)
(spacelite//lsp-keys-for-mode 'go-mode)
(add-hook `javascript-mode-hook #'lsp)
(spacelite//lsp-keys-for-mode 'javascript-mode)
(add-hook `java-mode-hook #'lsp)
(spacelite//lsp-keys-for-mode 'java-mode)
(add-hook `powershell-mode-hook #'lsp)
(spacelite//lsp-keys-for-mode 'powershell-mode))
(defun spacelite//lsp-keys-for-mode (mode)
(spacelite//lsp-declare-prefixes-for-mode mode)
(spacelite//lsp-leader-keys-for-mode mode)
(spacelite//lsp-bind-simple-navigation-functions "g" mode)
(spacelite//lsp-bind-peek-navigation-functions "G" mode)
)
(defun spacelite//lsp-declare-prefixes-for-mode (mode)
"Define key binding prefixes for the specific MODE."
(spacelite/declare-prefix-for-mode mode "m=" "format")
(spacelite/declare-prefix-for-mode mode "mh" "help")
(spacelite/declare-prefix-for-mode mode "mb" "backend")
(spacelite/declare-prefix-for-mode mode "mr" "refactor")
(spacelite/declare-prefix-for-mode mode "mT" "toggle")
(spacelite/declare-prefix-for-mode mode "mg" "goto")
(spacelite/declare-prefix-for-mode mode "mG" "peek")
(spacelite/declare-prefix-for-mode mode "mF" "folder")
(dolist (prefix '("mg" "mG"))
(spacelite/declare-prefix-for-mode mode (concat prefix "h") "hierarchy")
(spacelite/declare-prefix-for-mode mode (concat prefix "m") "members")))
(defun spacelite//lsp-leader-keys-for-mode (mode)
(spacelite/set-leader-keys-for-major-mode mode
;; format
"=b" #'lsp-format-buffer
"=r" #'lsp-format-region
;; goto
"gt" #'lsp-find-type-definition
"gk" #'spacelite/lsp-avy-goto-word
"gK" #'spacelite/lsp-avy-goto-symbol
"gM" #'lsp-ui-imenu
;; help
"hh" #'lsp-describe-thing-at-point
;; jump
;; backend
"ba" #'lsp-execute-code-action
"bd" #'lsp-describe-session
"br" #'lsp-restart-workspace
"bs" #'lsp-shutdown-workspace
;; refactor
"rr" #'lsp-rename
;; toggles
"Td" #'lsp-ui-doc-mode
"Ts" #'lsp-ui-sideline-mode
"TF" #'spacelite/lsp-ui-doc-func
"TS" #'spacelite/lsp-ui-sideline-symb
"TI" #'spacelite/lsp-ui-sideline-ignore-duplicate
"Tl" #'lsp-lens-mode
;; folders
"Fs" #'lsp-workspace-folders-switch
"Fr" #'lsp-workspace-folders-remove
"Fa" #'lsp-workspace-folders-add))
(defun spacelite//lsp-bind-simple-navigation-functions (prefix-char mode)
(spacelite/set-leader-keys-for-major-mode mode
(concat prefix-char "i") #'lsp-find-implementation
(concat prefix-char "d") #'xref-find-definitions
(concat prefix-char "r") #'xref-find-references
(concat prefix-char "e") #'lsp-treemacs-errors-list
(concat prefix-char "s") #'helm-lsp-workspace-symbol
(concat prefix-char "S") #'helm-lsp-global-workspace-symbol
(concat prefix-char "p") #'xref-pop-marker-stack))
(defun spacelite//lsp-bind-peek-navigation-functions (prefix-char mode)
(spacelite/set-leader-keys-for-major-mode mode
(concat prefix-char "i") #'lsp-ui-peek-find-implementation
(concat prefix-char "d") #'lsp-ui-peek-find-definitions
(concat prefix-char "r") #'lsp-ui-peek-find-references
(concat prefix-char "s") #'lsp-ui-peek-find-workspace-symbol
(concat prefix-char "p") #'lsp-ui-peek-jump-backward
(concat prefix-char "e") #'lsp-ui-flycheck-list
(concat prefix-char "n") #'lsp-ui-peek-jump-forward))
(provide 'spacelite-lsp)

4
lang/spacelite-markdown.el

@ -12,8 +12,8 @@
:defer t
:commands (markdown-mode gfm-mode)
:mode (("README\\.md\\'" . gfm-mode)
("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode))
("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode))
:init (setq markdown-command "multimarkdown"))
)

290
lang/spacelite-org.el

@ -0,0 +1,290 @@
;; Copyright (c) 2017 David Trudgian
;;
;; Author: David Trudgian <dave@trudgian.net>
;; URL: https://github.com/dctrud/spacelite
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defun spacelite/init-org ()
(use-package evil-org
:ensure t
:after org
:config
(add-hook 'org-mode-hook 'evil-org-mode)
(add-hook 'evil-org-mode-hook
(lambda ()
(evil-org-set-key-theme '(navigation)))))
(use-package org-bullets
:ensure t
:after org
:config (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
;; Org directories
(setq org-agenda-files
'("~/org/"))
;; Default show all of the things
(setq org-startup-folded nil)
;; Exports don't have TOC or numbering by default
(setq org-export-with-toc nil)
(setq org-export-with-creator nil)
(setq org-export-with-section-numbers nil)
(setq org-export-with-sub-superscripts nil)
;; Indent by default
(setq org-startup-indented t)
;;open agenda in current window
;;(setq org-agenda-window-setup (quote current-window))
;;warn me of any deadlines in next 7 days
(setq org-deadline-warning-days 7)
;;show me tasks scheduled or due in next fortnight
(setq org-agenda-span (quote fortnight))
;; Agenda Settings
(defun dct/org-skip-subtree-if-priority (priority)
"Skip an agenda subtree if it has a priority of PRIORITY. PRIORITY may be one of the characters ?A, ?B, or ?C."
(let ((subtree-end (save-excursion (org-end-of-subtree t)))
(pri-value (* 1000 (- org-lowest-priority priority)))
(pri-current (org-get-priority (thing-at-point 'line t))))
(if (= pri-value pri-current)
subtree-end
nil)))
(setq org-agenda-custom-commands
'(("c" "Simple agenda view"
((tags "PRIORITY=\"A\""
((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
(org-agenda-overriding-header "High-priority unfinished tasks:")))
(agenda "")
(alltodo ""
((org-agenda-skip-function
'(or (dct/org-skip-subtree-if-priority ?A)
(org-agenda-skip-if nil '(scheduled deadline))))))))))
;; Org capture setup
(setq org-default-notes-file "~/org/inbox.org")
(setq org-refile-targets '((nil :maxlevel . 6)
(org-agenda-files :maxlevel . 6)))
(setq org-outline-path-complete-in-steps nil) ; Refile in a single go
(setq org-refile-use-outline-path t) ; Show full paths for refiling
(setq org-agenda-default-appointment-duration 60)
;; LaTeX Export
(with-eval-after-load 'ox-latex
(setq org-export-latex-listings t)
(add-to-list 'org-latex-packages-alist '("" "listings"))
(add-to-list 'org-latex-packages-alist '("" "color"))
(add-to-list 'org-latex-packages-alist '("" "fullpage"))
(add-to-list 'org-latex-packages-alist '("" "libertine")))
;; Use org attachements for org-download
(setq org-download-method 'attach)
;; Screenshot on Mac
(if (equal system-type 'darwin)
(setq org-download-screenshot-method "/usr/sbin/screencapture -i %s"))
;;
;; Paragraph filling
;;
(add-hook 'org-mode-hook 'turn-on-auto-fill)
(add-hook 'org-mode-hook
(lambda() (set-fill-column 80)))
(dolist (prefix '(
("mb" . "babel")
("mC" . "clocks")
("md" . "dates")
("me" . "export")
("mf" . "feeds")
("mi" . "insert")
("miD" . "download")
("mm" . "more")
("ms" . "trees/subtrees")
("mT" . "toggles")
("mt" . "tables")
("mtd" . "delete")
("mti" . "insert")
("mtt" . "toggle")
("mx" . "text")
))
(spacelite/declare-prefix-for-mode 'org-mode (car prefix) (cdr prefix)))
(spacelite/set-leader-keys-for-major-mode 'org-mode
"'" 'org-edit-special
"c" 'org-capture
;; Clock
;; These keybindings should match those under the "aoC" prefix (below)
"Cc" 'org-clock-cancel
"Cd" 'org-clock-display
"Ce" 'org-evaluate-time-range
"Cg" 'org-clock-goto
"Ci" 'org-clock-in
"CI" 'org-clock-in-last
"Cj" 'spacelite/org-clock-jump-to-current-clock
"Co" 'org-clock-out
"CR" 'org-clock-report
"Cr" 'org-resolve-clocks
"dd" 'org-deadline
"ds" 'org-schedule
"dt" 'org-time-stamp
"dT" 'org-time-stamp-inactive
"ee" 'org-export-dispatch
"fi" 'org-feed-goto-inbox
"fu" 'org-feed-update-all
"a" 'org-agenda
"p" 'org-priority
"Tc" 'org-toggle-checkbox
"Te" 'org-toggle-pretty-entities
"Ti" 'org-toggle-inline-images
"Tl" 'org-toggle-link-display
"Tt" 'org-show-todo-tree
"TT" 'org-todo
"TV" 'space-doc-mode
"Tx" 'org-toggle-latex-fragment
;; More cycling options (timestamps, headlines, items, properties)
"L" 'org-shiftright
"H" 'org-shiftleft
"J" 'org-shiftdown
"K" 'org-shiftup
;; Change between TODO sets
"C-S-l" 'org-shiftcontrolright
"C-S-h" 'org-shiftcontrolleft
"C-S-j" 'org-shiftcontroldown
"C-S-k" 'org-shiftcontrolup
;; Subtree editing
"sa" 'org-toggle-archive-tag
"sA" 'org-archive-subtree
"sb" 'org-tree-to-indirect-buffer
"sh" 'org-promote-subtree
"sj" 'org-move-subtree-down
"sk" 'org-move-subtree-up
"sl" 'org-demote-subtree
"sn" 'org-narrow-to-subtree
"sN" 'widen
"sr" 'org-refile
"ss" 'org-sparse-tree
"sS" 'org-sort
;; tables
"ta" 'org-table-align
"tb" 'org-table-blank-field
"tc" 'org-table-convert
"tdc" 'org-table-delete-column
"tdr" 'org-table-kill-row
"te" 'org-table-eval-formula
"tE" 'org-table-export
"th" 'org-table-previous-field
"tH" 'org-table-move-column-left
"tic" 'org-table-insert-column
"tih" 'org-table-insert-hline
"tiH" 'org-table-hline-and-move
"tir" 'org-table-insert-row
"tI" 'org-table-import
"tj" 'org-table-next-row
"tJ" 'org-table-move-row-down
"tK" 'org-table-move-row-up
"tl" 'org-table-next-field
"tL" 'org-table-move-column-right
"tn" 'org-table-create
"tN" 'org-table-create-with-table.el
"tr" 'org-table-recalculate
"ts" 'org-table-sort-lines
"ttf" 'org-table-toggle-formula-debugger
"tto" 'org-table-toggle-coordinate-overlays
"tw" 'org-table-wrap-region
;; Source blocks / org-babel
"bp" 'org-babel-previous-src-block
"bn" 'org-babel-next-src-block
"be" 'org-babel-execute-maybe
"bo" 'org-babel-open-src-block-result
"bv" 'org-babel-expand-src-block
"bu" 'org-babel-goto-src-block-head
"bg" 'org-babel-goto-named-src-block
"br" 'org-babel-goto-named-result
"bb" 'org-babel-execute-buffer
"bs" 'org-babel-execute-subtree
"bd" 'org-babel-demarcate-block
"bt" 'org-babel-tangle
"bf" 'org-babel-tangle-file
"bc" 'org-babel-check-src-block
"bj" 'org-babel-insert-header-arg
"bl" 'org-babel-load-in-session
"bi" 'org-babel-lob-ingest
"bI" 'org-babel-view-src-block-info
"bz" 'org-babel-switch-to-session
"bZ" 'org-babel-switch-to-session-with-code
"ba" 'org-babel-sha1-hash
"bx" 'org-babel-do-key-sequence-in-edit-buffer
"b." 'spacelite/org-babel-transient-state/body
;; Multi-purpose keys
"," 'org-ctrl-c-ctrl-c
"*" 'org-ctrl-c-star
"-" 'org-ctrl-c-minus
"#" 'org-update-statistics-cookies
"RET" 'org-ctrl-c-ret
"M-RET" 'org-meta-return
;; attachments
"A" 'org-attach
;; insertion
"ib" 'org-insert-structure-template
"id" 'org-insert-drawer
"ie" 'org-set-effort
"if" 'org-footnote-new
"ih" 'org-insert-heading
"iH" 'org-insert-heading-after-current
"iK" 'spacelite/insert-keybinding-org
"il" 'org-insert-link
"in" 'org-add-note
"ip" 'org-set-property
"is" 'org-insert-subheading
"it" 'org-set-tags-command
"xo" 'org-open-at-point)
;; Add global evil-leader mappings. Used to access org-agenda
;; functionalities – and a few others commands – from any other mode.
(spacelite/declare-prefix "ao" "org")
(spacelite/declare-prefix "aof" "feeds")
(spacelite/declare-prefix "aoC" "clock")
(spacelite/set-leader-keys
;; org-agenda
"ao#" 'org-agenda-list-stuck-projects
"ao/" 'org-occur-in-agenda-files
"aoa" 'org-agenda-list
"aoc" 'org-capture
"aoe" 'org-store-agenda-views
"aofi" 'org-feed-goto-inbox
"aofu" 'org-feed-update-all
;; Clock
;; These keybindings should match those under the "mC" prefix (above)
"aoCc" 'org-clock-cancel
"aoCg" 'org-clock-goto
"aoCi" 'org-clock-in
"aoCI" 'org-clock-in-last
"aoCj" 'spacelite/org-clock-jump-to-current-clock
"aoCo" 'org-clock-out
"aoCr" 'org-resolve-clocks
"aol" 'org-store-link
"aom" 'org-tags-view
"aoo" 'org-agenda
"aos" 'org-search-view
"aot" 'org-todo-list)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(define-key global-map "\C-cc" 'org-capture))
(provide 'spacelite-org)

58
lang/spacelite-scala.el

@ -1,58 +0,0 @@
;; Copyright (c) 2017 Hüseyin Zengin
;;
;; Author: Hüseyin Zengin <hzenginx@gmail.com>
;; URL: https://github.com/hzenginx/spacelite
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defun spacelite/init-scala ()
(use-package
ensime
:defer t
:diminish 'yas-minor-mode)
(use-package
sbt-mode
:defer t)
(use-package
scala-mode
:defer t)
(setq ensime-startup-notification 'nil)
(setq ensime-startup-snapshot-notification 'nil)
(setq ensime-use-helm t)
;; init shortcut prefixes
(dolist (prefix '(("mb" . "build")
("mc" . "check")
("md" . "debug")
("mD" . "daemon")
("me" . "errors")
("mg" . "goto")
("mh" . "docs")
("mi" . "inspect")
("mr" . "refactor")
("mt" . "test")
("ms" . "repl")
("my" . "yank")))
(spacelite/declare-prefix-for-mode 'scala-mode (car prefix)
(cdr prefix)))
;; go start of code when a scala code is opened
(add-hook 'scala-mode-hook (lambda ()
(scala-mode:goto-start-of-code)))
;; override goto definition with ensime
(evil-define-key 'normal scala-mode-map (kbd "gd") 'ensime-edit-definition)
;; init keybindings
(spacelite/set-leader-keys-for-major-mode 'scala-mode "Ds" 'ensime "gi" 'ensime-goto-impl "gt"
'ensime-goto-test "br" 'ensime-sbt-do-run "ct" 'ensime-typecheck-current-buffer "el"
'ensime-show-all-errors-and-warnings "ee" 'ensime-print-errors-at-point "gp"
'ensime-pop-find-definition-stack "hh" 'ensime-show-doc-for-symbol-at-point "hT"
'ensime-type-at-point-full-name "ht" 'ensime-type-at-point "hu"
'ensime-show-uses-of-symbol-at-point "ra" 'ensime-refactor-add-type-annotation "rf"
'ensime-format-source "rr" 'ensime-refactor-diff-rename "rt" 'ensime-import-type-at-point "gg"
'ensime-edit-definition "gG" 'ensime-edit-definition-other-window "bc" 'ensime-sbt-do-compile))
(provide 'spacelite-scala)

24
utils/spacelite-utils.el

@ -1,24 +1,2 @@
(defun spacelite/init-utils ()
(spacelite/init-deft)
(spacelite/init-google-this))
(defun spacelite/init-deft ()
(use-package deft
:defer t
:commands (deft-new-file-named)
:init
(setq deft-default-extension "md")
(spacelite/set-leader-keys
"n C-n" 'deft-new-file-named
"nN" 'deft-new-file
"nn" 'deft-find-file)))
(defun spacelite/init-google-this ()
(use-package google-this
:config (google-this-mode 1)
:diminish 'google-this-mode
:init (spacelite/set-leader-keys "sg" 'google-this-mode-submap)))
(defun spacelite/init-utils ())
(provide 'spacelite-utils)
Loading…
Cancel
Save