diff --git a/early-init.el b/early-init.el new file mode 100644 index 0000000..27c944b --- /dev/null +++ b/early-init.el @@ -0,0 +1,24 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Basic settings for quick startup and convenience +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Startup speed, annoyance suppression +(setq bedrock--initial-gc-threshold gc-cons-threshold) +(setq gc-cons-threshold 10000000) +(setq byte-compile-warnings '(not obsolete)) +(setq warning-suppress-log-types '((comp) (bytecomp))) +(setq native-comp-async-report-warnings-errors 'silent) + +;; Silence stupid startup message +(advice-add #'display-startup-echo-area-message :override #'ignore) + +;; Tell use-package to install if missing by default +;; Use `:ensure nil' in packages you *don't* want to install +(setq use-package-always-ensure t) + +;; Setting *-resize-pixelwise to `t' lets frames/windows resize +;; smoothly at sub-character increments +(setq frame-resize-pixelwise t) +; (setq window-resize-pixelwise t) diff --git a/init.el b/init.el index 4b5d00b..d7bdacb 100644 --- a/init.el +++ b/init.el @@ -27,12 +27,12 @@ (keymap-set completion-in-region-mode-map "RET" #'minibuffer-choose-completion) (keymap-set completion-in-region-mode-map "C-p" #'minibuffer-previous-completion) (keymap-set completion-in-region-mode-map "C-n" #'minibuffer-next-completion)) -(global-set-key (kbd "C-c i") #'complete-symbol) +(global-set-key (kbd "C-c n") #'complete-symbol) (setq completions-max-height 10) ;; cap *Completions* window at 10 lines ;; --- indentation: spaces everywhere, default 4, ts/html = 3 --- ;; eglot-format reads tab-width (tabSize) and indent-tabs-mode (insertSpaces) -(setq-default indent-tabs-mode nil +(setq-default d nil tab-width 4) ;; per-language autoindent offsets (default 4) @@ -84,41 +84,17 @@ ;; (use-package markdown-ts-mode) -(use-package jumpc - :config - (jumpc) - (global-set-key (kbd "C-c o") 'jumpc-jump-backward) - (global-set-key (kbd "C-c i") 'jumpc-jump-forward)) +(setq evil-default-state 'emacs) +(setq evil-toggle-key "C-;") +(use-package evil) +(evil-mode 1) (use-package magit) (setq magit-status-show-untracked-files 'all) (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode)) (add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-ts-mode)) - -(defun my/angular-language-server-command (_interactive project) - "Build an Angular language server command for PROJECT." - (let* ((root (project-root project)) - (project-modules (expand-file-name "node_modules" root)) - (ngserver (file-truename (executable-find "ngserver"))) - (ng-modules (expand-file-name "../node_modules" - (file-name-directory ngserver)))) - (list "ngserver" "--stdio" - "--tsProbeLocations" - (string-join (list project-modules ng-modules) ",") - "--ngProbeLocations" ng-modules))) - -(use-package flymake-eslint - :ensure t - :init - (setq flymake-eslint-executable-name "eslint_d") - (setq flymake-eslint-prefer-json-diagnostics t) - :hook ((typescript-ts-mode . flymake-mode) - (scss-mode . flymake-mode) - ((mhtml-mode html-mode) . flymake-mode) - (scss-mode . flymake-mode))) - ;; (typescript-ts-mode . flymake-eslint-enable))) - +(add-to-list 'auto-mode-alist '("\\.go\\'" . go-ts-mode)) (use-package lsp-mode :commands (lsp lsp-deferred) @@ -137,45 +113,6 @@ lsp-headerline-breadcrumb-enable t lsp-enable-folding t)) -;; eglot for TypeScript (tsgo), C#, SCSS, HTML/Angular. -(with-eval-after-load 'eglot - (setq eglot-code-action-indications nil) - (setq eglot-connect-timeout nil) - (add-to-list 'eglot-server-programs - '(csharp-ts-mode . ("roslyn-language-server" "--stdio"))) - (add-to-list 'eglot-server-programs - '(scss-mode . ("some-sass-language-server" "--stdio"))) - (add-to-list 'eglot-server-programs - '(typescript-ts-mode . ("tsc" "--lsp" "--stdio"))) - (add-to-list 'eglot-server-programs - '((html-mode mhtml-mode) . my/angular-language-server-command))) - -;; roslyn: pick a solution on connect, open it via solution/open -(defun my/roslyn-solutions (root) - "All .sln/.slnx files tracked in the repo at ROOT (repo-relative)." - (let ((default-directory root)) - (split-string - (shell-command-to-string "git ls-files -z -- \"*.sln\" \"*.slnx\"") - "\0" t))) - -(defun my/roslyn-open-solution (&optional server) - "Pick a solution via the minibuffer and open it in the Roslyn SERVER." - (interactive) - (let* ((server (or server (eglot-current-server) - (user-error "No eglot server in this buffer"))) - (root (project-root (eglot--project server))) - (sols (my/roslyn-solutions root))) - (if (null sols) - (message "Roslyn: no .sln/.slnx found under %s" root) - (let ((choice (completing-read "Open solution: " sols nil t))) - (jsonrpc-notify server :solution/open - (list :solution - (eglot-path-to-uri (expand-file-name choice root)))) - (message "Roslyn: opening %s" choice))))) - -(with-eval-after-load 'eglot - (keymap-set eglot-mode-map "C-c s" #'my/roslyn-open-solution)) - ;; window-management (use-package zoom-window :ensure t @@ -185,4 +122,4 @@ (define-key global-map (kbd "C-c w") 'zoom-window-zoom) (global-set-key (kbd "C-c c") 'comment-line) -(load-theme 'modus-operandi) +(load-theme 'modus-vivendi)