diff options
-rw-r--r-- | blendoit-theme.el | 2 | ||||
-rw-r--r-- | blendoit/init-blendoit.org | 340 | ||||
-rw-r--r-- | init-custom.el | 6 |
3 files changed, 321 insertions, 27 deletions
diff --git a/blendoit-theme.el b/blendoit-theme.el index c23144c..1196e4f 100644 --- a/blendoit-theme.el +++ b/blendoit-theme.el @@ -77,7 +77,7 @@ '(mode-line-inactive ((t (:inherit mode-line :background "gainsboro" :weight light)))) '(isearch ((t (:stipple nil :background "yellow" :foreground "black" :weight bold)))) '(isearch-fail ((t (:background "RosyBrown1")))) - '(lazy-highlight ((t (:weight "medium" :inherit isearch)))) + '(lazy-highlight ((t (:inherit isearch)))) '(match ((t (:background "light yellow")))) '(next-error ((t (:inherit (region))))) '(query-replace ((t (:inherit isearch)))) diff --git a/blendoit/init-blendoit.org b/blendoit/init-blendoit.org index 28962e2..2a78126 100644 --- a/blendoit/init-blendoit.org +++ b/blendoit/init-blendoit.org @@ -129,6 +129,7 @@ mode. (global-set-key (kbd "C-b") 'ibuffer-sidebar-toggle-sidebar) (global-set-key (kbd "C-o") 'menu-find-file-existing) (global-set-key (kbd "C-r") 'counsel-recentf) + (global-set-key (kbd "C-n") 'make-frame) #+END_SRC The following bindings lead to more natural exit behaviors. @@ -502,17 +503,6 @@ Oí, Jason! :config (pdf-loader-install)) #+END_SRC -** rainbow - -This highlights hexadecimal numbers which look like colors, in that same color. - -#+BEGIN_SRC emacs-lisp -(use-package rainbow-mode - :ensure t - :init - (add-hook 'prog-mode-hook 'rainbow-mode)) -#+END_SRC - ** Dashboard We replace the standard welcome screen with our own. @@ -528,6 +518,17 @@ We replace the standard welcome screen with our own. (setq dashboard-banner-logo-title "The editor for the 2nd millenium.")) #+END_SRC +** rainbow + +This highlights hexadecimal numbers which look like colors, in that same color. + +#+BEGIN_SRC emacs-lisp +(use-package rainbow-mode + :ensure t + :init + (add-hook 'prog-mode-hook 'rainbow-mode)) +#+END_SRC + ** Projectile This enables us to better manage our =.git= projects. @@ -539,6 +540,20 @@ This enables us to better manage our =.git= projects. (setq projectile-completion-system 'ivy)) #+END_SRC +** Better parentheses + +#+BEGIN_SRC emacs-lisp +(show-paren-mode 1) + + (use-package smartparens + :config + (add-hook 'prog-mode-hook #'smartparens-mode)) + + (use-package rainbow-delimiters + :config + (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)) +#+END_SRC + * Cosmetics ** Faces & cursors @@ -627,6 +642,100 @@ Disable minibuffer scroll bar. ; (set-window-scroll-bars (ibuffer-sidebar-window) nil nil) #+END_SRC +** Clean up menus + +We reduce the burden on the user by reducing total amount of entries in GUI +menus. + +*** File + +#+BEGIN_SRC emacs-lisp +(define-key menu-bar-file-menu [dired] nil) +(define-key menu-bar-file-menu [print-buffer] nil) +(define-key menu-bar-file-menu [print-region] nil) +(define-key menu-bar-file-menu [ps-print-buffer-faces] nil) +(define-key menu-bar-file-menu [ps-print-region-faces] nil) +(define-key menu-bar-file-menu [ps-print-buffer] nil) +(define-key menu-bar-file-menu [ps-print-region] nil) +(define-key menu-bar-file-menu [split-window-below] nil) +(define-key menu-bar-file-menu [split-window-right] nil) +(define-key menu-bar-file-menu [dired] nil) +#+END_SRC + +*** Edit + +#+BEGIN_SRC emacs-lisp +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +(define-key menu-bar-file-menu [dired] nil) +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +#+END_SRC + +*** Options + +#+BEGIN_SRC emacs-lisp +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +(define-key menu-bar-file-menu [dired] nil) +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +#+END_SRC + +*** Buffers + +#+BEGIN_SRC emacs-lisp +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +(define-key menu-bar-file-menu [dired] nil) +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +#+END_SRC + +*** Tools + +#+BEGIN_SRC emacs-lisp +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +(define-key menu-bar-file-menu [dired] nil) +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +#+END_SRC + +*** Org + +#+BEGIN_SRC emacs-lisp +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +(define-key menu-bar-file-menu [dired] nil) +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +#+END_SRC + +*** Tbl + +#+BEGIN_SRC emacs-lisp +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +(define-key menu-bar-file-menu [dired] nil) +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +#+END_SRC + +*** Text + +#+BEGIN_SRC emacs-lisp +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +(define-key menu-bar-file-menu [dired] nil) +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +#+END_SRC + +*** Projectile + +#+BEGIN_SRC emacs-lisp +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +(define-key menu-bar-file-menu [dired] nil) +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +#+END_SRC + +*** Help + +#+BEGIN_SRC emacs-lisp +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +(define-key menu-bar-file-menu [dired] nil) +(define-key menu-bar-help-menu [emacs-psychotherapist] nil) +#+END_SRC + +** Coding standards + This is just a better default. #+BEGIN_SRC emacs-lisp @@ -634,6 +743,203 @@ This is just a better default. c-basic-offset 4) #+END_SRC +** Tabs + +#+BEGIN_SRC emacs-lisp +(use-package tabbar) +#+END_SRC + +Thank you +https://andreyorst.gitlab.io/posts/2020-05-10-making-emacs-tabs-look-like-in-atom/ + +#+BEGIN_SRC emacs-lisp +(when (and window-system + (not (version< emacs-version "27"))) + (use-package tab-line + :hook (after-init . global-tab-line-mode) + :config + (defun tab-line-close-tab (&optional e) + "Close the selected tab. + +If tab is presented in another window, close the tab by using +`bury-buffer` function. If tab is unique to all existing +windows, kill the buffer with `kill-buffer` function. Lastly, if +no tabs left in the window, it is deleted with `delete-window` +function." + (interactive "e") + (let* ((posnp (event-start e)) + (window (posn-window posnp)) + (buffer (get-pos-property 1 'tab (car (posn-string posnp))))) + (with-selected-window window + (let ((tab-list (tab-line-tabs-window-buffers)) + (buffer-list (flatten-list + (seq-reduce (lambda (list window) + (select-window window t) + (cons (tab-line-tabs-window-buffers) list)) + (window-list) nil)))) + (select-window window) + (if (> (seq-count (lambda (b) (eq b buffer)) buffer-list) 1) + (progn + (if (eq buffer (current-buffer)) + (bury-buffer) + (set-window-prev-buffers window (assq-delete-all buffer (window-prev-buffers))) + (set-window-next-buffers window (delq buffer (window-next-buffers)))) + (unless (cdr tab-list) + (ignore-errors (delete-window window)))) + (and (kill-buffer buffer) + (unless (cdr tab-list) + (ignore-errors (delete-window window))))))))) + + + (defcustom tab-line-tab-min-width 10 + "Minimum width of a tab in characters." + :type 'integer + :group 'tab-line) + + + (defcustom tab-line-tab-max-width 30 + "Maximum width of a tab in characters." + :type 'integer + :group 'tab-line) + + (defcustom tab-line-ellipsis-string "…" + "String for indicating truncated names" + :type 'string + :group 'tab-line) + + (defun aorst/tab-line--tab-width (window-width tab-amount) + "Calculate width of single tab dividing WINDOW-WIDTH by TAB-AMOUNT." + (let* ((close-button-size + (if tab-line-close-button-show + (length (substring-no-properties tab-line-close-button)) 0)) + (tab-width (/ window-width tab-amount))) + (- (cond ((< window-width 0) + tab-line-tab-min-width) + ((>= tab-width tab-line-tab-max-width) + tab-line-tab-max-width) + ((< tab-width tab-line-tab-min-width) + tab-line-tab-min-width) + (t tab-width)) + close-button-size))) + + (defun aorst/tab-line--max-width (window) + "Calculate free width of the WINDOW. + +Free width means amount of space we can use to display tabs +without truncation." + (- (window-width window) + (length (substring-no-properties tab-line-left-button)) + (length (substring-no-properties tab-line-right-button)) + (if tab-line-new-button-show + (length (substring-no-properties tab-line-new-button)) + 0))) + + + (defun aorst/tab-line--make-pad (tab-width name-width) + "Generate padding string based on TAB-WIDTH and NAME-WIDTH." + (let* ((width (- tab-width name-width)) + (padding (/ (if (oddp width) (+ width 1) width) 2))) + (make-string padding ?\s))) + + + (defun aorst/tab-line-name-buffer (buffer &rest _buffers) + "Create name for tab with padding and truncation. + +If buffer name is shorter than `tab-line-tab-max-width' it gets +centered with spaces, otherwise it is truncated, to preserve +equal width for all tabs. This function also tries to fit as +many tabs in window as possible, so if there are no room for tabs +with maximum width, it calculates new width for each tab and +truncates text if needed. Minimal width can be set with +`tab-line-tab-min-width' variable." + (with-current-buffer buffer + (let* ((amount (length (tab-line-tabs-window-buffers))) + (width (aorst/tab-line--tab-width + (aorst/tab-line--max-width (get-buffer-window buffer)) + amount)) + (buffer (string-trim (buffer-name))) + (name-width (length buffer)) + (right-pad (if tab-line-close-button-show "" " ")) + (truncate-width (- width + (length tab-line-ellipsis-string) + (length right-pad)))) + (if (>= name-width truncate-width) + (concat " " (truncate-string-to-width buffer truncate-width) tab-line-ellipsis-string right-pad) + (let* ((padding (aorst/tab-line--make-pad width name-width)) + (tab-text (concat padding buffer)) + (text-width (length tab-text))) + (concat tab-text (make-string (- width text-width) ?\s))))))) + + + (setq tab-line-close-button-show t + tab-line-new-button-show nil + tab-line-separator "" + tab-line-tab-name-function #'aorst/tab-line-name-buffer + tab-line-right-button (propertize (if (char-displayable-p ?▶) " ▶ " " > ") + 'keymap tab-line-right-map + 'mouse-face 'tab-line-highlight + 'help-echo "Click to scroll right") + tab-line-left-button (propertize (if (char-displayable-p ?◀) " ◀ " " < ") + 'keymap tab-line-left-map + 'mouse-face 'tab-line-highlight + 'help-echo "Click to scroll left") + tab-line-close-button (propertize (if (char-displayable-p ?×) " × " " x ") + 'keymap tab-line-tab-close-map + 'mouse-face 'tab-line-close-highlight + 'help-echo "Click to close tab")) + + + (let ((bg (if (facep 'solaire-default-face) + (face-attribute 'solaire-default-face :background) + (face-attribute 'default :background))) + (fg (face-attribute 'default :foreground)) + (base (if (facep 'solaire-default-face) + (face-attribute 'default :background) + (face-attribute 'mode-line :background))) + (box-width (/ (line-pixel-height) 2))) + (when (and (color-defined-p bg) + (color-defined-p fg) + (color-defined-p base) + (numberp box-width)) + (set-face-attribute 'tab-line nil + :background base + :foreground fg + :height 1.0 + :inherit nil + :box (list :line-width -1 :color base)) + (set-face-attribute 'tab-line-tab nil + :foreground fg + :background bg + :weight 'normal + :inherit nil + :box (list :line-width box-width :color bg)) + (set-face-attribute 'tab-line-tab-inactive nil + :foreground fg + :background base + :weight 'normal + :inherit nil + :box (list :line-width box-width :color base)) + (set-face-attribute 'tab-line-tab-current nil + :foreground fg + :background bg + :weight 'normal + :inherit nil + :box (list :line-width box-width :color bg)))) + (setq tab-line-exclude-modes '()) + (dolist (mode '(ediff-mode + process-menu-mode + term-mode + vterm-mode)) + (add-to-list 'tab-line-exclude-modes mode)) + + (defun aorst/tab-line-drop-caches () + "Drops `tab-line' cache in every window." + (dolist (window (window-list)) + (set-window-parameter window 'tab-line-cache nil))) + + (add-hook 'window-configuration-change-hook #'aorst/tab-line-drop-caches))) +#+END_SRC + ** auto fill Automatically break lines longer than =fill-column=. @@ -651,18 +957,6 @@ Automatically break lines longer than =fill-column=. (run-at-time nil (* 5 60) 'recentf-save-list) #+END_SRC -** Better parentheses - -#+BEGIN_SRC emacs-lisp - (use-package smartparens - :config - (add-hook 'prog-mode-hook #'smartparens-mode)) - - (use-package rainbow-delimiters - :config - (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)) -#+END_SRC - * Profiling --- stop #+BEGIN_SRC emacs-lisp diff --git a/init-custom.el b/init-custom.el index a714f50..755c2e1 100644 --- a/init-custom.el +++ b/init-custom.el @@ -17,8 +17,9 @@ '(custom-enabled-themes nil) '(custom-safe-themes (quote - ("429c077679e0586d1b6a9f22586129bb4e0793e70b414ff93f023fcfa654b08a" "9893c7f1274df4d4df0573da1ee4dfe32f73f71cdf45bba7596a09e6c637d990" "e274c4d17ef47311855ce93dcc34c512bb285e3a01e9b3b1b735e059a865e48d" "59b58e2d0b77f0e8dc305bba18dc0913ae11ebc1ea91165911f5f3bd46910470" "2946f0682172ff16ffe531ce59ea26044f949e8a51b2d4ab14d74e21fa8f2b67" "de4fe3532d51a731d313e588531e32a26f9824e216fff1306ca270487f833045" "096bb91c8fd17ff6f2f51ddaf51897c9710da5486fbbb2d370e3ff3b209ff446" "700f0a38b888fb3fe656b9d8647d71fa99b3684641cf9e02106a3e3a1ca1d87a" "5cbf5345c2af35887f1518c35c9a62409304b20006f2455ef1313507e0552b1f" default))) + ("50fa2844d84cecfa718f92122e095ecc1243fdf004bb1348e9cee856707c6f3d" "429c077679e0586d1b6a9f22586129bb4e0793e70b414ff93f023fcfa654b08a" "9893c7f1274df4d4df0573da1ee4dfe32f73f71cdf45bba7596a09e6c637d990" "e274c4d17ef47311855ce93dcc34c512bb285e3a01e9b3b1b735e059a865e48d" "59b58e2d0b77f0e8dc305bba18dc0913ae11ebc1ea91165911f5f3bd46910470" "2946f0682172ff16ffe531ce59ea26044f949e8a51b2d4ab14d74e21fa8f2b67" "de4fe3532d51a731d313e588531e32a26f9824e216fff1306ca270487f833045" "096bb91c8fd17ff6f2f51ddaf51897c9710da5486fbbb2d370e3ff3b209ff446" "700f0a38b888fb3fe656b9d8647d71fa99b3684641cf9e02106a3e3a1ca1d87a" "5cbf5345c2af35887f1518c35c9a62409304b20006f2455ef1313507e0552b1f" default))) '(fci-rule-color "#383838") + '(fill-column 79) '(ibuffer-sidebar-display-column-titles t) '(ibuffer-sidebar-display-summary t) '(ibuffer-sidebar-width 18) @@ -101,7 +102,7 @@ '(org-time-stamp-custom-formats (quote ("%d %b, %Y (%a)" . "%d %b, %Y (%a), at %H:%M"))) '(package-selected-packages (quote - (linum-relative dumb-jump csv-mode rainbow-mode org-mouse projectile minimap gnuplot ledger-mode company-mode wombat-theme wombar-theme which-key srefactor-lisp srefactor all-the-icons flycheck ibuffer-sidebar pdf-tools magit rainbow-delimiters smartparens mixed-pitch org-bullets use-package tabbar powerline ivy-hydra flatui-theme evil counsel company benchmark-init))) + (tabbar-ruler tabbar-mode linum-relative dumb-jump csv-mode rainbow-mode org-mouse projectile minimap gnuplot ledger-mode company-mode wombat-theme wombar-theme which-key srefactor-lisp srefactor all-the-icons flycheck ibuffer-sidebar pdf-tools magit rainbow-delimiters smartparens mixed-pitch org-bullets use-package tabbar powerline ivy-hydra flatui-theme evil counsel company benchmark-init))) '(pdf-view-midnight-colors (quote ("#DCDCCC" . "#383838"))) '(save-place-mode t) '(send-mail-function (quote smtpmail-send-it)) @@ -135,7 +136,6 @@ ;; 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. - '(default ((t (:family "Hermit" :foundry "UKWN" :slant normal :weight normal :height 122 :width normal)))) '(cursor ((t (:background "red")))) '(fixed-pitch ((t (:family "Hermit")))) '(highlight ((t (:background "#454545" :foreground "#ffffff" :underline nil)))) |