diff --git a/doom/config.el b/doom/config.el deleted file mode 100644 index 32eb69d..0000000 --- a/doom/config.el +++ /dev/null @@ -1,134 +0,0 @@ -;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- - -(setq shell-file-name "/bin/bash") - -;; Place your private configuration here! Remember, you do not need to run 'doom -;; sync' after modifying this file! - -(setq doom-localleader-key ",") - -;; Some functionality uses this to identify you, e.g. GPG configuration, email -;; clients, file templates and snippets. -(setq user-full-name "Tim McCarthy" - user-mail-address "tim.mccarthy@sri.com") - -;; Doom exposes five (optional) variables for controlling fonts in Doom. Here -;; are the three important ones: -;; -;; + `doom-font' -;; + `doom-variable-pitch-font' -;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for -;; presentations or streaming. -;; -;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd -;; font string. You generally only need these two: -(require 'cl-lib) - -(setq font-candidates - (list - (font-spec :family "Fira Code Regular Nerd Font Complete Mono") - (font-spec :family "monospace" :size 14))) - -(setq doom-font (cl-find-if #'find-font font-candidates)) - -;; There are two ways to load a theme. Both assume the theme is installed and -;; available. You can either set `doom-theme' or manually load a theme with the -;; `load-theme' function. This is the default: -(setq doom-theme 'doom-one) -;; Initial frame size -;; (add-to-list 'default-frame-alist '(width . 125)) -;; (add-to-list 'default-frame-alist '(height . 70)) - -;; Transparency -(set-frame-parameter (selected-frame) 'alpha '(99 98)) -(add-to-list 'default-frame-alist '(alpha 99 98)) - -;; If you use `org' and don't want your org files in the default location below, -;; change `org-directory'. It must be set before org loads! -(setq org-directory "~/Seafile/Notes/") - -;; Enable full 3-cycle tabbing in Org-mode -(after! evil-org - (remove-hook 'org-tab-first-hook #'+org-cycle-only-current-subtree-h)) - -;; This determines the style of line numbers in effect. If set to `nil', line -;; numbers are disabled. For relative line numbers, set this to `relative'. -(setq display-line-numbers-type t) - -;; Spacemacs-like SPC SPC -> M-x behavior -(map! :leader - :desc "M-x" - "SPC" #'execute-extended-command) - -(defun first-executable (candidates) - (seq-find #'executable-find candidates)) - -;; Reveal in finder/nautilus/whatever -(defun reveal-in-file-browser () - (interactive) - (call-process - (first-executable '("xdg-open" "open")) - nil nil nil ".")) - -(map! :leader - :desc "Reveal" - "o o" #'reveal-in-file-browser) - -(map! :leader - :desc "Show in dired" - "f j" #'dired-jump) - -;; Make C-h kill a word in Ivy, for symmetry with C-j/k/l bindings. -(map! :map ivy-mode-map "C-h" #'ivy-backward-kill-word) -;; C-h/C-l bindings in vertico -(map! :map vertico-map "C-h" #'vertico-directory-delete-word) -(map! :map vertico-map "C-l" #'vertico-directory-enter) - -(map! :map smartparens-mode-map - :n "SPC k s" #'sp-forward-slurp-sexp - :n "SPC k b" #'sp-forward-barf-sexp) - -;; Clear all todo statuses in org-mode. For Grocery list. -(defun ttm-org-clear-all () - (interactive) - (goto-char 0) - (org-map-entries - (lambda () - (org-todo ""))) - (flush-lines "CLOSED") - (message "Entries cleared.")) - -(map! :mode org-mode :localleader "C" :desc "Clear all todos" #'ttm-org-clear-all) - -(setq-default eshell-cmpl-ignore-case t) - -;; Show colors in log files -;; (add-load-path! ".") -;; (require 'tty-format) -;; (defun display-ansi-colors () -;; (interactive) -;; (format-decode-buffer 'ansi-colors)) -;; (add-hook 'find-file-hook 'tty-format-guess) -;; (add-to-list 'auto-mode-alist '("\\.log\\'" . display-ansi-colors)) -;; (add-to-list 'auto-mode-alist '("\\.log\\.out\\'" . display-ansi-colors)) - - -;; Disable smartparens' insistence on inserting extraneous colons in Python -(setq sp-python-insert-colon-in-function-definitions nil) - -;; Disable "Enter" as a company-mode completion trigger and replace with C-SPC -(with-eval-after-load 'company - (define-key company-active-map (kbd "") nil) - (define-key company-active-map (kbd "RET") nil) - (define-key company-active-map (kbd "C-SPC") #'company-complete-selection)) - -;; "g u" in normal mode finds references, using LSP if available -(map! :n "g u" #'xref-find-references) -(map! :mode lsp-mode :n "g u" #'lsp-ui-peek-find-references) - -;; Insist on using regular "ls", to override Doom's insistence on "gls" on Mac+Nix -(setq insert-directory-program "ls") -(setq vterm-shell "fish") - -;; Don't create a new workspace when opening a projectile project -(setq-default +workspaces-on-switch-project-behavior nil) diff --git a/doom/init.el b/doom/init.el deleted file mode 100644 index 593b1d7..0000000 --- a/doom/init.el +++ /dev/null @@ -1,125 +0,0 @@ -;;; init.el -*- lexical-binding: t; -*- - -;; This file controls what Doom modules are enabled and what order they load in. -;; Remember to run 'doom sync' after modifying it! - -;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's -;; documentation. There you'll find information about all of Doom's modules -;; and what flags they support. - -;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or -;; 'C-c g k' for non-vim users) to view its documentation. This works on -;; flags as well (those symbols that start with a plus). -;; -;; Alternatively, press 'gd' (or 'C-c g d') on a module to browse its -;; directory (for easy access to its source code). - -(doom! :input - ;;japanese - - :completion - company ; the ultimate code completion backend - vertico ; vertico+marginalia+orderless+consult+embark - - :ui - doom ; what makes DOOM look the way it does - doom-dashboard ; a nifty splash screen for Emacs - ;;doom-quit ; DOOM quit-message prompts when you quit Emacs - ;;fill-column ; a `fill-column' indicator - hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW - hydra - ;; (ligatures +fira) - modeline ; snazzy, Atom-inspired modeline, plus API - nav-flash ; blink the current line after jumping - ophints ; highlight the region an operation acts on - (popup +defaults) ; tame sudden yet inevitable temporary windows - treemacs ; a project drawer, like neotree but cooler - ;;unicode ; extended unicode support for various languages - vc-gutter ; vcs diff in the fringe - vi-tilde-fringe ; fringe tildes to mark beyond EOB - window-select ; visually switch windows - workspaces ; tab emulation, persistence & separate workspaces - - :editor - (evil +everywhere); come to the dark side, we have cookies - file-templates ; auto-snippets for empty files - fold ; (nigh) universal code folding - format ; automated prettiness - ;;multiple-cursors ; editing in many places at once - ;;objed ; text object editing for the innocent - (parinfer +rust) ; turn lisp into python, sort of - ;;rotate-text ; cycle region at point between text candidates - ;;snippets ; my elves. They type so I don't have to - ;;word-wrap ; soft wrapping with language-aware indent - - :emacs - (dired +ranger) ; making dired pretty [functional] - electric ; smarter, keyword-based electric-indent - ;;ibuffer ; interactive buffer management - vc ; version-control and Emacs, sitting in a tree - undo - - :term - ;;eshell ; a consistent, cross-platform shell (WIP) - ;;shell ; a terminal REPL for Emacs - ;;term ; terminals in Emacs - vterm ; another terminals in Emacs - - :checkers - syntax ; tasing you for every semicolon you forget - ;;spell ; tasing you for misspelling mispelling - ;;grammar ; tasing grammar mistake every you make - - :tools - ;;ansible - ;;debugger ; FIXME stepping through code, to help you add bugs - direnv - docker - ;;editorconfig ; let someone else argue about tabs vs spaces - ;;ein ; tame Jupyter notebooks with emacs - (eval +overlay) ; run code, run (also, repls) - ;;gist ; interacting with github gists - lookup ; navigate your code and its documentation - (lsp +peek) - ;;macos ; MacOS-specific commands - magit ; a git porcelain for Emacs - ;;make ; run make tasks from Emacs - ;;pdf ; pdf enhancements - ;;prodigy ; FIXME managing external services & code builders - ;;rgb ; creating color strings - ;;terraform ; infrastructure as code - ;;tmux ; an API for interacting with tmux - ;;upload ; map local to remote projects via ssh/ftp - - :lang - (cc +lsp) ; C/C++/Obj-C madness - ;;clojure ; java with a lisp - data ; config/data formats - emacs-lisp ; drown in parentheses - javascript ; all(hope(abandon(ye(who(enter(here)))))) - ;;kotlin ; a better, slicker Java(Script) - latex ; writing papers in Emacs has never been so fun - markdown ; writing docs for people to ignore - nix ; I hereby declare "nix geht mehr!" - (org ; organize your plain life in plain text - +dragndrop ; drag & drop files/images into org buffers - ;;+hugo ; use Emacs for hugo blogging - ;;+jupyter ; ipython/jupyter support for babel - ;;+pandoc ; export-with-pandoc support - ;;+pomodoro ; be fruitful with the tomato technique - +pretty ;; Disable if performance issues - +roam2 - +present) ; using org-mode for presentations - ;;php ; perl's insecure younger brother - (python +lsp +pyright) ; beautiful is better than ugly - sh ; she sells {ba,z,fi}sh shells on the C xor - web ; the tubes - yaml - - :app - ;;irc ; how neckbeards socialize - - :config - ;;literate - (default +bindings +smartparens)) - diff --git a/doom/packages.el b/doom/packages.el deleted file mode 100644 index 4f1a279..0000000 --- a/doom/packages.el +++ /dev/null @@ -1,50 +0,0 @@ -;; -*- no-byte-compile: t; -*- -;;; $DOOMDIR/packages.el - -;; To install a package with Doom you must declare them here, run 'doom sync' on -;; the command line, then restart Emacs for the changes to take effect. -;; Alternatively, use M-x doom/reload. -;; -;; WARNING: Disabling core packages listed in ~/.emacs.d/core/packages.el may -;; have nasty side-effects and is not recommended. - - -;; All of Doom's packages are pinned to a specific commit, and updated from -;; release to release. To un-pin all packages and live on the edge, do: -;(unpin! t) - -;; ...but to unpin a single package: -;(unpin! pinned-package) -;; Use it to unpin multiple packages -;(unpin! pinned-package another-pinned-package) - - -;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror: -;(package! some-package) - -;; To install a package directly from a particular repo, you'll need to specify -;; a `:recipe'. You'll find documentation on what `:recipe' accepts here: -;; https://github.com/raxod502/straight.el#the-recipe-format -;(package! another-package -; :recipe (:host github :repo "username/repo")) - -;; If the package you are trying to install does not contain a PACKAGENAME.el -;; file, or is located in a subdirectory of the repo, you'll need to specify -;; `:files' in the `:recipe': -;(package! this-package -; :recipe (:host github :repo "username/repo" -; :files ("some-file.el" "src/lisp/*.el"))) - -;; If you'd like to disable a package included with Doom, for whatever reason, -;; you can do so here with the `:disable' property: - -;; You can override the recipe of a built in package without having to specify -;; all the properties for `:recipe'. These will inherit the rest of its recipe -;; from Doom or MELPA/ELPA/Emacsmirror: -;(package! builtin-package :recipe (:nonrecursive t)) -;(package! builtin-package-2 :recipe (:repo "myfork/package")) - -;; Specify a `:branch' to install a package from a particular branch or tag. -;; This is required for some packages whose default branch isn't 'master' (which -;; our package manager can't deal with; see raxod502/straight.el#279) -;(package! builtin-package :recipe (:branch "develop")) diff --git a/doom/tty-format.el b/doom/tty-format.el deleted file mode 100644 index dd3365b..0000000 --- a/doom/tty-format.el +++ /dev/null @@ -1,521 +0,0 @@ -;;; tty-format.el --- text file backspacing and ANSI SGR as faces - -;; Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2017, 2019 Kevin Ryde - -;; Author: Kevin Ryde -;; Version: 12 -;; Keywords: wp, faces, ansi -;; URL: http://user42.tuxfamily.org/tty-format/index.html -;; EmacsWiki: TtyFormat - -;; tty-format.el is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by the -;; Free Software Foundation; either version 3, or (at your option) any later -;; version. -;; -;; tty-format.el is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -;; Public License for more details. -;; -;; You can get a copy of the GNU General Public License online at -;; . - - -;;; Commentary: - -;; This is two additions to `format-alist' for decoding -;; -;; * ANSI SGR escape sequences "Esc [ ... m" colours, bold, underline, -;; etc through ansi-color.el. -;; -;; * Backspace overstriking for bold, underline, overline, and a bullet -;; "+ backspace o". -;; -;; Such sequences are tty or line printer oriented output, but are sometimes -;; found in text files. The aim is to make those files viewable and -;; hopefully have the attributes successfully copy into something like -;; `enriched-mode'. -;; -;; There's no automatic detection of these formats but you can "decode" a -;; buffer containing them with -;; -;; M-x format-decode-buffer backspace-overstrike -;; and/or -;; M-x format-decode-buffer ansi-colors -;; -;; `format-decode-buffer' has completion when it prompts for the format -;; name. -;; -;; See `tty-format-guess' below for an idea to automatically notice text -;; files using these formats. -;; -;; Groff produces output like this (via grotty), and some of its manuals -;; have both ANSI and backspacing, as do various other packages with text -;; files produced from roff input. You might wonder that backspacing by now -;; would have gone with the teletypes it was made for, but grotty still uses -;; it in creative ways. -;; -;; Groff actually has lots of character overstrike sequences to make ink -;; resembling non-ASCII characters. There's far too many to want in the -;; code here -- you're much better off asking groff for extended charset -;; output in the first place (utf8 or whatever), instead of decoding bizarre -;; combinations after the fact. So the aim here is only to handle bits -;; found in real life documents. One moderately frequent bit not yet -;; supported is | plus = for a footnote dagger. -;; -;; Functions and variables here are named either "ansi-format-..." or -;; "backspace-overstrike-...". It seemed like a good idea at the time to -;; have these two things in a single package (in particular since they can -;; occur together). Such multiple prefixing in a package is generally a bad -;; idea, but in the interests of compatibility don't want to change it now. -;; -;; See also underline.el for a couple of simple functions adding or removing -;; backspace underlining. - -;;; Emacsen: - -;; Designed for Emacs 21 up. -;; Works in XEmacs 21 but maybe leaves buffer modified. -;; -;; Works in Emacs 20 if you have ansi-color.el. The separately published -;; ansi-color.el 3.4.5 works if you load cl.el for `mapc'. But note in -;; Emacs 20 faces don't display on a tty, only under X or similar GUI. - -;;; Install: - -;; To have M-x format-decode-buffer support the new formats put -;; tty-format.el in one of your `load-path' directories, and in your .emacs -;; add -;; -;; (require 'tty-format) -;; -;; If you want to try automatic detection on .txt files then add -;; -;; (add-hook 'find-file-hooks 'tty-format-guess) -;; -;; It's also possible to add the `format-alist' entries and then autoload -;; the functions so the code loads only when used. There's ;;;###autoload -;; cookies doing this if you install via `M-x package-install' or know how -;; to use `update-file-autoloads'. - -;;; History: - -;; Version 1 - the first version -;; Version 2 - call the format `ansi-colors' for clarity -;; Version 3 - add unicode U+203E overline -;; Version 4 - fix for re-matching multi-backspace sequences -;; Version 5 - autoload the format-alist additions, not whole file -;; Version 6 - autoload the encode too, for an unload-feature while in use -;; Version 7 - decimal char bytes for emacs20 -;; Version 8 - use ansi-color-apply-face-function when available -;; Version 9 - comments of explicit M-x format-decode-buffer -;; Version 10 - new email -;; Version 11 - compile-time decode-char for overline -;; Version 12 - ansi-color.el no longer has an SGR regexp - -;;; Code: - -(require 'ansi-color) -(eval-when-compile - (unless (fboundp 'ignore-errors) - (require 'cl))) ;; for `ignore-errors' - -;;----------------------------------------------------------------------------- -;; compatibility - -;; not in xemacs, quieten its byte compiler -(defvar ansi-color-apply-face-function) - - -;;----------------------------------------------------------------------------- -;; faces - -;; As of Emacs 25, there's no builtin `overline' face, unlike say `bold' or -;; `underline', so define one here. It comes out nicely on X but dunno what -;; sort of fallback would be good on a tty. Usually overline is just groff -;; trying to draw a box, so if it doesn't display then it doesn't matter much. -;; -;; XEmacs 21 doesn't support :overline in defface and will throw an error on -;; attempting it. Known defface attributes are in 'custom-face-attributes', -;; which is pre-loaded in emacs but in xemacs21 must get it from -;; cus-face.el. defface uses `custom-define-face' from cus-face.el anyway, -;; so loading it doesn't drag in anything extra. -;; -(or (ignore-errors - ;; emacs21 and emacs22 - (defface tty-format-overline - '((t - (:overline t))) - "An overline face. -Used by buffer-format `backspace-overstrike' for overlining." - :group 'faces ;; in absense of our own group - :link '(url-link :tag "tty-format.el home page" - "http://user42.tuxfamily.org/tty-format/index.html")) - t) - - ;; xemacs21 - (defface tty-format-overline - '((t)) - "An overline face. -Used by buffer-format `backspace-overstrike' for overlining. - -However, it seems your Emacs doesn't support :overline, so the default -here is a is a do-nothing face." - :group 'faces ;; in absense of our own group - :link '(url-link :tag "tty-format.el home page" - "http://user42.tuxfamily.org/tty-format/index.html"))) - -(defun tty-format-add-faces (face-list beg end) - "An internal part of tty-format.el. -Add FACE-LIST to the region between BEG and END. -FACE-LIST is a list of faces. These faces are merged onto any -existing `face' property by adding any of FACE-LIST not already -there. If no existing face property then FACE-LIST is stored as -the face property value. - -If it happens that some of the region already has all of -FACE-LIST then those parts are not changed at all. - -Faces are compared with `equal' so face names accumulate by name -even if some of them might look the same on screen." - - (when face-list - (while (< beg end) - (let ((part-end (next-single-property-change beg 'face nil end)) - (part-faces (get-text-property beg 'face))) - - (cond ((not part-faces) - ;; nothing currently, stick in our FACE-LIST directly - (setq part-faces face-list)) - - ((symbolp part-faces) - ;; single face symbol currently, merge with FACE-LIST - (if (memq part-faces face-list) - (setq part-faces face-list) - (setq part-faces (cons part-faces face-list)))) - - (t - ;; list of faces currently, adjoin FACE-LIST - (dolist (face face-list) - (unless (member face part-faces) - (setq part-faces (cons face part-faces)))))) - - ;; single symbol list -> symbol - (and (symbolp (car part-faces)) - (not (cdr part-faces)) - (setq part-faces (car part-faces))) - - (put-text-property beg part-end 'face part-faces) - (setq beg part-end))))) - - -;;----------------------------------------------------------------------------- -;; ANSI sgr, via ansi-color.el - -(defconst tty-format-ansi-regexp "\033\\[\\([0-9;]*m\\)" - "An internal part of tty-format.el. -This regexp matches ANSI colour (SGR) escape sequences Esc [ ... m. -ansi-color.el used to have this as `ansi-color-regexp'.") - -;;;###autoload -(add-to-list 'format-alist - '(ansi-colors - "ANSI SGR escape sequence colours and fonts." - nil ;; no automatic detection - ansi-format-decode - ansi-format-encode - t - nil)) - -;;;###autoload -(defun ansi-format-encode (beg end buffer) - ;; checkdoc-params: (beg end buffer) - "Sorry, cannot encode `ansi-colors' format. -This function is designed for use in `format-alist'. - -There's no support for re-encoding to save a file in -`ansi-colors' format. (But of course you can copy into another -document with a format that does support saving.)" - (error "Sorry, `ansi-colors' format is read-only")) - -;;;###autoload -(defun ansi-format-decode (beg end) - "Decode ANSI SGR control sequences between BEG and END into faces. -This function is designed for use in `format-alist'. - -ANSI standard \"Esc [ ... m\" terminal control sequences are -turned into corresponding Emacs faces, using `ansi-colours'. - -There's no automatic detection of this format, because those -escape sequences could too easily occur in unrelated binary data. -Decode files with an explicit \\[format-decode-buffer], or see -`tty-format-guess' to try automated guessing on text files." - - (let ((inhibit-read-only t)) ;; if visiting a read-only file - (save-excursion - (save-restriction - (narrow-to-region beg end) - - ;; ansi-color.el of emacs24.3 up has - ;; `ansi-color-apply-face-function' which can be used to apply faces - ;; as properties instead of the default overlays. - (if (eval-when-compile (boundp 'ansi-color-apply-face-function)) - (let ((ansi-color-apply-face-function - (lambda (beg end face) - (tty-format-add-faces (list face) beg end)))) - (setq ansi-color-context-region nil) - (ansi-color-apply-on-region (point-min) (point-max))) - - ;; For previous ansi-color.el, this is like - ;; `ansi-color-apply-on-region', but using text properties instead - ;; of overlays. And it's like `ansi-color-apply', but operating - ;; on a buffer instead of a string. Don't want to just put - ;; `buffer-string' through `ansi-color-apply' because that would - ;; lose marker positions, and also as of Emacs 22 - ;; `ansi-color-apply' is slow on big input due to a lot of string - ;; copying. - (goto-char (point-min)) - (let ((face-list nil) - (start (point-min)) - escape-sequence) - (while (re-search-forward tty-format-ansi-regexp nil t) - (setq escape-sequence (match-string 1)) - (delete-region (match-beginning 0) (match-end 0)) - (tty-format-add-faces face-list start (point)) - (setq start (point)) - (setq face-list - (ansi-color-apply-sequence escape-sequence face-list))) - ;; remainder of buffer in final face - (tty-format-add-faces face-list start (point-max)))) - - (point-max))))) - - -;;----------------------------------------------------------------------------- -;; backspace overstrike - -;;;###autoload -(add-to-list 'format-alist - '(backspace-overstrike - "Backspace overstriking for bold and underline." - nil ;; no automatic detection - backspace-overstrike-decode - backspace-overstrike-encode - t - nil)) - -;;;###autoload -(defun backspace-overstrike-encode (beg end buffer) - ;; checkdoc-params: (beg end buffer) - "Sorry, cannot encode `backspace-overstrike' format. -This function is designed for use in `format-alist'. - -There's no support for re-encoding to save a file in -`backspace-overstrike' format. (But of course you can copy into -another document with a format that does support saving.)" - (error "Sorry, `backspace-overstrike' format is read-only")) - -;;;###autoload -(defun backspace-overstrike-decode (beg end) - "Decode backspace overstrike sequences between BEG and END into faces. -This function is designed for use in `format-alist'. - -The sequences recognised are: - - X backspace X -- bold - _ backspace X -- underline - U+203E backspace X -- overline (when unicode available) - + backspace o -- bullet point (latin-1 middle dot, - as per groff \\=\\[bu]]) - -Character overstriking like this was used in the past on line -printers and is still sometimes found in text files. - -There's no automatic detection of this format in `format-alist', -because backspace sequences could too easily occur in unrelated -binary data. Decode with an explicit \\[format-decode-buffer] or -see `tty-format-guess' to try automated guessing on text files." - - (let* ((inhibit-read-only t) ;; if visiting a read-only file - (case-fold-search nil) ;; don't match x\bX - - ;; string of U+203E overline character - (overline (or (eval-when-compile - (and (fboundp 'decode-char) ;; emacs21 up - (string (decode-char 'ucs 8254)))) - (and (memq 'utf-8 (coding-system-list)) - ;; xemacs21 doesn't have `coding-system-p' so use - ;; `coding-system-list', and it only has utf-8 - ;; anyway with mule-ucs - (decode-coding-string - (eval-when-compile - (let ((str (string 226 128 190))) - (if (fboundp 'string-make-unibyte) - (string-make-unibyte str) ;; emacs - str))) ;; xemacs - 'utf-8)))) - - (overline-regexp1 (and overline (concat overline "\b"))) - (overline-regexp2 (and overline (concat "[^\b]\\(\b[^\b_]\\)*?\\(\b" - overline "\\)"))) - (end-marker (make-marker)) - (face-idx 0)) - - (save-excursion - (save-restriction - (narrow-to-region beg end) - - ;; If you think the approach here looks overcomplicated, well, most - ;; of the time you'd be right. But the idea is to cope reasonably - ;; gracefully with backspacing that's only partly understood, - ;; ie. recognise and remove effects we know, and leave the rest as - ;; ^H's in the buffer. - ;; - ;; For speed it might be desirable to match simple runs of just bold - ;; or just underline, to avoid crunching and propertizing every - ;; character individually. But that can wait unless/until the - ;; general approach is not fast enough. - - (goto-char (point-min)) - (while (re-search-forward "[^\b]\b[^\b]\\(\b[^\b]\\)*" nil t) - ;; each run of backspacing - (goto-char (match-beginning 0)) - (set-marker end-marker (match-end 0)) - (setq face-idx 0) - - ;; The sequence "_\b_" is ambiguous: is it a bold underscore, or - ;; an underlined underscore? Both are probable, and groff gives - ;; that output for both requests. For now make it bold, since - ;; that's how it'd mostly look on a line printer. Thus crunch for - ;; bold before crunching underline. - ;; - ;; "+\bo" bullet can be boldened by doubling both the + and o, so - ;; also crunch bold before looking for that combination. - - ;; any duplicate chars in the run mean bold - (while (looking-at "\\([^\b]\b\\)*?\\([^\b]\\)\b\\([^\b]\b\\)*?\\2") - (delete-region (match-beginning 2) (+ 2 (match-beginning 2))) - (setq face-idx (logior face-idx 1))) - - ;; any "_" in the run means underline - (while (looking-at "_\b") - (delete-region (match-beginning 0) (match-end 0)) - (setq face-idx (logior face-idx 2))) - (while (looking-at "[^\b]\\(\b[^\b_]\\)*?\\(\b_\\)") - (delete-region (match-beginning 2) (match-end 2)) - (setq face-idx (logior face-idx 2))) - - ;; any unicode U+203E in the run means overline - (when overline - (while (looking-at overline-regexp1) - (delete-region (match-beginning 0) (match-end 0)) - (setq face-idx (logior face-idx 4))) - (while (looking-at overline-regexp2) - (delete-region (match-beginning 2) (match-end 2)) - (setq face-idx (logior face-idx 4)))) - - ;; "+" and "o" turns into latin1 #xB7 "middle dot". - ;; - ;; "+\bo" is what groff gives for bullet, and a middle dot in turn - ;; is what groff gives in latin1 (or utf8) output mode. Suspect a - ;; heavier mark like U+2022 would look better, but would want to - ;; be sure that's displayable. Also it might not degrade - ;; gracefully if copied to another buffer and saved into a - ;; non-unicode file. - ;; - (when (looking-at "\\([^\b]\b\\)*?\\(\\+\\)\\(\b[^\b]\\)*?\\(\bo\\)") - (let* ((opos (1- (match-end 0))) - (props (text-properties-at opos))) - ;; insert before delete to keep end-marker at the right spot - ;; xemacs21 `replace-match' doesn't take a subexpr, otherwise - ;; it might be used here - (save-excursion (goto-char opos) (insert "·")) - (set-text-properties opos (1+ opos) props) - (delete-region (1+ opos) (+ 2 opos)) ;; "o" - (delete-region (match-beginning 2) ;; "+\b" - (+ 2 (match-beginning 2))))) - (tty-format-add-faces (aref [nil - (bold) - (underline) - (bold underline) - (tty-format-overline) - (bold tty-format-overline) - (underline tty-format-overline) - (bold underline tty-format-overline)] - face-idx) - (point) (marker-position end-marker)) - (goto-char end-marker)) - - (set-marker end-marker nil) ;; nowhere - (point-max))))) - - -;;----------------------------------------------------------------------------- -;; text file guessing - -;;;###autoload -(defun tty-format-guess () - "Decode text files containing ANSI SGR or backspace sequences. -This is designed for use from `find-file-hook' (or -`find-file-hooks'). - -If the buffer filename is \".txt\" or \"README\" and there's any -ANSI SGR escapes or backspace overstriking then call -`format-decode-buffer' to decode with `ansi-colors' and/or -`backspace-overstrike' formats respectively. - -It'd be too dangerous to look at every file for escape and -backspace sequences, they could too easily occur in binary data -like an image file. The idea of this function is to check just -text files, presuming you're confident all \".txt\" files should -be ordinary text. - -If you normally use this guess but found it didn't notice then -remember the formats can always be decoded explicitly with - - \\[format-decode-buffer] backspace-overstrike -and/or - \\[format-decode-buffer] ansi-colors" - - (let ((filename (buffer-file-name))) - (when filename - (when (and (featurep 'jka-compr) - (jka-compr-installed-p)) - (setq filename (jka-compr-byte-compiler-base-file-name filename))) - - (when (let ((case-fold-search t)) - (or (string-match "\\.txt\\'" filename) - (string-match "/README\\'" filename))) - - (if (save-excursion - (goto-char (point-min)) - (re-search-forward "[^\b]\b[^\b]" nil t)) - (format-decode-buffer 'backspace-overstrike)) - - (if (save-excursion - (goto-char (point-min)) - (re-search-forward tty-format-ansi-regexp nil t)) - (format-decode-buffer 'ansi-colors)))))) - -;; emacs 21 - find-file-hooks is a defvar -;; xemacs 21 - find-file-hooks is a defcustom, give custom-add-option -;; emacs 22 - find-file-hooks becomes an alias for find-file-hook, and the -;; latter is a defcustom, give custom-add-option on that -;; -;;;###autoload -(if (eval-when-compile (boundp 'find-file-hook)) - (custom-add-option 'find-file-hook 'tty-format-guess) ;; emacs22 - (custom-add-option 'find-file-hooks 'tty-format-guess)) ;; xemacs21 - - -;; LocalWords: Esc color overline overstrike overstriking groff Groff grotty -;; LocalWords: roff el tty unicode txt viewable charset - -;; Local variables: -;; coding: latin-1 -;; End: - -(provide 'tty-format) - -;;; tty-format.el ends here diff --git a/xonsh/alias.xsh b/xonsh/alias.xsh deleted file mode 100644 index 09126eb..0000000 --- a/xonsh/alias.xsh +++ /dev/null @@ -1,19 +0,0 @@ -from xonsh.platform import ON_DARWIN - -aliases["-"] = "cd -" -aliases[".."] = "cd .." -aliases["..."] = "cd ../.." - -aliases["ec"] = "emacsclient -n --alternate-editor=vim" - -aliases["src"] = "source ~/.xonshrc" - -aliases["pubip"] = "curl icanhazip.com" - -aliases["ll"] = lambda args: $[$LC_COLLATE='C' ls -lAh --color @(args)] -aliases["ls"] = "ls --color" - -if ON_DARWIN: - aliases["o"] = "open" -else: - aliases["o"] = "xdg-open" diff --git a/xonsh/bindings.xsh b/xonsh/bindings.xsh deleted file mode 100644 index 1b23553..0000000 --- a/xonsh/bindings.xsh +++ /dev/null @@ -1,16 +0,0 @@ -from prompt_toolkit.key_binding.bindings.named_commands import get_by_name -from prompt_toolkit.keys import Keys - -@events.on_ptk_create -def custom_keybindings(bindings, **kw): - @bindings.add(Keys.ControlW) - def delete_word(event): - get_by_name("backward-kill-word").call(event) - - @bindings.add(Keys.ControlX, Keys.ControlA) - def select_all(event): - buffer = event.current_buffer - buffer.cursor_position = 0 - buffer.start_selection() - buffer.selection_state.enter_shift_mode() - buffer.cursor_position = len(buffer.text) diff --git a/xonsh/docker.xsh b/xonsh/docker.xsh deleted file mode 100644 index 2e0d0c6..0000000 --- a/xonsh/docker.xsh +++ /dev/null @@ -1,34 +0,0 @@ -_DOCKERFILE_TEXT = """ -FROM busybox -COPY . /build-context -WORKDIR /build-context -CMD find . -""" - -def _dockerignore_check(args): - if len(args) != 1: - print("Must specify only one argument: The dockerignore file.") - return - - ignore_file = Path(args[0]) - - if not ignore_file.exists(): - print(f"Dockerignore file {ignore_file} doesn't exist.") - - import tempfile - import shutil - - with tempfile.TemporaryDirectory() as td: - dpath = Path(td) - - docker_path = dpath / "Dockerfile" - ignore_path = dpath / "Dockerfile.dockerignore" - docker_path.write_text(_DOCKERFILE_TEXT) - shutil.copyfile(ignore_file, ignore_path) - - $DOCKER_BUILDKIT=1 - docker image build --no-cache -t dockerignore-build-context -f @(docker_path) . &>/dev/null - docker run -it --rm dockerignore-build-context - docker image rm dockerignore-build-context &> /dev/null - -aliases["ditest"] = _dockerignore_check diff --git a/xonsh/java.xsh b/xonsh/java.xsh deleted file mode 100644 index 8bb0eb2..0000000 --- a/xonsh/java.xsh +++ /dev/null @@ -1,4 +0,0 @@ -from xonsh.platform import ON_DARWIN - -if ON_DARWIN: - $JAVA_HOME = $(/usr/libexec/java_home).strip() diff --git a/xonsh/kitty.xsh b/xonsh/kitty.xsh deleted file mode 100644 index 6475986..0000000 --- a/xonsh/kitty.xsh +++ /dev/null @@ -1,6 +0,0 @@ -if $TERM == "xterm-kitty": - # Wrap ssh with environment variable because servers tend to deal poorly with kitty - def xterm_ssh(args): - $TERM="xterm-256color" ssh @(args) - - aliases["ssh"] = xterm_ssh diff --git a/xonsh/linux.xsh b/xonsh/linux.xsh deleted file mode 100644 index 2934b95..0000000 --- a/xonsh/linux.xsh +++ /dev/null @@ -1,5 +0,0 @@ -from xonsh.platform import ON_LINUX - -if ON_LINUX: - aliases["pulsefix"] = "pulseaudio --kill; pulseaudio --start" - aliases["redesktop"] = "kquitapp5 plasmashell && kstart5 plasmashell" diff --git a/xonsh/nix.xsh b/xonsh/nix.xsh deleted file mode 100644 index 97f47e2..0000000 --- a/xonsh/nix.xsh +++ /dev/null @@ -1,19 +0,0 @@ -from xonsh.platform import ON_DARWIN - -# Nix integration -nix_daemon_path = p"/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh" -if nix_daemon_path.exists(): - source-bash --suppress-skip-message @(nix_daemon_path) - -# Nix-darwin integration -if ON_DARWIN: - nix_darwin_path = p"/etc/static/bashrc" - if nix_darwin_path.exists(): - source-bash @(nix_darwin_path) - -$NIX_PATH="$HOME/.nix-defexpr/channels:/nix/var/nix/profiles/per-user/root/channels" - -# Home Manager -home_manager_shell_path = p"$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" -if home_manager_shell_path.exists(): - source-bash --suppress-skip-message @(home_manager_shell_path) diff --git a/xonsh/path.xsh b/xonsh/path.xsh deleted file mode 100644 index 8366ae1..0000000 --- a/xonsh/path.xsh +++ /dev/null @@ -1,10 +0,0 @@ -from pathlib import Path -from typing import List - -def ensure_path(*paths: List[str]): - for p in paths: - abs_p = str(Path(p).expanduser().absolute()) - if abs_p not in $PATH: - $PATH.insert(0, abs_p) - -ensure_path("/usr/local/bin", "~/.dotfiles/bin", "~/.local/bin", "~/bin", "~/.emacs.d/bin") diff --git a/xonsh/prompt.xsh b/xonsh/prompt.xsh deleted file mode 100644 index ec75366..0000000 --- a/xonsh/prompt.xsh +++ /dev/null @@ -1,31 +0,0 @@ -# Fix prompt for Emacs TRAMP -# https://github.com/oh-my-fish/theme-bobthefish/issues/148 -if $TERM == "dumb": - $PROMPT = "$ " - $RIGHT_PROMPT = None - $BOTTOM_TOOLBAR = None -else: - $DYNAMIC_CWD_WIDTH = "60%" - $PROMPT = \ - "{bg#2E3440}{INTENSE_RED}{localtime} " \ - "{#5E6470}\ue0b1 {INTENSE_BLUE}{user}{DEFAULT}@{INTENSE_BLUE}{hostname} " \ - "{#5E6470}\ue0b1 {INTENSE_CYAN}{cwd} {DEFAULT}{env_name}{RESET}{#2E3440}\ue0b0\n" \ - "{RESET}{INTENSE_GREEN}{prompt_end}{RESET} " - # $PROMPT = '{env_name}{BOLD_GREEN}{user}{RESET}@{hostname}:{BOLD_GREEN}{cwd}{RESET}|{gitstatus}\n{BOLD_INTENSE_RED}➤{RESET} ' - -# # Color style to fix unreadable greys -# from xonsh.tools import register_custom_style -# ttm_style = { -# # Put custom overrides here -# # Discover list of styles by running "xonfig colors default" -# # Discover default mappings by cross referencing -# # https://github.com/xonsh/xonsh/blob/main/xonsh/style_tools.py -# # and -# # https://github.com/pygments/pygments/blob/master/pygments/styles/native.py -# } -# register_custom_style("ttm-style", ttm_style) -$XONSH_COLOR_STYLE = "native" -$MULTILINE_PROMPT = " " -# $UPDATE_PROMPT_ON_KEYPRESS = True -# $PROMPT_REFRESH_INTERVAL = 0.25 -# $VI_MODE=True diff --git a/xonsh/python.xsh b/xonsh/python.xsh deleted file mode 100644 index 35c41aa..0000000 --- a/xonsh/python.xsh +++ /dev/null @@ -1,23 +0,0 @@ -def _vv(): - """Finds the nearest venv going upward in the directory hierarchy and activates it.""" - d = Path.cwd() - - while True: - if (d / "venv").exists(): - vox activate @(str(d / "venv")) - return True - - if d == d.parent or (d / ".git").exists(): - print("Could not find venv.") - return False - - d = d.parent - - -def _setup_python_direnv(): - echo "layout python3" >> .envrc - direnv allow - - -aliases["vv"] = _vv -aliases["penv"] = _setup_python_direnv diff --git a/xonsh/rc.xsh b/xonsh/rc.xsh deleted file mode 100644 index bb68c0a..0000000 --- a/xonsh/rc.xsh +++ /dev/null @@ -1,38 +0,0 @@ -# Pip dependencies listed in requirements.txt -_xontribs = [ - "fzf-widgets", - "direnv", - "vox", -] - -$fzf_history_binding = "c-r" - -if _xontribs: - xontrib load @(_xontribs) - -$UPDATE_OS_ENVIRON = False -$XONSH_SHOW_TRACEBACK = False -$XONSH_HISTORY_BACKEND = "sqlite" -$HISTCONTROL = "ignoredups" -$XONSH_COPY_ON_DELETE = True - -$AUTO_CD = True - -$MANPAGER = "less -X" -$LESS = "--ignore-case --QUIET --RAW-CONTROL-CHARS" - -$EDITOR = "vim" -$ALTERNATE_EDITOR = "vim" -$TERMINAL = "kitty" - -config_dir = p"~/.dotfiles/xonsh" -xsh_modules = ["prompt", "bindings", "path", "alias", "java", "linux", "python", "local", "docker", "kitty", "nix"] - -for module in xsh_modules: - _p = config_dir / f"{module}.xsh" - if _p.exists(): - source @(_p) - -# autojump equivalent -if !(which zoxide): - execx($(zoxide init xonsh --cmd j --hook prompt), 'exec', __xonsh__.ctx, filename='zoxide') diff --git a/xonsh/requirements.txt b/xonsh/requirements.txt deleted file mode 100644 index e746c66..0000000 --- a/xonsh/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -xonsh[full] -xontrib-fzf-widgets -xonsh-direnv