From 711887311bced24e3bcc29998e53c1ffa0aca76e Mon Sep 17 00:00:00 2001 From: Aleksandr Mikhailov Date: Sat, 12 Oct 2024 21:19:24 +0300 Subject: [PATCH] Add kubed --- .gitignore | 3 +- early-init.el | 12 +++- init.el | 25 +++++-- lisp/00-sane-defaults.el | 147 +++++++++++++++++++++------------------ lisp/10-ui.el | 27 +------ lisp/20-completion.el | 26 +++---- lisp/20-meow.el | 1 - lisp/25-wakatime.el | 1 - lisp/40-dap.el | 4 +- lisp/40-lsp.el | 11 +-- lisp/40-magit.el | 3 +- lisp/40-projectile.el | 2 - lisp/40-tree-sitter.el | 5 +- lisp/50-dockerfiles.el | 1 - lisp/50-nix.el | 10 ++- lisp/50-scala.el | 7 +- lisp/50-yaml.el | 4 +- lisp/70-kubed.el | 6 ++ lisp/70-org.el | 9 +++ lisp/70-utils.el | 4 -- lisp/99-keybindings.el | 3 +- 21 files changed, 158 insertions(+), 153 deletions(-) create mode 100644 lisp/70-kubed.el create mode 100644 lisp/70-org.el diff --git a/.gitignore b/.gitignore index 09d0064..8853685 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,6 @@ auto-save-list .cache var straight +eln-cache *~ -\#*# \ No newline at end of file +\#*# diff --git a/early-init.el b/early-init.el index 08c870d..d255939 100644 --- a/early-init.el +++ b/early-init.el @@ -40,7 +40,17 @@ "Install use-package.el" (setq use-package-enable-imenu-support t) (straight-use-package 'use-package) - (straight-use-package 'diminish)) + (straight-use-package 'diminish) + + (require 'use-package-ensure) + (setq use-package-always-ensure t) + ;; (use-package auto-package-update + ;; :config + ;; (setq auto-package-update-delete-old-versions t) + ;; (setq auto-package-update-hide-results t) + ;; (auto-package-update-maybe) + ;; ) + ) diff --git a/init.el b/init.el index 5736b0e..e05faa4 100644 --- a/init.el +++ b/init.el @@ -1,18 +1,35 @@ +(setq + visible-bell t + inhibit-startup-message t + auto-save-default nil + make-backup-files nil + set-mark-command-repeat-pop t + large-file-warning-threshold nil + vc-follow-symlinks t + ad-redefinition-action 'accept + global-auto-revert-non-file-buffers t +native-comp-async-report-warnings-errors nil + ) + + + ;; Load early-init.el regardless of the way Emacs was started. -(require 'nano-defaults (expand-file-name "nano-defaults" user-emacs-directory)) -(require 'nano-splash (expand-file-name "nano-splash" user-emacs-directory)) +;; (require 'nano-defaults (expand-file-name "nano-defaults" user-emacs-directory)) +;; (require 'nano-splash (expand-file-name "nano-splash" user-emacs-directory)) (require 'early-init (expand-file-name "early-init" user-emacs-directory)) ;; Load no-littering.el before anything else to keep ~/.emacs.d/ tidy. -(use-package no-littering :straight t) +(use-package no-littering) + +(setq create-lockfiles nil) (no-littering-theme-backups) (when (and (fboundp 'startup-redirect-eln-cache) (fboundp 'native-comp-available-p) (native-comp-available-p)) (startup-redirect-eln-cache (convert-standard-filename - (expand-file-name "var/eln-cache/" user-emacs-directory)))) + (expand-file-name "var/eln-cache/" user-emacs-directory)))) ;; Expose the packages integrated into the config repository. diff --git a/lisp/00-sane-defaults.el b/lisp/00-sane-defaults.el index 96fd14e..f8863d3 100644 --- a/lisp/00-sane-defaults.el +++ b/lisp/00-sane-defaults.el @@ -1,82 +1,95 @@ ;; -*- lexical-binding: t -*- -(setq gc-cons-threshold (* 100 1024 1024)) -(setq read-process-output-max (* 1024 1024)) ;; 1mb +(setq gc-cons-threshold (* 100 1024 1024) + read-process-output-max (* 1024 1024) ;; 1mb -(setq uniquify-buffer-name-style 'forward) - -(save-place-mode 1) - -(set-default 'cursor-type '(bar . 1)) -(blink-cursor-mode 0) - -(setq visible-bell t) -(setq ring-bell-function 'ignore) - -(show-paren-mode t) - -(defun mode-line-render (left right) - "Function to render the modeline LEFT to RIGHT." - (concat left - (propertize " " 'display `(space :align-to (- right ,(length right)))) - right)) -(setq-default mode-line-format - '((:eval - (mode-line-render - (format-mode-line (list - (propertize "☰" 'face `(:inherit mode-line-buffer-id) - 'help-echo "Mode(s) menu" - 'mouse-face 'mode-line-highlight - 'local-map mode-line-major-mode-keymap) - " %b " - (if (and buffer-file-name (buffer-modified-p)) - (propertize "(modified)" 'face `(:inherit face-faded))))) - (format-mode-line - (propertize "%4l:%2c" 'face `(:inherit face-faded))))))) -;;; ------------------------------------------------------------------- + uniquify-buffer-name-style 'forward + visible-bell t + ring-bell-function 'ignore + window-divider-default-right-width 3 + window-divider-default-places 'right-only -;;; ------------------------------------------------------------------- - - -;;; Vertical window divider -;;; ------------------------------------------------------------------- -(setq window-divider-default-right-width 3) -(setq window-divider-default-places 'right-only) -(window-divider-mode) - - -(setq backup-directory-alist '(("." . "~/.backups")) + backup-directory-alist '(("." . "~/.backups")) make-backup-files t ; backup of a file the first time it is saved. backup-by-copying t ; don't clobber symlinks version-control t ; version numbers for backup files delete-old-versions t ; delete excess backup files silently kept-old-versions 6 ; oldest versions to keep when a new numbered - ; backup is made (default: 2) + ; backup is made (default: 2) kept-new-versions 9 ; newest versions to keep when a new numbered - ; backup is made (default: 2) + ; backup is made (default: 2) auto-save-default t ; auto-save every buffer that visits a file - auto-save-timeout 20 ; number of seconds idle time before auto-save - ; (default: 30) - auto-save-interval 200) ; number of keystrokes between auto-saves - ; (default: 300) -(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)) + auto-save-timeout 3 ; number of seconds idle time before auto-save + ; (default: 30) + auto-save-interval 200 ; number of keystrokes between auto-saves + ; (default: 300) + x-select-enable-primary t + x-select-enable-clipboard t + mouse-drag-copy-region t + meow-cursor-type-default 'bar + meow-cursor-type-motion 'bar + meow-cursor-type-beacon 'bar + meow-cursor-type-insert '(hbar . 2) + ) +;; Move global mode string to the tab-bar and hide tab close buttons +(setq tab-bar-close-button-show nil + tab-bar-separator " " + tab-bar-format '(tab-bar-format-menu-bar + tab-bar-format-tabs-groups + tab-bar-separator + tab-bar-format-align-right + tab-bar-format-global) + ) +;; Turn on the tab-bar +(tab-bar-mode 1) -(when (getenv "WAYLAND_DISPLAY") - (setq wl-copy-process nil) - (defun wl-copy (text) - (setq wl-copy-process (make-process :name "wl-copy" - :buffer nil - :command '("wl-copy" "-f" "-n") - :connection-type 'pipe)) - (process-send-string wl-copy-process text) - (process-send-eof wl-copy-process)) - (defun wl-paste () - (if (and wl-copy-process (process-live-p wl-copy-process)) - nil ; should return nil if we're the current paste owner - (shell-command-to-string "wl-paste -n | tr -d \r"))) - (setq interprogram-cut-function 'wl-copy) - (setq interprogram-paste-function 'wl-paste) - ) +;; y/n for answering yes/no questions +(fset 'yes-or-no-p 'y-or-n-p) + +;; No tabs +(setq-default indent-tabs-mode nil + + ;; Tab.space equivalence + tab-width 4) + +;; Buffer encoding +(prefer-coding-system 'utf-8) +(set-default-coding-systems 'utf-8) +(set-terminal-coding-system 'utf-8) +(set-keyboard-coding-system 'utf-8) +(set-language-environment 'utf-8) + +(set-default 'cursor-type '(hbar . 2)) + +(repeat-mode 1) ;; Enable repeating key maps +(menu-bar-mode 0) ;; Hide the menu bar +(tool-bar-mode 0) ;; Hide the tool bar +(savehist-mode 1) ;; Save minibuffer history +(scroll-bar-mode 0) ;; Hide the scroll bar +(xterm-mouse-mode 1) ;; Enable mouse events in terminal Emacs +(fido-vertical-mode 1) ;; Improved vertical minibuffer completions +(column-number-mode 1) ;; Show column number on mode line +(tab-bar-history-mode 1) ;; Remember previous tab window configurations +(tool-bar-mode -1) +(auto-save-visited-mode 1) ;; Auto-save files at an interval +(global-visual-line-mode 1) ;; Visually wrap long lines in all buffers +(global-auto-revert-mode 1) ;; Refresh buffers with changed local files +(blink-cursor-mode 0) +(show-paren-mode t) +(window-divider-mode) (pixel-scroll-precision-mode) + + +;; Delete trailing whitespace before saving buffers +(add-hook 'before-save-hook 'delete-trailing-whitespace) + + +(setq display-buffer-alist + '(("\\*\\(shell\\|.*term\\|.*eshell\\|help\\|compilation\\|Async Shell Command\\|Occur\\|xref\\).*\\*" + (display-buffer-reuse-window display-buffer-in-side-window) + (side . bottom) ; Popups go at the bottom + (slot . 0) ; Use the first slot at the bottom + (post-command-select-window . t) ; Select the window upon display + (window-height . 0.3)))) ; 30% of the frame height diff --git a/lisp/10-ui.el b/lisp/10-ui.el index 12448e0..cdadf49 100644 --- a/lisp/10-ui.el +++ b/lisp/10-ui.el @@ -1,7 +1,6 @@ (set-face-attribute 'default nil :font "BlexMono Nerd Font Mono" :height 150 :weight 'semi-light) (use-package doom-modeline - :straight t :config (setq doom-modeline-hud nil) (setq doom-modeline-icon nil) @@ -11,12 +10,10 @@ (doom-modeline-mode 1) ) -(use-package all-the-icons - :straight t) +(use-package all-the-icons) (use-package doom-themes :ensure t - :straight t :config ;; Global settings (defaults) (setq doom-themes-enable-bold t ; if nil, bold is universally disabled @@ -35,18 +32,15 @@ (doom-themes-org-config) ) -(use-package aggressive-indent - :straight t) +(use-package aggressive-indent) (use-package rainbow-delimiters - :straight t :config (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)) (use-package dashboard - :straight t :ensure t :init (setq dashboard-startup-banner 3) @@ -80,7 +74,6 @@ (use-package treemacs - :straight t :ensure t :defer t :init @@ -165,21 +158,7 @@ (use-package treemacs-magit - :after (treemacs magit) - :ensure t - :straight t) + :after (treemacs magit)) (with-eval-after-load 'treemacs (define-key treemacs-mode-map [mouse-1] #'treemacs-single-click-expand-action)) - -(setq truncate-lines t) - - -(use-package centaur-tabs - :demand - :config - (setq centaur-tabs-set-bar 'under) - (setq x-underline-at-descent-line t) - (setq centaur-tabs-plain-icons t) - :custom - (centaur-tabs-mode t)) diff --git a/lisp/20-completion.el b/lisp/20-completion.el index 0d3d61a..ec4d8b4 100644 --- a/lisp/20-completion.el +++ b/lisp/20-completion.el @@ -1,10 +1,9 @@ (use-package corfu - :straight t :custom (corfu-cycle t) ;; Enable cycling for `corfu-next/previous' (corfu-auto t) ;; Enable auto completion ;; (corfu-separator ?\s) ;; Orderless field separator - ;; (corfu-quit-at-boundary nil) ;; Never quit at completion boundary + (corfu-quit-at-boundary nil) ;; Never quit at completion boundary ;; (corfu-quit-no-match nil) ;; Never quit, even if there is no match (corfu-preview-current nil) ;; Disable current candidate preview ;; (corfu-preselect 'prompt) ;; Preselect the prompt @@ -96,12 +95,10 @@ (use-package consult-lsp - :straight t :ensure t) ;; Enable vertico (use-package vertico - :straight t :custom ;; (vertico-scroll-margin 0) ;; Different scroll margin (vertico-count 10) ;; Show more candidates @@ -131,7 +128,6 @@ ) (use-package vertico-posframe - :straight t :after vertico-multiform :ensure nil :config @@ -149,13 +145,11 @@ ;; Persist history over Emacs restarts. Vertico sorts by history position. (use-package savehist - :straight t :init (savehist-mode)) ;; A few more useful configurations... (use-package emacs - :straight t :custom ;; Support opening new minibuffers from inside existing minibuffers. (enable-recursive-minibuffers t) @@ -169,7 +163,7 @@ ;; Enable indentation+completion using the TAB key. ;; `completion-at-point' is often bound to M-TAB. - (tab-always-indent 'complete) + ;; (tab-always-indent 'complete) ;; Emacs 30 and newer: Disable Ispell completion function. As an alternative, ;; try `cape-dict'. @@ -197,12 +191,10 @@ (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) ) -(use-package hotfuzz - :straight t) +(use-package hotfuzz) ;; Optionally use the `orderless' completion style. (use-package orderless - :straight t :custom ;; Configure a custom style dispatcher (see the Consult wiki) ;; (orderless-style-dispatchers '(+orderless-consult-dispatch orderless-affix-dispatch)) @@ -212,12 +204,16 @@ (completion-category-overrides nil)) (use-package marginalia - :straight t :config (marginalia-mode 1)) + +;; Consult users will also want the embark-consult package. +(use-package embark-consult + :hook + (embark-collect-mode . consult-preview-at-point-mode)) + (use-package embark - :ensure t :init ;; Optionally replace the key help with a completing-read interface (setq prefix-help-command #'embark-prefix-help-command) @@ -239,7 +235,3 @@ (window-parameters (mode-line-format . none))))) ;; Consult users will also want the embark-consult package. -(use-package embark-consult - :ensure t ; only need to install it, embark loads it after consult if found - :hook - (embark-collect-mode . consult-preview-at-point-mode)) diff --git a/lisp/20-meow.el b/lisp/20-meow.el index 3dad4b2..d31ec08 100644 --- a/lisp/20-meow.el +++ b/lisp/20-meow.el @@ -1,6 +1,5 @@ (use-package meow - :straight t :demand t :config (require 'meow) diff --git a/lisp/25-wakatime.el b/lisp/25-wakatime.el index e367bc3..5cef17a 100644 --- a/lisp/25-wakatime.el +++ b/lisp/25-wakatime.el @@ -1,4 +1,3 @@ (use-package wakatime-mode - :straight t :init (global-wakatime-mode)) diff --git a/lisp/40-dap.el b/lisp/40-dap.el index d1ca374..227fac6 100644 --- a/lisp/40-dap.el +++ b/lisp/40-dap.el @@ -1,10 +1,8 @@ ;; Posframe is a pop-up tool that must be manually installed for dap-mode -(use-package posframe - :straight t) +(use-package posframe) ;; Use the Debug Adapter Protocol for running tests and debugging (use-package dap-mode - :straight t :hook (lsp-mode . dap-mode) (lsp-mode . dap-ui-mode)) diff --git a/lisp/40-lsp.el b/lisp/40-lsp.el index ce005e7..2c5ea5d 100644 --- a/lisp/40-lsp.el +++ b/lisp/40-lsp.el @@ -1,5 +1,4 @@ (use-package lsp-mode - :straight t ;; Optional - enable lsp-mode automatically in scala files ;; You could also swap out lsp for lsp-deffered in order to defer loading :hook @@ -31,6 +30,7 @@ ;; https://emacs-lsp.github.io/lsp-mode/page/settings/mode/#lsp-keep-workspace-alive (setq lsp-keep-workspace-alive nil) (setq lsp-auto-execute-action nil) + (setq lsp-nix-nil-formatter ["nixfmt"]) (with-eval-after-load 'lsp-mode (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.bloop\\'") @@ -59,16 +59,9 @@ (setq lsp-ui-doc-position 'bottom) (setq lsp-ui-doc-delay 3) (setq lsp-ui-doc-show-with-cursor t) - (setq lsp-ui-doc-show-with-mouse t) - - :straight t) - + (setq lsp-ui-doc-show-with-mouse t)) (use-package lsp-treemacs - :straight t :init (lsp-treemacs-sync-mode 1) ) - -(use-package dap-mode - :straight t) diff --git a/lisp/40-magit.el b/lisp/40-magit.el index 79a7c82..0a284a3 100644 --- a/lisp/40-magit.el +++ b/lisp/40-magit.el @@ -1,2 +1 @@ -(use-package magit - :straight t) +(use-package magit) diff --git a/lisp/40-projectile.el b/lisp/40-projectile.el index 49055e9..b8a78a3 100644 --- a/lisp/40-projectile.el +++ b/lisp/40-projectile.el @@ -3,7 +3,6 @@ (use-package projectile :demand t - :straight t :init ;; ensure projectile saves its files in a nice location (setq projectile-cache-file @@ -32,4 +31,3 @@ ;; (leader-keys ;; "p" 'projectile-command-map) ) - diff --git a/lisp/40-tree-sitter.el b/lisp/40-tree-sitter.el index fffcfc7..b015359 100644 --- a/lisp/40-tree-sitter.el +++ b/lisp/40-tree-sitter.el @@ -1,8 +1,5 @@ (use-package tree-sitter - :straight t :config (global-tree-sitter-mode)) -(use-package tree-sitter-langs - :straight t) - +(use-package tree-sitter-langs) diff --git a/lisp/50-dockerfiles.el b/lisp/50-dockerfiles.el index 71dfaff..620875b 100644 --- a/lisp/50-dockerfiles.el +++ b/lisp/50-dockerfiles.el @@ -1,4 +1,3 @@ (use-package dockerfile-mode - :straight t :init (require 'dockerfile-mode)) diff --git a/lisp/50-nix.el b/lisp/50-nix.el index acdf45f..5aa04cb 100644 --- a/lisp/50-nix.el +++ b/lisp/50-nix.el @@ -1,2 +1,10 @@ -(use-package nix-mode :straight t +;; (use-package nix-lsp +;; :ensure lsp-mode +;; :after (lsp-mode) +;; :demand t +;; :custom +;; (lsp-nix-nil-formatter ["nixfmt"])) + +(use-package nix-mode + :hook (nix-mode . lsp-deferred) :mode "\\.nix\\'") diff --git a/lisp/50-scala.el b/lisp/50-scala.el index 18aa7b3..79585ab 100644 --- a/lisp/50-scala.el +++ b/lisp/50-scala.el @@ -1,10 +1,8 @@ (use-package scala-mode - :straight t :interpreter ("scala" . scala-mode)) ;; Enable sbt mode for executing sbt commands (use-package sbt-mode - :straight t :commands sbt-start sbt-command :config ;; WORKAROUND: https://github.com/ensime/emacs-sbt-mode/issues/31 @@ -18,7 +16,4 @@ ;; Add metals backend for lsp-mode -(use-package lsp-metals - :straight t) - - +(use-package lsp-metals) diff --git a/lisp/50-yaml.el b/lisp/50-yaml.el index 2e57685..55af85d 100644 --- a/lisp/50-yaml.el +++ b/lisp/50-yaml.el @@ -1,3 +1 @@ -(use-package yaml-mode - :straight t - ) +(use-package yaml-mode) diff --git a/lisp/70-kubed.el b/lisp/70-kubed.el new file mode 100644 index 0000000..8c38e8f --- /dev/null +++ b/lisp/70-kubed.el @@ -0,0 +1,6 @@ + +(use-package kubed + :ensure t + :config + (keymap-global-set "C-c k" 'kubed-prefix-map) + ) diff --git a/lisp/70-org.el b/lisp/70-org.el new file mode 100644 index 0000000..5a42f14 --- /dev/null +++ b/lisp/70-org.el @@ -0,0 +1,9 @@ + +;; (require 'org) + +(use-package esxml + :ensure t + ) + +(use-package ox-rss + :ensure t) diff --git a/lisp/70-utils.el b/lisp/70-utils.el index a8535c8..be70180 100644 --- a/lisp/70-utils.el +++ b/lisp/70-utils.el @@ -1,9 +1,7 @@ ;; (use-package rg -;; :straight t ;; :config (rg-enable-default-bindings)) ;; (use-package fzf -;; :straight t ;; :ensure t ;; ;;:config ;; ;; (setq fzf/args "-x --color bw --print-query --margin=1,0 --no-hscroll" @@ -20,11 +18,9 @@ (use-package projectile - :straight t :config (projectile-mode +1)) (use-package which-key - :straight t :ensure t :config (which-key-mode)) diff --git a/lisp/99-keybindings.el b/lisp/99-keybindings.el index fc30ecc..e2e531a 100644 --- a/lisp/99-keybindings.el +++ b/lisp/99-keybindings.el @@ -1,7 +1,6 @@ -(use-package bind-key - :straight t) +(use-package bind-key) (require 'meow) (require 'bind-key)