Skip to content

Commit

Permalink
some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
koonwen committed Jul 19, 2024
1 parent db99c40 commit d63f7bc
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 107 deletions.
6 changes: 3 additions & 3 deletions core/prelude-ui.el
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@
;; add to hook when running as a daemon as a workaround for a
;; which-key bug
;; https://github.com/justbur/emacs-which-key/issues/306
(if (daemonp)
(add-hook 'server-after-make-frame-hook 'which-key-mode)
(which-key-mode +1))
;; (if (daemonp)
;; (add-hook 'server-after-make-frame-hook 'which-key-mode)
;; (which-key-mode +1))

(provide 'prelude-ui)
;;; prelude-ui.el ends here
144 changes: 65 additions & 79 deletions personal/0_general_config.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@

(prelude-require-packages
'(beacon
multiple-cursors
twilight-bright-theme
projectile-ripgrep
helm-swoop
goto-last-change
treemacs treemacs-projectile treemacs-magit))
helm-swoop))

;; Default Zoom
(set-face-attribute 'default (selected-frame) :height 150)

;; Sane Defaults
(setq backup-directory-alist '(("." . "~/.emacs.d/backups")))
(setq auto-save-file-name-transforms '((".*" "~/.emacs.d/auto-save-list/" t)))

(setq delete-old-versions -1)
(setq version-control t)
(setq vc-make-backup-files t)

(blink-cursor-mode t)
(setq prelude-super-keybindings nil)
(setq crux-shell "/bin/fish")
(setq crux-shell "/bin/bash")

(defun vsplit-other-window ()
"Splits the window vertically and switches to that window."
Expand All @@ -28,6 +33,16 @@
(split-window-horizontally)
(other-window 1 nil))

;; Highlight line on point.
(global-hl-line-mode t)

;; Show line numbers on left column
(global-display-line-numbers-mode t)

;; Make sure use-package always downloads the package first
(require 'use-package)
(setq use-package-always-ensure t)

;; Themes
(use-package twilight-bright-theme)
(use-package flatland-theme)
Expand All @@ -42,13 +57,13 @@
(disable-theme 'flatland)))

;; Keybindings
(bind-key "C-c C-\\" #'toggle-themes)
(bind-key "C-c C-\\" #'toggle-themes)
(bind-key "<end>" 'scroll-lock-mode)
(bind-key "C-x 2" #'vsplit-other-window)
(bind-key "C-x 3" #'hsplit-other-window)
(bind-key "M-<right>" #'er/expand-region)
(bind-key "M-<left>" #'er/contract-region)
(bind-key "M-S-C-<left>" #'shrink-window-horizontally)
(bind-key "M-S-C-<right>" #'enlarge-window-horizontally)
(bind-key "M-S-C-<down>" #'shrink-window)
(bind-key "M-S-C-<up>" #'enlarge-window)
(bind-key "<end>" 'scroll-lock-mode)

;; Automatic reloading of buffers
(global-auto-revert-mode t)
Expand Down Expand Up @@ -76,90 +91,61 @@
(global-ligature-mode 't))
)

(blink-cursor-mode t)
;; Background modes

;; Start activity-watch-mode
(global-activity-watch-mode t)
(use-package undo-tree
:delight
:config
(global-undo-tree-mode)
(setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/backups/undo-tree"))))

(use-package beacon
:config (beacon-mode 1)
:bind ("C-*" . beacon-blink)
:delight
:config (beacon-mode t)
:custom
(beacon-blink-when-focused 1)
(beacon-color "#f6aa11"))

(global-set-key [remap crux-smart-open-line] 'ace-window)
(use-package ace-window
:bind ("C-M-o" . ace-swap-window))

(use-package projectile
:delight
:bind
([remap overwrite-mode] . projectile-commander)
:custom (projectile-indexing-method 'hybrid))
(use-package projectile-ripgrep)


(use-package helm-swoop
:delight
:bind
("M-s" . helm-swoop)
("M-S" . helm-multi-swoop-projectile)
("M-l" . helm-swoop-back-to-last-point))

;; (use-package helm-gtags
;; :hook (prog-mode helm-gtags-mode))
(use-package helm
:delight)

(use-package treemacs
:bind
("<home>" . treemacs))

(use-package goto-last-change)
(global-set-key "\C-x\C-\\" 'goto-last-change)

(use-package multiple-cursors)
(global-set-key (kbd "C-c m c") 'mc/edit-lines)
(global-set-key (kbd "M-<mouse-1>") 'mc/add-cursor-on-click)

;; https://ebzzry.com/en/emacs-pairs/
;; (bind-keys
;; :map smartparens-mode-map
;; ("C-M-a" . sp-beginning-of-sexp)
;; ("C-M-e" . sp-end-of-sexp)

;; ("C-<down>" . sp-down-sexp)
;; ("C-<up>" . sp-up-sexp)
;; ("M-<down>" . sp-backward-down-sexp)
;; ("M-<up>" . sp-backward-up-sexp)

;; ("C-M-f" . sp-forward-sexp)
;; ("C-M-b" . sp-backward-sexp)

;; ("C-M-n" . sp-next-sexp)
;; ("C-M-p" . sp-previous-sexp)

;; ("C-S-f" . sp-forward-symbol)
;; ("C-S-b" . sp-backward-symbol)

;; ("C-<right>" . sp-forward-slurp-sexp)
;; ("M-<right>" . sp-forward-barf-sexp)
;; ("C-<left>" . sp-backward-slurp-sexp)
;; ("M-<left>" . sp-backward-barf-sexp)

;; ("C-M-t" . sp-transpose-sexp)
;; ("C-M-k" . sp-kill-sexp)
;; ("C-k" . sp-kill-hybrid-sexp)
;; ("M-k" . sp-backward-kill-sexp)
;; ("C-M-w" . sp-copy-sexp)
;; ("C-M-d" . delete-sexp)

;; ("M-<backspace>" . backward-kill-word)
;; ("C-<backspace>" . sp-backward-kill-word)
;; ([remap sp-backward-kill-word] . backward-kill-word)

;; ("M-[" . sp-backward-unwrap-sexp)
;; ("M-]" . sp-unwrap-sexp)

;; ("C-x C-t" . sp-transpose-hybrid-sexp)

;; ("C-c (" . wrap-with-parens)
;; ("C-c [" . wrap-with-brackets)
;; ("C-c {" . wrap-with-braces)
;; ("C-c '" . wrap-with-single-quotes)
;; ("C-c \"" . wrap-with-double-quotes)
;; ("C-c _" . wrap-with-underscores)
;; ("C-c `" . wrap-with-back-quotes))
(use-package move-text
:config (move-text-default-bindings))

(use-package iedit
:bind*
("C-c e" . iedit-mode)
(:map iedit-mode-keymap
("M-h" . 'iedit-show/hide-context-lines))
(:map iedit-mode-occurrence-keymap
("M-F" . 'iedit-restrict-function)))

(use-package expand-region
:bind ("M-=" . er/expand-region))

(use-package paren
;; "Highlighting for parens"
:custom
(show-paren-delay 0.3)
(blink-matching-paren t)
(blink-matching-paren-on-screen t)
(show-paren-style 'expression)
(blink-matching-paren-dont-ignore-comments t)
:config (show-paren-mode))
33 changes: 17 additions & 16 deletions personal/9_c_config.el
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
(setq read-process-output-max (* 1024 1024)) ;; 1mb
;; sample `helm' configuration use https://github.com/emacs-helm/helm/ for details
(use-package helm-xref)

(use-package lsp-mode
:ensure t
:defer t
:hook (lsp-mode . (lambda ()
(let ((lsp-keymap-prefix "C-c l"))
(lsp-enable-which-key-integration))))
:init
(setq lsp-keep-workspace-alive nil
lsp-signature-doc-lines 5
lsp-idle-delay 0.5
lsp-prefer-capf t
lsp-client-packages nil)
:config
(define-key lsp-mode-map (kbd "C-c l") lsp-command-map))
;; if you want to change prefix for lsp-mode keybindings.
(helm-descbinds-mode -1)
(which-key-mode)
(add-hook 'c-mode-hook 'lsp)
(add-hook 'c++-mode-hook 'lsp)
(use-package yasnippet
:config (yas-global-mode t))

(setq gc-cons-threshold (* 100 1024 1024)
read-process-output-max (* 1024 1024)
treemacs-space-between-root-nodes nil
company-idle-delay 0.0
company-minimum-prefix-length 1
lsp-idle-delay 0.1) ;; clangd is fast

(use-package lsp-mode
:bind-keymap ("C-c l" . lsp-command-map))
23 changes: 14 additions & 9 deletions personal/9_ocaml_config.el
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
(prelude-require-packages
'(utop
opam-switch-mode
ocp-indent ocamlformat
dune dune-format
merlin merlin-company merlin-eldoc merlin-iedit))

;; (use-package ocp-index
;; :config (unbind-key "C-c C-t" ocp-index-keymap)
;; :bind (:map ocp-index-keymap
;; ("C-c t" . ocp-index-print-info-at-point)))

(use-package merlin
:bind (:map merlin-mode-map
("C-c m d" . merlin-document)
("M-." . merlin-locate)
("M-," . merlin-pop-stack))
:config (setq merlin-error-after-save t)
:custom
(merlin-error-after-save t)
(merlin-completion-with-doc t)
(merlin-locate-preference 1)
(merlin-type-after-locate 1))

(use-package merlin-eldoc
:after merlin
:ensure t
:custom
(eldoc-echo-area-use-multiline-p t) ; use multiple lines when necessary
(merlin-eldoc-max-lines 8) ; but not more than 8
(merlin-eldoc-type-verbosity 'min) ; don't display verbose types
(merlin-eldoc-function-arguments nil) ; don't show function arguments
(merlin-eldoc-doc nil) ; don't show the documentation
:bind (:map merlin-mode-map
("C-c m p" . merlin-eldoc-jump-to-prev-occurrence)
("C-c m n" . merlin-eldoc-jump-to-next-occurrence))
:hook ((tuareg-mode reason-mode) . merlin-eldoc-setup))

(use-package ocamlformat
:bind ("<backtab>" . ocamlformat))

(use-package dune-format
:hook (dune-mode . dune-format-on-save-mode))

(use-package dune-watch)

0 comments on commit d63f7bc

Please sign in to comment.