mirror of
https://codeberg.org/hyperreal/dotfiles
synced 2024-11-01 08:43:08 +01:00
Update the dots
This commit is contained in:
parent
757cce1bc4
commit
9a9daaa2d7
171
.doom.d/config.el
Normal file
171
.doom.d/config.el
Normal file
@ -0,0 +1,171 @@
|
||||
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; Some functionality uses this to identify you, e.g. GPG configuration, email
|
||||
;; clients, file templates and snippets. It is optional.
|
||||
(setq user-full-name "Jeffrey Serio"
|
||||
user-mail-address "hyperreal@fedoraproject.org")
|
||||
|
||||
;; See 'C-h v doom-font' for documentation and more examples of what they
|
||||
;; accept. For example:
|
||||
(if (eq system-type 'darwin)
|
||||
(setq doom-font (font-spec :family "JetBrainsMono Nerd Font Mono" :size 14)
|
||||
doom-variable-pitch-font (font-spec :family "Rubik")
|
||||
doom-unicode-font (font-spec :family "JetBrainsMono Nerd Font Mono" :size 14)
|
||||
doom-big-font (font-spec :family "JetBrainsMono Nerd Font Mono" :size 14))
|
||||
(setq doom-font (font-spec :family "JetBrainsMono Nerd Font Mono" :size 28)
|
||||
doom-variable-pitch-font (font-spec :family "Rubik")
|
||||
doom-unicode-font (font-spec :family "JetBrainsMono Nerd Font Mono" :size 28)
|
||||
doom-big-font (font-spec :family "JetBrainsMono Nerd Font Mono" :size 28)))
|
||||
|
||||
;; Use catppuccin-mocha theme
|
||||
(setq doom-theme 'catppuccin-mocha)
|
||||
|
||||
;; 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 'relative)
|
||||
|
||||
;; 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 "~/Nextcloud/org/")
|
||||
|
||||
;; Set bpython as Python shell interpreter
|
||||
(add-hook! python-mode-hook
|
||||
(setq python-shell-interpreter "bpython"))
|
||||
|
||||
;; Make vterm open in another window
|
||||
(setq vterm-other-window 1)
|
||||
|
||||
;; Keybinding to kill-whole-line
|
||||
(global-set-key (kbd "M-9") 'kill-whole-line)
|
||||
|
||||
;; Popup rule for yasnippet
|
||||
(defun yas-popup-isearch-prompt (prompt choices &optional display-fn)
|
||||
(when (featurep 'popup)
|
||||
(popup-menu*
|
||||
(mapcar
|
||||
(lambda (choice)
|
||||
(popup-make-item
|
||||
(or (and display-fn (funcall display-fn choice))
|
||||
choice)
|
||||
:value choice))
|
||||
choices)
|
||||
:prompt prompt
|
||||
;; start isearch mode immediately
|
||||
:isearch t
|
||||
)))
|
||||
(setq yas-prompt-functions '(yas-popup-isearch-prompt yas-maybe-ido-prompt yas-completing-prompt yas-no-prompt))
|
||||
|
||||
;; Copy all or text selection
|
||||
(defun xah-copy-all-or-region ()
|
||||
"Put the whole buffer content to `kill-ring', or text selection if there's one.
|
||||
Respects `narrow-to-region'.
|
||||
URL `https://ergomacs.org/emacs/emacs_copy_cut_all_or_region.html'
|
||||
Version 2015-08-22"
|
||||
(interactive)
|
||||
(if (use-region-p)
|
||||
(progn
|
||||
(kill-new (buffer-substring (region-beginning) (region-end)))
|
||||
(message "Text selection copied."))
|
||||
(progn
|
||||
(kill-new (buffer-string))
|
||||
(message "Buffer content copied."))))
|
||||
|
||||
;; Cut all or text selection
|
||||
(defun xah-cut-all-or-region ()
|
||||
"Cut the whole buffer content to `kill-ring', or text selection if there's one.
|
||||
Respects `narrow-to-region'.
|
||||
URL `https://ergomacs.org/emacs/emacs_copy_cut_all_or_region.html'
|
||||
Version 2015-08-22"
|
||||
(interactive)
|
||||
(if (use-region-p)
|
||||
(progn
|
||||
(kill-new (buffer-substring (region-beginning) (region-end)))
|
||||
(delete-region (region-beginning) (region-end)))
|
||||
(progn
|
||||
(kill-new (buffer-string))
|
||||
(delete-region (point-min) (point-max)))))
|
||||
|
||||
;; Set Firefox as default web browser
|
||||
(if (eq system-type 'darwin)
|
||||
(setq browse-url-browser-function 'browse-url-default-macosx-browser)
|
||||
(setq browse-url-browser-function 'browse-host-firefox))
|
||||
|
||||
(defun browse-host-firefox (url &rest ignore)
|
||||
"Browse URL with the host's Firefox using distrobox-exec."
|
||||
(interactive "sURL: ")
|
||||
(shell-command (concat "distrobox-host-exec firefox " url)))
|
||||
|
||||
;; after copy Ctrl+c in Linux X11, you can paste by `yank' in emacs
|
||||
(setq select-enable-clipboard t)
|
||||
|
||||
;; after mouse selection copy in X11, you can paste by `yank' in emacs
|
||||
(setq select-enable-primary t)
|
||||
|
||||
;; set keybinding for paste
|
||||
(global-set-key (kbd "C-S-V") #'clipboard-yank)
|
||||
|
||||
;; Smart home key
|
||||
(defun smart-beginning-of-line ()
|
||||
"Move point to first non-whitespace character or beginning-of-line.
|
||||
|
||||
Move point to the first non-whitespace character on this line.
|
||||
If point was already at that position, move point to beginning of line."
|
||||
(interactive "^")
|
||||
(let ((oldpos (point)))
|
||||
(back-to-indentation)
|
||||
(and (= oldpos (point))
|
||||
(beginning-of-line))))
|
||||
|
||||
(global-set-key (kbd "<home>") 'smart-beginning-of-line)
|
||||
(global-set-key (kbd "<end>") 'end-of-line)
|
||||
|
||||
;; Autoformat on save
|
||||
(setq +format-on-save-enabled-modes
|
||||
'(emacs-lisp-mode
|
||||
python-mode))
|
||||
|
||||
(setq-hook! 'python-mode-hook +format-with 'black)
|
||||
|
||||
;; org-mode, close items with timestamp
|
||||
(setq org-log-done 'time)
|
||||
|
||||
;; open Emacs in a maxmimized window
|
||||
(add-to-list 'default-frame-alist '(fullscreen . maximized))
|
||||
|
||||
;; mastodon
|
||||
(setq mastodon-instance-url "https://fosstodon.org"
|
||||
mastodon-active-user "hyperreal")
|
||||
|
||||
;; use gemtext2md to convert gmi to md and move to zola main site directory
|
||||
(defun gemini-to-zola-main ()
|
||||
"Convert gmi to md, send to zola main site content directory, and open file
|
||||
to edit frontmatter."
|
||||
(interactive)
|
||||
(setq filename-prefix "~/Nextcloud/sites/hyperreal.coffee/content/")
|
||||
(setq filename (concat filename-prefix (file-name-base buffer-file-name) ".md"))
|
||||
(async-shell-command (concat "gemtext2md < " (buffer-file-name) " > " filename))
|
||||
(find-file filename))
|
||||
|
||||
;; use gemtext2md to convert gmi to md and move to zola reads site directory
|
||||
(defun gemini-to-zola-reads ()
|
||||
"Convert gmi to md, send to zola reads site content directory, and open file
|
||||
to edit frontmatter."
|
||||
(interactive)
|
||||
(setq filename-prefix "~/Nextcloud/sites/reads.hyperreal.coffee/content/")
|
||||
(setq filename (concat filename-prefix (file-name-base buffer-file-name) ".md"))
|
||||
(async-shell-command (concat "gemtext2md < " (buffer-file-name) " > " filename))
|
||||
(find-file filename))
|
||||
|
||||
;; Build zola main site
|
||||
(defun build-zola-main ()
|
||||
"Build zola main site."
|
||||
(interactive)
|
||||
(let ((default-directory "~/Nextcloud/sites/hyperreal.coffee"))
|
||||
(async-shell-command (concat "zola build -o ~/public/html"))))
|
||||
|
||||
;; Build zola reads site
|
||||
(defun build-zola-reads ()
|
||||
"Build zola reads site."
|
||||
(interactive)
|
||||
(let ((default-directory "~/Nextcloud/sites/reads.hyperreal.coffee"))
|
||||
(async-shell-command (concat "zola build -o ~/public/reads"))))
|
194
.doom.d/init.el
Normal file
194
.doom.d/init.el
Normal file
@ -0,0 +1,194 @@
|
||||
;;; 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 a link to Doom's Module Index where all
|
||||
;; of our modules are listed, including what flags they support.
|
||||
|
||||
;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or
|
||||
;; 'C-c c 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 c d') on a module to browse its
|
||||
;; directory (for easy access to its source code).
|
||||
|
||||
(doom! :input
|
||||
;;bidi ; (tfel ot) thgir etirw uoy gnipleh
|
||||
;;chinese
|
||||
;;japanese
|
||||
;;layout ; auie,ctsrnm is the superior home row
|
||||
|
||||
:completion
|
||||
company ; the ultimate code completion backend
|
||||
;;helm ; the *other* search engine for love and life
|
||||
;;ido ; the other *other* search engine...
|
||||
;;ivy ; a search engine for love and life
|
||||
vertico ; the search engine of the future
|
||||
|
||||
:ui
|
||||
;;deft ; notational velocity for Emacs
|
||||
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
|
||||
(emoji +unicode) ; 🙂
|
||||
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
|
||||
;;hydra
|
||||
;;indent-guides ; highlighted indent columns
|
||||
ligatures ; ligatures and symbols to make your code pretty again
|
||||
;;minimap ; show a map of the code on the side
|
||||
modeline ; snazzy, Atom-inspired modeline, plus API
|
||||
;;nav-flash ; blink cursor line after big motions
|
||||
;;neotree ; a project drawer, like NERDTree for vim
|
||||
ophints ; highlight the region an operation acts on
|
||||
(popup +defaults) ; tame sudden yet inevitable temporary windows
|
||||
;;tabs ; a tab bar for Emacs
|
||||
;;treemacs ; a project drawer, like neotree but cooler
|
||||
;;unicode ; extended unicode support for various languages
|
||||
(vc-gutter +pretty) ; 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
|
||||
;;zen ; distraction-free coding or writing
|
||||
|
||||
:editor
|
||||
;;(evil +everywhere); come to the dark side, we have cookies
|
||||
file-templates ; auto-snippets for empty files
|
||||
fold ; (nigh) universal code folding
|
||||
(format +onsave) ; automated prettiness
|
||||
;;god ; run Emacs commands without modifier keys
|
||||
;;lispy ; vim for lisp, for people who don't like vim
|
||||
;;multiple-cursors ; editing in many places at once
|
||||
;;objed ; text object editing for the innocent
|
||||
;;parinfer ; 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 ; making dired pretty [functional]
|
||||
electric ; smarter, keyword-based electric-indent
|
||||
;;ibuffer ; interactive buffer management
|
||||
undo ; persistent, smarter undo for your inevitable mistakes
|
||||
vc ; version-control and Emacs, sitting in a tree
|
||||
|
||||
:term
|
||||
eshell ; the elisp shell that works everywhere
|
||||
;;shell ; simple shell REPL for Emacs
|
||||
;;term ; basic terminal emulator for Emacs
|
||||
vterm ; the best terminal emulation in Emacs
|
||||
|
||||
:checkers
|
||||
syntax ; tasing you for every semicolon you forget
|
||||
;;(spell +flyspell) ; tasing you for misspelling mispelling
|
||||
;;grammar ; tasing grammar mistake every you make
|
||||
|
||||
:tools
|
||||
ansible
|
||||
;;biblio ; Writes a PhD for you (citation needed)
|
||||
;;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 ; M-x vscode
|
||||
magit ; a git porcelain for Emacs
|
||||
make ; run make tasks from Emacs
|
||||
pass ; password manager for nerds
|
||||
;;pdf ; pdf enhancements
|
||||
;;prodigy ; FIXME managing external services & code builders
|
||||
;;rgb ; creating color strings
|
||||
;;taskrunner ; taskrunner for all your projects
|
||||
;;terraform ; infrastructure as code
|
||||
;;tmux ; an API for interacting with tmux
|
||||
tree-sitter ; syntax and parsing, sitting in a tree...
|
||||
;;upload ; map local to remote projects via ssh/ftp
|
||||
|
||||
:os
|
||||
(:if IS-MAC macos) ; improve compatibility with macOS
|
||||
;;tty ; improve the terminal Emacs experience
|
||||
|
||||
:lang
|
||||
;;agda ; types of types of types of types...
|
||||
;;beancount ; mind the GAAP
|
||||
;;(cc +lsp) ; C > C++ == 1
|
||||
;;clojure ; java with a lisp
|
||||
;;common-lisp ; if you've seen one lisp, you've seen them all
|
||||
;;coq ; proofs-as-programs
|
||||
;;crystal ; ruby at the speed of c
|
||||
;;csharp ; unity, .NET, and mono shenanigans
|
||||
data ; config/data formats
|
||||
;;(dart +flutter) ; paint ui and not much else
|
||||
;;dhall
|
||||
;;elixir ; erlang done right
|
||||
;;elm ; care for a cup of TEA?
|
||||
emacs-lisp ; drown in parentheses
|
||||
;;erlang ; an elegant language for a more civilized age
|
||||
;;ess ; emacs speaks statistics
|
||||
;;factor
|
||||
;;faust ; dsp, but you get to keep your soul
|
||||
;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER)
|
||||
;;fsharp ; ML stands for Microsoft's Language
|
||||
;;fstar ; (dependent) types and (monadic) effects and Z3
|
||||
;;gdscript ; the language you waited for
|
||||
;;(go +lsp) ; the hipster dialect
|
||||
;;(graphql +lsp) ; Give queries a REST
|
||||
;;(haskell +lsp) ; a language that's lazier than I am
|
||||
;;hy ; readability of scheme w/ speed of python
|
||||
;;idris ; a language you can depend on
|
||||
json ; At least it ain't XML
|
||||
;;(java +lsp) ; the poster child for carpal tunnel syndrome
|
||||
;;javascript ; all(hope(abandon(ye(who(enter(here))))))
|
||||
;;julia ; a better, faster MATLAB
|
||||
;;kotlin ; a better, slicker Java(Script)
|
||||
;;latex ; writing papers in Emacs has never been so fun
|
||||
;;lean ; for folks with too much to prove
|
||||
;;ledger ; be audit you can be
|
||||
;;lua ; one-based indices? one-based indices
|
||||
markdown ; writing docs for people to ignore
|
||||
;;nim ; python + lisp at the speed of c
|
||||
;;nix ; I hereby declare "nix geht mehr!"
|
||||
;;ocaml ; an objective camel
|
||||
(org +pretty) ; organize your plain life in plain text
|
||||
;;php ; perl's insecure younger brother
|
||||
;;plantuml ; diagrams for confusing people more
|
||||
;;purescript ; javascript, but functional
|
||||
python ; beautiful is better than ugly
|
||||
;;qt ; the 'cutest' gui framework ever
|
||||
;;racket ; a DSL for DSLs
|
||||
;;raku ; the artist formerly known as perl6
|
||||
rest ; Emacs as a REST client
|
||||
;;rst ; ReST in peace
|
||||
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
|
||||
(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
|
||||
;;scala ; java, but good
|
||||
;;(scheme +guile) ; a fully conniving family of lisps
|
||||
sh ; she sells {ba,z,fi}sh shells on the C xor
|
||||
;;sml
|
||||
;;solidity ; do you need a blockchain? No.
|
||||
;;swift ; who asked for emoji variables?
|
||||
;;terra ; Earth and Moon in alignment for performance.
|
||||
;;web ; the tubes
|
||||
yaml ; JSON, but readable
|
||||
;;zig ; C, but simpler
|
||||
|
||||
:email
|
||||
;;(mu4e +org +gmail)
|
||||
notmuch
|
||||
;;(wanderlust +gmail)
|
||||
|
||||
:app
|
||||
;;calendar
|
||||
;;emms
|
||||
;;everywhere ; *leave* Emacs!? You must be joking
|
||||
;;irc ; how neckbeards socialize
|
||||
;;rss ; emacs as an RSS reader
|
||||
;;twitter ; twitter client https://twitter.com/vnought
|
||||
|
||||
:config
|
||||
;;literate
|
||||
(default +bindings +smartparens))
|
64
.doom.d/packages.el
Normal file
64
.doom.d/packages.el
Normal file
@ -0,0 +1,64 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; $DOOMDIR/packages.el
|
||||
|
||||
;; To install a package with Doom you must declare them here and run 'doom sync'
|
||||
;; on the command line, then restart Emacs for the changes to take effect -- or
|
||||
;; use 'M-x doom/reload'.
|
||||
|
||||
|
||||
;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
|
||||
;(package! some-package)
|
||||
(package! autothemer)
|
||||
(package! catppuccin-theme)
|
||||
(package! elpher)
|
||||
;;(package! gemini :recipe
|
||||
;; (:host nil :repo "https://git.carcosa.net/jmcbray/gemini.el"))
|
||||
(package! python-docstring)
|
||||
(package! importmagic)
|
||||
(package! systemd)
|
||||
(package! license-templates)
|
||||
(package! shell-pop)
|
||||
(package! fzf)
|
||||
(package! mastodon)
|
||||
(package! nushell-mode :recipe
|
||||
(:host github :repo "azzamsa/emacs-nushell"))
|
||||
|
||||
;; To install a package directly from a remote git repo, you must specify a
|
||||
;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
|
||||
;; https://github.com/radian-software/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, you can do so here
|
||||
;; with the `:disable' property:
|
||||
;(package! builtin-package :disable t)
|
||||
|
||||
;; 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 radian-software/straight.el#279)
|
||||
;(package! builtin-package :recipe (:branch "develop"))
|
||||
|
||||
;; Use `:pin' to specify a particular commit to install.
|
||||
;(package! builtin-package :pin "1a2b3c4d5e")
|
||||
|
||||
|
||||
;; Doom's packages are pinned to a specific commit and updated from release to
|
||||
;; release. The `unpin!' macro allows you to unpin single packages...
|
||||
;(unpin! pinned-package)
|
||||
;; ...or multiple packages
|
||||
;(unpin! pinned-package another-pinned-package)
|
||||
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
|
||||
;(unpin! t)
|
37
.zshenv
37
.zshenv
@ -7,9 +7,6 @@ typeset -U PATH path
|
||||
path=("/usr/local/bin" "/usr/local/sbin")
|
||||
path+=("/bin" "/sbin" "/usr/bin" "/usr/sbin")
|
||||
|
||||
# Add nimble (Nim) to PATH
|
||||
[ -d "${HOME}/.nimble/bin" ] && path+=("${HOME}/.nimble/bin")
|
||||
|
||||
# Set Go path if it exist
|
||||
[ -d "${HOME}/go" ] && GOPATH="${HOME}/go" && path+=("${GOPATH}/bin")
|
||||
|
||||
@ -31,32 +28,26 @@ if [[ -x $(which most) ]]; then
|
||||
else
|
||||
export PAGER="less -X"
|
||||
export MANPAGER="less -iMXF"
|
||||
|
||||
if [[ $terminfo[colors] -ge 8 ]]; then
|
||||
export LESS_TERMCAP_mb=$'\E[01;31m'
|
||||
export LESS_TERMCAP_md=$'\E[01;31m'
|
||||
export LESS_TERMCAP_me=$'\E[0m'
|
||||
export LESS_TERMCAP_se=$'\E[0m'
|
||||
export LESS_TERMCAP_so=$'\E[01;44;33m'
|
||||
export LESS_TERMCAP_ue=$'\E[0m'
|
||||
export LESS_TERMCAP_us=$'\E[01;32m'
|
||||
fi
|
||||
fi
|
||||
|
||||
# Editor - Neovim, else nano
|
||||
if test -x "$(command -v nvim)"; then
|
||||
EDITOR=nvim
|
||||
elif test -x "$(command -v vim)"; then
|
||||
EDITOR=vim
|
||||
# Editor - emacs else nano
|
||||
if test -x "$(command -v emacs)"; then
|
||||
EDITOR="emacs"
|
||||
else
|
||||
EDITOR=nano
|
||||
fi
|
||||
|
||||
export EDITOR
|
||||
|
||||
# lscolors (generated from vivid)
|
||||
if [ -f ~/.lscolors.sh ]; then
|
||||
export LS_COLORS=$(cat ~/.lscolors.sh)
|
||||
# Set TERM if in tmux
|
||||
if (( ${+TMUX} )); then
|
||||
export TERM="screen-256color"
|
||||
else
|
||||
export TERM="xterm-256color"
|
||||
fi
|
||||
|
||||
# Directory for elogs
|
||||
if test -d "${HOME}/Nextcloud/elogs"; then
|
||||
export ELOG_DIR="${HOME}/Nextcloud/elogs"
|
||||
fi
|
||||
|
||||
# Format of process time reports with 'time'
|
||||
@ -111,5 +102,3 @@ export BAT_THEME="Catppuccin"
|
||||
|
||||
# Automatically remove duplicates from these arrays
|
||||
typeset -gU path cdpath manpath fpath
|
||||
|
||||
# vim:set ft=zsh ai et sw=4 ts=4:
|
||||
|
17
.zshrc
17
.zshrc
@ -48,9 +48,6 @@ fi
|
||||
|
||||
source ~/.zplug/init.zsh
|
||||
|
||||
# Load file from ~/.zshrc.d
|
||||
zplug "~/.zshrc.d", from:local, use:'*'
|
||||
|
||||
# Use autosuggestions when typing commands
|
||||
zplug "zsh-users/zsh-autosuggestions"
|
||||
|
||||
@ -69,6 +66,9 @@ zplug "plugins/systemd", from:oh-my-zsh
|
||||
# Directory bookmarks using FZF
|
||||
zplug "urbainvaes/fzf-marks"
|
||||
|
||||
# Load file from ~/.zshrc.d
|
||||
zplug "~/.zshrc.d", from:local, use:'*'
|
||||
|
||||
if ! zplug check; then
|
||||
zplug install;
|
||||
exec $SHELL $SHELL_ARGS "$@"
|
||||
@ -79,7 +79,12 @@ zplug load
|
||||
# lscolors.sh
|
||||
export LS_COLORS=$(cat ~/.lscolors.sh)
|
||||
|
||||
# starship.rs prompt
|
||||
eval "$(starship init zsh)"
|
||||
# linuxbrew if on moonshadow.local
|
||||
if [ "$(hostname)" = "moonshadow.local" ]; then
|
||||
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||
fi
|
||||
|
||||
# vim:set ft=zsh ai et sw=4 ts=4:
|
||||
# starship.rs
|
||||
if [ -x "$(command -v starship)" ]; then
|
||||
eval "$(starship init zsh)"
|
||||
fi
|
||||
|
@ -121,9 +121,6 @@ alias shut='sudo systemctl poweroff'
|
||||
alias gpgs='gpg --search-keys'
|
||||
alias gpgl='gpg --list-keys --with-fingerprint'
|
||||
|
||||
# Suffix aliases
|
||||
alias -s {conf,config,cfg,md,rc,txt,zshrc}="nvim"
|
||||
|
||||
# firewalld
|
||||
if test -x "$(command -v firewall-cmd)"; then
|
||||
alias fw='sudo firewall-cmd'
|
||||
@ -145,4 +142,11 @@ alias grm='git rm'
|
||||
alias grv='git remote -v'
|
||||
alias gst='git status'
|
||||
|
||||
# vim:set ft=zsh ai et sw=4 ts=4:
|
||||
# doom emacs
|
||||
alias doomdoc="~/.emacs.d/bin/doom doctor"
|
||||
alias dsync="~/.emacs.d/bin/doom sync"
|
||||
alias dclean="~/.emacs.d/bin/doom clean"
|
||||
alias dcomp="~/.emacs.d/bin/doom compile"
|
||||
alias dpurge="~/.emacs.d/bin/doom purge"
|
||||
alias denv="~/.emacs.d/bin/doom env"
|
||||
alias dupgrade="~/.emacs.d/bin/doom upgrade"
|
@ -17,5 +17,3 @@ fi
|
||||
## history substring search
|
||||
bindkey '^[[1;5A' history-substring-search-up
|
||||
bindkey '^[[1;5B' history-substring-search-down
|
||||
|
||||
# vim:set ft=zsh ai et sw=4 ts=4:
|
@ -1,23 +1,47 @@
|
||||
# snakify filenames
|
||||
snakify () {
|
||||
emulate -L zsh
|
||||
local filename=$(basename -- "$1")
|
||||
local extension="${filename##*.}"
|
||||
local filename="${filename%.*}"
|
||||
local new_filename=$(echo ${filename// /_} | tr '-' '_' | tr -cd '[:alnum:]._-')
|
||||
local new_basename=$(echo "$new_filename.$extension")
|
||||
mv -i "$1" "$new_basename"
|
||||
mv -i "$new_basename" "${new_basename:l}"
|
||||
# Mullvad VPN checker.
|
||||
function mullvad() {
|
||||
echo ""
|
||||
python3 <(cat <<EOF
|
||||
|
||||
from rich import print
|
||||
from rich.panel import Panel
|
||||
import json, urllib.request
|
||||
|
||||
with urllib.request.urlopen("https://am.i.mullvad.net/json") as url:
|
||||
data = json.load(url)
|
||||
|
||||
print(
|
||||
Panel.fit(
|
||||
"[white]{0}\n{1}[/white]\n[cyan]{2}[/cyan]\n[blue]{3}[/blue]".format(
|
||||
data["ip"], data["city"], data["mullvad_exit_ip_hostname"], data["mullvad_server_type"]
|
||||
), title="Mullvad connection", style="bold green"
|
||||
)
|
||||
)
|
||||
EOF
|
||||
)
|
||||
}
|
||||
|
||||
# Print timestamp
|
||||
tstamp() {
|
||||
# Snakify filenames.
|
||||
function snakify () {
|
||||
emulate -L zsh
|
||||
local filename=$(basename -- "$1")
|
||||
local extension="${filename##*.}"
|
||||
local filename="${filename%.*}"
|
||||
local new_filename=$(echo ${filename// /_} | tr '-' '_' | tr -cd '[:alnum:]._-')
|
||||
local new_basename=$(echo "$new_filename.$extension")
|
||||
mv -i "$1" "$new_basename"
|
||||
mv -i "$new_basename" "${new_basename:l}"
|
||||
}
|
||||
|
||||
# Print timestamp as %Y-%m-%d %H:%M:%S.
|
||||
function tstamp() {
|
||||
emulate -L zsh
|
||||
date '+%Y-%m-%d %H:%M:%S'
|
||||
}
|
||||
|
||||
# Lifted from strcat.de
|
||||
# Find history events by search pattern and list them by date.
|
||||
whatwhen () {
|
||||
function whatwhen () {
|
||||
emulate -L zsh
|
||||
local usage help ident format_l format_s first_char remain first last
|
||||
usage='USAGE: whatwhen [options] <searchstring> <search range>'
|
||||
@ -64,9 +88,9 @@ whatwhen () {
|
||||
esac
|
||||
}
|
||||
|
||||
alias x=extract
|
||||
|
||||
extract() {
|
||||
# Lifted from the extract plugin for oh-my-zsh.
|
||||
# Extract archive into current directory.
|
||||
function extract() {
|
||||
setopt localoptions noautopushd
|
||||
|
||||
if (( $# == 0 )); then
|
||||
@ -149,31 +173,30 @@ EOF
|
||||
builtin cd -q "$pwd"
|
||||
done
|
||||
}
|
||||
alias x=extract
|
||||
|
||||
# ARCHIVE: Create a tarball from given directory
|
||||
function create-archive()
|
||||
{
|
||||
local archive_name
|
||||
archive_name="$1.tar.gz"
|
||||
archive_name=${archive_name/\//}
|
||||
tar cvfz "$archive_name" "$1"
|
||||
echo "Created archive $archive_name"
|
||||
# Create a tarball from given directory.
|
||||
function create-archive() {
|
||||
local archive_name
|
||||
archive_name="$1.tar.gz"
|
||||
archive_name=${archive_name/\//}
|
||||
tar cvfz "$archive_name" "$1"
|
||||
echo "Created archive $archive_name"
|
||||
}
|
||||
compdef _directories create-archive
|
||||
|
||||
# Create a /overview/ of all available function()'s; the description for
|
||||
# each funtion() *must* be the first line above the string `function'!
|
||||
# Otherwise it wont work.
|
||||
# Display all function()'s with her descriptions
|
||||
function funlist()
|
||||
{
|
||||
grep -B 1 "^function" $HOME/.zshrc.d/zshfunctions | \
|
||||
grep -v "^\-\-$" | \
|
||||
awk '{ if(/^#/) { gsub(/^#[:space:]*/, ""); ht=$0 }; getline; gsub(/ ?\(\)/, ":"); printf("-> %-20s %s\n", $2, ht); }' | \
|
||||
sort -u -k 3
|
||||
# Display all function()'s with their descriptions.
|
||||
function funlist() {
|
||||
grep -B 1 "^function" $HOME/.zshrc.d/functions.zsh | \
|
||||
grep -v "^\-\-$" | \
|
||||
awk '{ if(/^#/) { gsub(/^#[:space:]*/, ""); ht=$0 }; getline; gsub(/ ?\(\)/, ":"); printf("-> %-20s %s\n", $2, ht); }' | \
|
||||
sort -u -k 3
|
||||
}
|
||||
|
||||
# show directory stack and ask for a dir to switch to
|
||||
# Show directory stack and ask for a dir to switch to.
|
||||
function dstack() {
|
||||
emulate -L zsh
|
||||
autoload -U colors
|
||||
@ -181,22 +204,22 @@ function dstack() {
|
||||
integer i=0
|
||||
dirs -p | while read dir
|
||||
do
|
||||
local num="${$(printf "%-4d " $i)/ /.}"
|
||||
printf " %s $color%s$reset_color\n" $num $dir
|
||||
(( i++ ))
|
||||
local num="${$(printf "%-4d " $i)/ /.}"
|
||||
printf " %s $color%s$reset_color\n" $num $dir
|
||||
(( i++ ))
|
||||
done
|
||||
integer dir=-1
|
||||
read -r 'dir?Jump to directory: ' || return
|
||||
(( dir == -1 )) && return
|
||||
if (( dir < 0 || dir >= i ))
|
||||
then
|
||||
echo d: no such directory stack entry: $dir
|
||||
return 1
|
||||
echo d: no such directory stack entry: $dir
|
||||
return 1
|
||||
fi
|
||||
cd ~$dir
|
||||
}
|
||||
|
||||
# zremovecomp() remove *.zwc files
|
||||
# zremovecomp() remove *.zwc files.
|
||||
function zremovecomp() {
|
||||
local i
|
||||
for i in ${HOME}/*.zwc(N); do
|
||||
@ -205,56 +228,54 @@ function zremovecomp() {
|
||||
done
|
||||
}
|
||||
|
||||
# grep(1)'ing $HISTFILE
|
||||
histgrep () { fc -fl -m "*(#i)$1*" 1 | grep -i --color $1 }
|
||||
# grep(1)'ing $HISTFILE.
|
||||
function histgrep () { fc -fl -m "*(#i)$1*" 1 | grep -i --color $1 }
|
||||
|
||||
# A nicer output of cal(1)
|
||||
# MISC: Colorize the output of cal(1)
|
||||
# Colorize the output of cal(1).
|
||||
function calendar() {
|
||||
if [[ ! -f /usr/bin/cal ]] ; then
|
||||
echo "Please install cal before trying to use it!"
|
||||
return
|
||||
fi
|
||||
if [[ "$#" = "0" ]] ; then
|
||||
/usr/bin/cal | egrep -C 40 --color "\<$(date +%e| tr -d ' ')\>"
|
||||
else
|
||||
/usr/bin/cal $@ | egrep -C 40 --color "\<($(date +%B)|$(date +%e | tr -d ' '))\>"
|
||||
fi
|
||||
if [[ ! -f /usr/bin/cal ]] ; then
|
||||
echo "Please install cal before trying to use it!"
|
||||
return
|
||||
fi
|
||||
if [[ "$#" = "0" ]] ; then
|
||||
/usr/bin/cal | egrep -C 40 --color "\<$(date +%e| tr -d ' ')\>"
|
||||
else
|
||||
/usr/bin/cal $@ | egrep -C 40 --color "\<($(date +%B)|$(date +%e | tr -d ' '))\>"
|
||||
fi
|
||||
}
|
||||
|
||||
# PROG: invoke this every time when u change .zshrc to recompile it.
|
||||
function src()
|
||||
{
|
||||
autoload -U zrecompile
|
||||
[ -f ~/.zshrc ] && zrecompile -p ~/.zshrc
|
||||
[ -f ~/.zcompdump ] && zrecompile -p ~/.zcompdump
|
||||
[ -f ~/.zcompdump ] && zrecompile -p ~/.zcompdump
|
||||
[ -f ~/.zshrc.zwc.old ] && command rm -f ~/.zshrc.zwc.old
|
||||
[ -f ~/.zcompdump.zwc.old ] && command rm -f ~/.zcompdump.zwc.old
|
||||
source ~/.zshrc
|
||||
# Invoke this every time you change .zshrc to recompile it.
|
||||
function src() {
|
||||
autoload -U zrecompile
|
||||
[ -f ~/.zshrc ] && zrecompile -p ~/.zshrc
|
||||
[ -f ~/.zcompdump ] && zrecompile -p ~/.zcompdump
|
||||
[ -f ~/.zcompdump ] && zrecompile -p ~/.zcompdump
|
||||
[ -f ~/.zshrc.zwc.old ] && command rm -f ~/.zshrc.zwc.old
|
||||
[ -f ~/.zcompdump.zwc.old ] && command rm -f ~/.zcompdump.zwc.old
|
||||
source ~/.zshrc
|
||||
}
|
||||
|
||||
# Do an ls after cd
|
||||
cd() { builtin cd "$@" && ls; }
|
||||
# Do an ls after cd.
|
||||
function cd() { builtin cd "$@" && ls; }
|
||||
|
||||
# Create new directory and enter it
|
||||
mkd() { mkdir -p "$@" && cd "$_"; }
|
||||
# Create new directory and enter it.
|
||||
function mkd() { mkdir -p "$@" && cd "$_"; }
|
||||
|
||||
# pids
|
||||
pids() { pgrep -a "$@"; }
|
||||
# Display pids of commands.
|
||||
function pids() { pgrep -a "$@"; }
|
||||
|
||||
# zshall manpage
|
||||
manzsh() { /usr/bin/man zshall | most +/"$1" ; }
|
||||
# zshall manpage.
|
||||
function manzsh() { /usr/bin/man zshall | most +/"$1" ; }
|
||||
|
||||
# Restart zsh
|
||||
restart() {
|
||||
exec $SHELL $SHELL_ARGS "$@"
|
||||
}
|
||||
# Restart zsh.
|
||||
function restart() { exec $SHELL $SHELL_ARGS "$@"; }
|
||||
|
||||
rsrc() { cd && clear && restart; }
|
||||
# cd to ~, clear screen, and restart zsh.
|
||||
function rsrc() { cd && clear && restart; }
|
||||
|
||||
# Parse HackerNews feed (https://hnrss.org/newest)
|
||||
hn() {
|
||||
# Parse HackerNews feed (https://hnrss.org/newest).
|
||||
function hn() {
|
||||
python3 <(cat <<EOF
|
||||
|
||||
import feedparser
|
||||
@ -273,8 +294,8 @@ EOF
|
||||
) | bat -p
|
||||
}
|
||||
|
||||
# fetch open source license
|
||||
license() {
|
||||
# Fetch open source license.
|
||||
function license() {
|
||||
local base_url
|
||||
base_url="https://api.github.com/licenses"
|
||||
|
||||
@ -295,9 +316,9 @@ license() {
|
||||
echo -e $res | tr -d '"'
|
||||
}
|
||||
|
||||
# use nmap from podman to check for open SSH ports on local net
|
||||
# Use nmap from podman to check for open SSH ports on local net.
|
||||
if test -x "$(command -v podman)"; then
|
||||
nmap_ssh() {
|
||||
function nmap_ssh() {
|
||||
if sudo podman image exists localhost/nmap; then
|
||||
sudo podman run -it --rm \
|
||||
--cap-add=NET_RAW \
|
||||
@ -310,5 +331,3 @@ if test -x "$(command -v podman)"; then
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
# vim:set ft=zsh ai et sw=4 ts=4:
|
@ -1,5 +1,7 @@
|
||||
# ~/.zshrc.d/fzf.zsh
|
||||
|
||||
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
||||
|
||||
## default opts uses Catppuccin (mocha) color palette
|
||||
export FZF_DEFAULT_OPTS='--color=bg+:#302D41,bg:#1E1E2E,spinner:#F8BD96,hl:#F28FAD --color=fg:#D9E0EE,header:#F28FAD,info:#DDB6F2,pointer:#F8BD96 --color=marker:#F8BD96,fg+:#F2CDCD,prompt:#DDB6F2,hl+:#F28FAD'
|
||||
|
||||
@ -12,4 +14,16 @@ export FZF_DEFAULT_COMMAND="fd --type f --hidden --follow --exclude .git"
|
||||
## keybinding for fzf-marks
|
||||
bindkey '\eg' fzm
|
||||
|
||||
# vim:set ft=zsh ai et sw=4 ts=4:
|
||||
## page up within tmux enters scroll mode
|
||||
if [ -f ~/.fzf/shell/keybindings.zsh ]; then
|
||||
source ~/.fzf/shell/keybindings.zsh
|
||||
|
||||
page-up-within-tmux() {
|
||||
if (( ${+TMUX} )); then
|
||||
tmux copy-mode -u
|
||||
fi
|
||||
}
|
||||
zle -N page-up-within-tmux
|
||||
|
||||
bindkey "${terminfo[kpp]}" page-up-within-tmux
|
||||
fi
|
@ -149,6 +149,3 @@ setopt extendedhistory
|
||||
|
||||
# Do *not* run all background jobs at a lower nice priority
|
||||
unsetopt bgnice
|
||||
|
||||
# vim:set ft=zsh ai et sw=4 ts=4:
|
||||
|
Loading…
Reference in New Issue
Block a user