commit 786aabede63876e6bf2751f3cd04d8c33d388496 parent 803836d4bb6fa437d4fc404c0ff78aa0f57849c8 Author: Yohanes Bandung Bondowoso <hi@ybbond.dev> Date: Sat, 22 Aug 2020 20:37:37 +0700 update doom config, and add hammerspoon config Diffstat:
| M | .doom.d/+org.el | | | 1 | - |
| M | .doom.d/+plugins.el | | | 24 | ++++++++++-------------- |
| M | .doom.d/config.el | | | 29 | ++++++++--------------------- |
| M | .doom.d/custom.el | | | 4 | +++- |
| M | .doom.d/init.el | | | 5 | +++++ |
| A | .hammerspoon/init.lua | | | 177 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
6 files changed, 203 insertions(+), 37 deletions(-)
diff --git a/.doom.d/+org.el b/.doom.d/+org.el @@ -119,7 +119,6 @@ :n "M-k" #'orge-metaup) :config (setq org-directory org_notes - org-id-link-to-org-use-id t org-ellipsis " ▼ " org-id-link-to-org-use-id nil org-pretty-entities t diff --git a/.doom.d/+plugins.el b/.doom.d/+plugins.el @@ -14,24 +14,14 @@ (general-setq evil-disable-insert-state-bindings t) :general ([remap evil-emacs-state] 'evil-normal-state) - :config - (setq evil-move-cursor-back nil) - (setq evil-esc-delay 1) - (setq evil-kill-on-visual-paste nil)) + (general-imap "C-f" 'delete-forward-char)) ;; replaced by evil-better-visual-line -;; (setq evil-respect-visual-line-mode t) ;; (setq evil-want-minibuffer t) ;; Better visual line -(use-package! evil-better-visual-line - :config - (evil-better-visual-line-on)) - -;; Ivy -(map! :after ivy - :map ivy-minibuffer-map - "S-SPC" nil - "C-SPC" 'ivy-restrict-to-matches) +;; (use-package! evil-better-visual-line +;; :config +;; (evil-better-visual-line-on)) ;; Snipe (after! evil-snipe @@ -41,6 +31,12 @@ (setq evil-snipe-repeat-keys t) (setq evil-snipe-repeat-scope 'whole-buffer)) +;; Ivy +(map! :after ivy + :map ivy-minibuffer-map + "S-SPC" nil + "C-SPC" 'ivy-restrict-to-matches) + ;; Dired (after! dired ;; (setq dired-listing-switches "-aBhl --group-directories-first" diff --git a/.doom.d/config.el b/.doom.d/config.el @@ -47,15 +47,6 @@ (setq savehist-mode -1) -;; (define-key! evil-normal-state-map (kbd "M-S-l") 'enlarge-window-horizontally) -;; (define-key! evil-normal-state-map (kbd "M-S-h") 'shrink-window-horizontally) -(global-set-key (kbd "s-l") 'org-roam-find-file) -(global-set-key (kbd "s-b") 'ivy-switch-buffer) -(global-set-key (kbd "s-K") 'kill-buffer) - -(load! "+plugins") -(load! "+org") - ;; Here are some additional functions/macros that could help you configure Doom: ;; ;; - `load!' for loading external *.el files relative to this one @@ -73,15 +64,11 @@ ;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how ;; they are implemented. -(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. - '(package-selected-packages (quote (org-roam-server evil-better-visual-line)))) -(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. - ) +;; (define-key! evil-normal-state-map (kbd "M-S-l") 'enlarge-window-horizontally) +;; (define-key! evil-normal-state-map (kbd "M-S-h") 'shrink-window-horizontally) +(global-set-key (kbd "s-l") 'org-roam-find-file) +(global-set-key (kbd "s-b") 'ivy-switch-buffer) +(global-set-key (kbd "s-K") 'kill-buffer) + +(load! "+plugins") +(load! "+org") diff --git a/.doom.d/custom.el b/.doom.d/custom.el @@ -3,7 +3,9 @@ ;; 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) + '(org-agenda-files + (quote + ("/Users/yohanesbandung/Library/Mobile Documents/iCloud~com~appsonthemove~beorg/Documents/org/journals/2020-08-22.org"))) '(package-selected-packages (quote (org-roam-server evil-better-visual-line)))) (custom-set-faces ;; custom-set-faces was added by Custom. diff --git a/.doom.d/init.el b/.doom.d/init.el @@ -177,3 +177,8 @@ :config ;;literate (default +bindings +smartparens)) + + (setq evil-move-cursor-back nil) + (setq evil-esc-delay 1) + (setq evil-respect-visual-line-mode t) + (setq evil-kill-on-visual-paste nil) diff --git a/.hammerspoon/init.lua b/.hammerspoon/init.lua @@ -0,0 +1,177 @@ +-- option + ctrl + h to make active window half to the left +hs.hotkey.bind({"alt", "ctrl"}, "H", function() + local win = hs.window.focusedWindow() + local f = win:frame() + local screen = win:screen() + local max = screen:frame() + + f.x = max.x + f.y = max.y + f.w = max.w / 2 + f.h = max.h + win:setFrame(f) +end) + +-- option + ctrl + l to make active window half to the right +hs.hotkey.bind({"alt", "ctrl"}, "L", function() + local win = hs.window.focusedWindow() + local f = win:frame() + local screen = win:screen() + local max = screen:frame() + + f.x = max.x + (max.w / 2) + f.y = max.y + f.w = max.w / 2 + f.h = max.h + win:setFrame(f) +end) + +-- option + ctrl + j to make active window two-third to the left +hs.hotkey.bind({"alt", "ctrl"}, "J", function() + local win = hs.window.focusedWindow() + local f = win:frame() + local screen = win:screen() + local max = screen:frame() + + f.x = max.x + f.y = max.y + f.w = max.w * (2/3) + f.h = max.h + win:setFrame(f) +end) + +-- option + ctrl + k to make active window two-third to the right +hs.hotkey.bind({"alt", "ctrl"}, "K", function() + local win = hs.window.focusedWindow() + local f = win:frame() + local screen = win:screen() + local max = screen:frame() + + f.x = max.x + (max.w * (1/3)) + f.y = max.y + f.w = max.w * (2/3) + f.h = max.h + win:setFrame(f) +end) + +-- option + ctrl + i to make active window one-third to the right +hs.hotkey.bind({"alt", "ctrl"}, "I", function() + local win = hs.window.focusedWindow() + local f = win:frame() + local screen = win:screen() + local max = screen:frame() + + f.x = max.x + (max.w * (2/3)) + f.y = max.y + f.w = max.w * (1/3) + f.h = max.h + win:setFrame(f) +end) + +-- option + ctrl + u to make active window one-third to the left +hs.hotkey.bind({"alt", "ctrl"}, "U", function() + local win = hs.window.focusedWindow() + local f = win:frame() + local screen = win:screen() + local max = screen:frame() + + f.x = max.x + f.y = max.y + f.w = max.w * (1/3) + f.h = max.h + win:setFrame(f) +end) + +-- option + ctrl + s to make active window three-fourth to the left +hs.hotkey.bind({"alt", "ctrl"}, "S", function() + local win = hs.window.focusedWindow() + local f = win:frame() + local screen = win:screen() + local max = screen:frame() + + f.x = max.x + f.y = max.y + f.w = max.w * (3/4) + f.h = max.h + win:setFrame(f) +end) + +-- option + ctrl + d to make active window aligned right +hs.hotkey.bind({"alt", "ctrl"}, "D", function() + local win = hs.window.focusedWindow() + local f = win:frame() + local screen = win:screen() + local max = screen:frame() + + f.x = max.x + max.w - f.w + f.y = max.y + win:setFrame(f) +end) + +-- option + ctrl + c to make active window centered +hs.hotkey.bind({"alt", "ctrl"}, "C", function() + local win = hs.window.focusedWindow() + local f = win:frame() + local screen = win:screen() + local max = screen:frame() + + -- f.x = max.x + (max.w * (1/6)) + -- f.y = max.y + (max.h * (1/6)) + -- f.w = max.w * (2/3) + -- f.h = max.h * (2/3) + -- f.x = max.x + (max.w * (1/8)) + -- f.y = max.y + (max.h * (1/8)) + -- f.w = max.w * (3/4) + -- f.h = max.h * (3/4) + f.x = max.x + (max.w * (3/16)) + f.y = max.y + (max.h * (2/16)) + f.w = max.w * (5/8) + f.h = max.h * (6/8) + win:setFrame(f) +end) + +-- option + ctrl + enter to make active window maximized +hs.hotkey.bind({"alt", "ctrl"}, "Return", function() + local win = hs.window.focusedWindow() + local f = win:frame() + local screen = win:screen() + local max = screen:frame() + + f.x = max.x + f.y = max.y + f.w = max.w + f.h = max.h + win:setFrame(f) +end) + +-- option + ctrl + N to make active window centered tall +hs.hotkey.bind({"alt", "ctrl"}, "N", function() + local win = hs.window.focusedWindow() + local f = win:frame() + local screen = win:screen() + local max = screen:frame() + + f.x = max.x + (max.w * (4/16)) + f.w = max.w * (4/8) + f.y = max.y + f.h = max.h + win:setFrame(f) +end) + +-- layoutWatcher = hs.eventtap.new({hs.eventtap.event.types.flagsChanged}, function(e) +-- local flags = e:getFlags() +-- if flags.cmd and not (flags.alt or flags.shift or flags.ctrl or flags.fn) then +-- local keyCode = e:getKeyCode() +-- if keyCode == 0x37 then +-- hs.alert.show("left cmd key") +-- elseif keyCode == 0x36 then +-- hs.alert.show("right cmd key") +-- end +-- end +-- end):start() + +-- option + ctrl + r to reload config +hs.hotkey.bind({"alt", "ctrl"}, "R", function() + hs.reload() +end) +hs.alert.show("Config loaded")