summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/alacritty/alacritty.toml7
-rw-r--r--.config/emacs/TODO.org13
-rw-r--r--.config/emacs/init.el235
l---------.config/emacs/lisp/odin-mode.el1
-rw-r--r--.config/emacs/lisp/odin-mode/odin-mode.el311
m---------.config/emacs/lisp/proj0
-rw-r--r--.config/emacs/lisp/toggle-window/toggle-window.el14
-rw-r--r--.config/sway/config15
-rw-r--r--.config/swenu/conf.ini2
-rw-r--r--files/wallpapers/weirdhouse.webpbin0 -> 383558 bytes
-rwxr-xr-xscripts/aimos/alloc7
-rwxr-xr-xscripts/aimos/cnr28
-rwxr-xr-xscripts/aimos/getactivenode2
-rwxr-xr-xscripts/dafny8
-rwxr-xr-xscripts/open-emacs-project4
-rwxr-xr-xscripts/sysinfo38
16 files changed, 568 insertions, 117 deletions
diff --git a/.config/alacritty/alacritty.toml b/.config/alacritty/alacritty.toml
index 8749fba..5766001 100644
--- a/.config/alacritty/alacritty.toml
+++ b/.config/alacritty/alacritty.toml
@@ -5,3 +5,10 @@ import = [
[window]
padding = { x = 5, y = 5 }
+opacity = 1.0
+
+[font]
+size = 13.0
+
+[font.normal]
+family = "Fantasque Sans Mono" \ No newline at end of file
diff --git a/.config/emacs/TODO.org b/.config/emacs/TODO.org
index cb69cc7..a32e507 100644
--- a/.config/emacs/TODO.org
+++ b/.config/emacs/TODO.org
@@ -6,13 +6,14 @@
- [x] vterm and command to open terms
- [x] spacious padding
- [x] basic session management
+- [x] switch to eglot
- [ ] fix cape completions not being active in most buffers
- [ ] dape presets and run config
-- [ ] switch to eglot
- [ ] gptel
-Revamp Session Management System
-- [ ] switch to perject
-- [ ] easy session switcher (yank or replace or something), maybe save frame or placement from last session's frame
-- [ ] session name displayed in modeline
-- [ ] XDG open client which asks which session
+Annoyances:
+- [ ] eglot rename doesn't prompt with existing name (kind of fixed with M-n in prompt)
+- [ ] the function argument information in buffer doesn't always stay. Maybe I should make it pop up
+
+Improvements:
+- [ ] No more package archives, install and vet lisp locally
diff --git a/.config/emacs/init.el b/.config/emacs/init.el
index 9f80569..b6e6b38 100644
--- a/.config/emacs/init.el
+++ b/.config/emacs/init.el
@@ -33,6 +33,11 @@
(run-with-idle-timer 1.2 t 'garbage-collect))
(gc-idle-timer)
+;; diminish
+(use-package diminish
+ :diminish auto-revert-mode
+ :demand t)
+
;; customize in different file
(setq custom-file (expand-file-name "customs.el" user-emacs-directory))
(load custom-file :no-error-if-file-is-missing)
@@ -90,6 +95,7 @@
;; rainbow delimiters
(use-package rainbow-delimiters
+ :diminish
:hook (prog-mode . rainbow-delimiters-mode))
;; ansi color in compilation
@@ -165,10 +171,12 @@
(use-package evil-collection
:after evil
+ :diminish evil-collection-unimpaired-mode
:config
(evil-collection-init))
(use-package evil-paste-indent
+ :diminish
:vc (:url "https://github.com/Schievel1/evil-paste-indent"
:rev :newest)
:config (global-evil-paste-indent-mode t))
@@ -180,6 +188,9 @@
:config
(load-theme 'doom-one))
+;; font
+(add-to-list 'default-frame-alist '(font . "Fantasque Sans Mono-12"))
+
;; (use-package dracula-theme
;; :demand t
;; :config
@@ -220,6 +231,7 @@
;; rainbow mode
(use-package rainbow-mode
+ :diminish rainbow-mode
:hook (after-change-major-mode . rainbow-mode))
;; == minibuffer completion
@@ -291,80 +303,124 @@
:custom
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
+;; == helpful
+(use-package helpful
+ :bind
+ ([remap describe-command] . helpful-command)
+ ([remap describe-function] . helpful-callable)
+ ([remap describe-variable] . helpful-variable)
+ ([remap describe-key] . helpful-key))
+
;; == flycheck
-(use-package flycheck)
+;; (use-package flycheck)
;; == editorconfig
(editorconfig-mode 1)
(add-hook 'prog-mode 'editorconfig-apply)
;; == lsp
-(use-package lsp-mode
- :custom
- (lsp-keymap-prefix "C-c l")
- (lsp-headerline-breadcrumb-enable nil)
- (lsp-completion-enable-additional-text-edit nil)
- (lsp-enable-on-type-formatting nil)
- (lsp-enable-symbol-highlighting nil)
- (lsp-completion-provider :none)
- (lsp-idle-delay 0.1)
- (lsp-enable-indentation nil)
- :hook ((c++-mode . lsp-deferred)
- (c-mode . lsp-deferred)
- (typst-ts-mode . lsp-deferred)
- (java-mode . lsp-deferred))
- :commands lsp
- :bind
- (("C-c s" . lsp-signature-activate)))
+;; (use-package lsp-mode
+;; :custom
+;; (lsp-keymap-prefix "C-c l")
+;; (lsp-headerline-breadcrumb-enable nil)
+;; (lsp-completion-enable-additional-text-edit nil)
+;; (lsp-enable-on-type-formatting nil)
+;; (lsp-enable-symbol-highlighting nil)
+;; (lsp-completion-provider :none)
+;; (lsp-idle-delay 0.1)
+;; (lsp-enable-indentation nil)
+;; :hook ((c++-mode . lsp-deferred)
+;; (c-mode . lsp-deferred)
+;; (typst-ts-mode . lsp-deferred)
+;; (java-mode . lsp-deferred))
+;; :commands lsp
+;; :bind
+;; (("C-c s" . lsp-signature-activate)))
-(use-package lsp-ui
- :after lsp-mode
- :commands lsp-ui-mode
- :hook (lsp-mode . lsp-ui-mode)
- :bind
- (("C-c r" . lsp-ui-peek-find-references)
- ("C-c d" . lsp-ui-peek-find-definitions)))
+;; (use-package lsp-ui
+;; :after lsp-mode
+;; :commands lsp-ui-mode
+;; :hook (lsp-mode . lsp-ui-mode)
+;; :bind
+;; (("C-c r" . lsp-ui-peek-find-references)
+;; ("C-c d" . lsp-ui-peek-find-definitions)))
;; lsp booster
-(setq read-process-output-max (* 1024 1024)) ;; 1mb
-(defun lsp-booster--advice-json-parse (old-fn &rest args)
- "Try to parse bytecode instead of json."
- (or
- (when (equal (following-char) ?#)
- (let ((bytecode (read (current-buffer))))
- (when (byte-code-function-p bytecode)
- (funcall bytecode))))
- (apply old-fn args)))
-(advice-add (if (progn (require 'json)
- (fboundp 'json-parse-buffer))
- 'json-parse-buffer
- 'json-read)
- :around
- #'lsp-booster--advice-json-parse)
-
-(defun lsp-booster--advice-final-command (old-fn cmd &optional test?)
- "Prepend emacs-lsp-booster command to lsp CMD."
- (let ((orig-result (funcall old-fn cmd test?)))
- (if (and (not test?) ;; for check lsp-server-present?
- (not (file-remote-p default-directory)) ;; see lsp-resolve-final-command, it would add extra shell wrapper
- lsp-use-plists
- (not (functionp 'json-rpc-connection)) ;; native json-rpc
- (executable-find "emacs-lsp-booster"))
- (progn
- (when-let ((command-from-exec-path (executable-find (car orig-result)))) ;; resolve command from exec-path (in case not found in $PATH)
- (setcar orig-result command-from-exec-path))
- (message "Using emacs-lsp-booster for %s!" orig-result)
- (cons "emacs-lsp-booster" orig-result))
- orig-result)))
-(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)
+;; (setq read-process-output-max (* 1024 1024)) ;; 1mb
+;; (defun lsp-booster--advice-json-parse (old-fn &rest args)
+;; "Try to parse bytecode instead of json."
+;; (or
+;; (when (equal (following-char) ?#)
+;; (let ((bytecode (read (current-buffer))))
+;; (when (byte-code-function-p bytecode)
+;; (funcall bytecode))))
+;; (apply old-fn args)))
+;; (advice-add (if (progn (require 'json)
+;; (fboundp 'json-parse-buffer))
+;; 'json-parse-buffer
+;; 'json-read)
+;; :around
+;; #'lsp-booster--advice-json-parse)
+
+;; (defun lsp-booster--advice-final-command (old-fn cmd &optional test?)
+;; "Prepend emacs-lsp-booster command to lsp CMD."
+;; (let ((orig-result (funcall old-fn cmd test?)))
+;; (if (and (not test?) ;; for check lsp-server-present?
+;; (not (file-remote-p default-directory)) ;; see lsp-resolve-final-command, it would add extra shell wrapper
+;; lsp-use-plists
+;; (not (functionp 'json-rpc-connection)) ;; native json-rpc
+;; (executable-find "emacs-lsp-booster"))
+;; (progn
+;; (when-let ((command-from-exec-path (executable-find (car orig-result)))) ;; resolve command from exec-path (in case not found in $PATH)
+;; (setcar orig-result command-from-exec-path))
+;; (message "Using emacs-lsp-booster for %s!" orig-result)
+;; (cons "emacs-lsp-booster" orig-result))
+;; orig-result)))
+;; (advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)
;; == eglot
-;; (use-package eglot
-;; :ensure nil
-;; :config
-;; (add-to-list 'eglot-ignored-server-capabilities ':inlayHintProvider)
-;; (add-to-list 'eglot-ignored-server-capabilities ':documentOnTypeFormattingProvider)
-;; (add-hook 'eglot-mode-hook 'flymake-mode))
+(use-package eglot
+ :ensure nil
+ :bind
+ (("C-c l a" . eglot-code-actions))
+ (("C-c l r" . eglot-rename))
+ :hook
+ (eglot-managed-mode . (lambda () (setq-local eldoc-documentation-function 'eldoc-documentation-enthusiast)))
+ (eglot-mode-hook . flymake-mode)
+ :config
+ (add-to-list 'eglot-ignored-server-capabilities ':inlayHintProvider)
+ (add-to-list 'eglot-ignored-server-capabilities ':documentOnTypeFormattingProvider)
+ (add-to-list 'eglot-ignored-server-capabilities ':documentHighlightProvider)
+ (add-to-list 'eglot-server-programs
+ '((c-ts-mode c++-ts-mode c-mode c++-mode)
+ . ("clangd"
+ "-j=8"
+ "--log=error"
+ "--malloc-trim"
+ "--background-index"
+ "--completion-style=detailed"
+ "--pch-storage=memory"
+ "--header-insertion=never"
+ "--header-insertion-decorators=0")))
+ :custom
+ (eglot-send-changes-idle-time 0.1))
+
+(use-package eldoc
+ :ensure nil
+ :config
+ (setq-default eldoc-documentation-strategy 'eldoc-documentation-enthusiast)
+ (setq-default eldoc-minor-mode-string ""))
+
+(use-package sideline-flymake)
+(use-package sideline
+ :diminish
+ :hook
+ ((flymake-mode . sideline-mode))
+ :init
+ (setq sideline-backends-right '(sideline-flymake)
+ sideline-backends-right-skip-current-line nil
+ sideline-order-right 'up
+ sideline-priority 100))
;; == dumb jump
(use-package dumb-jump
@@ -391,20 +447,27 @@
:init
(add-hook 'completion-at-point-functions #'cape-dabbrev)
(add-hook 'completion-at-point-functions #'cape-file)
- (defun my/lsp-capf-busted ()
- "Return an uncached LSP completion function."
- (cape-capf-buster #'lsp-completion-at-point))
- (add-hook 'lsp-completion-mode-hook
- (lambda ()
- (setq-local completion-at-point-functions
- (list (my/lsp-capf-busted))))))
-
-(global-completion-preview-mode)
-(global-set-key (kbd "M-n") 'completion-preview-next-candidate)
-(global-set-key (kbd "M-p") 'completion-preview-prev-candidate)
+ :config
+ (advice-add 'eglot-completion-at-point :around #'cape-wrap-buster))
+ ;; (defun my/lsp-capf-busted ()
+ ;; "Return an uncached LSP completion function."
+ ;; (cape-capf-buster #'lsp-completion-at-point))
+ ;; (add-hook 'lsp-completion-mode-hook
+ ;; (lambda ()
+ ;; (setq-local completion-at-point-functions
+ ;; (list (my/lsp-capf-busted))))))
+
+(use-package completion-preview
+ :ensure nil
+ :diminish
+ :config
+ (global-completion-preview-mode)
+ (global-set-key (kbd "M-n") 'completion-preview-next-candidate)
+ (global-set-key (kbd "M-p") 'completion-preview-prev-candidate))
;; == snippets
(use-package yasnippet
+ :diminish yas-minor-mode yas-global-mode
:config
(yas-reload-all)
:hook
@@ -519,6 +582,19 @@
(add-hook 'vterm-copy-mode-hook #'my-vterm-copy-mode-evil-setup))
;; == languages
+;; (setq treesit-font-lock-level 4)
+;; (setq treesit-language-source-alist
+;; '((cpp "https://github.com/tree-sitter/tree-sitter-cpp")
+;; (c "https://github.com/tree-sitter/tree-sitter-c")
+;; (python "https://github.com/tree-sitter/tree-sitter-python")))
+;; (dolist (lang treesit-language-source-alist)
+;; (unless (treesit-language-available-p (car lang))
+;; (treesit-install-language-grammar (car lang))))
+;; (setq treesit-load-name-override-list
+;; '((c++ "libtree-sitter-cpp")))
+;; (setq major-mode-remap-alist '((c-mode . c-ts-mode)
+;; (c++-mode . c++-ts-mode)
+;; (python-mode . python-ts-mode)))
;; === c mode
(defun my-c-mode-common-hook ()
@@ -531,11 +607,19 @@
(add-to-list 'c-offsets-alist '(arglist-close . c-lineup-close-paren)))
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
+;; === odin mode
+(use-package odin-mode
+ :vc (:url "https://github.com/mattt-b/odin-mode"
+ :rev :newest))
+
+;; === markdown
+(add-hook 'markdown-mode-hook #'auto-fill-mode)
+
;; == proj
(require 'proj)
(setq
- proj-locations '("~/development/" "~/opt/" "~/classes/psoft/" "~/classes/parallel-programming/" "~/classes/operating-systems/")
- proj-find-params '("-mindepth 1" "-maxdepth 1" "-path '*/.git'" "-prune -o" "-type d" "-print"))
+ proj-locations '(("~/development/" . 1) ("~/opt/" . 1) ("~/classes/" . 2) ("~/dotfiles/" . 0) ("~/dotfiles/.config/emacs/lisp/" . 1))
+ proj-grep-function 'consult-ripgrep)
(global-set-key (kbd "C-x b") `proj-switch-to-buffer)
(global-set-key (kbd "C-c b") `switch-to-buffer)
@@ -543,6 +627,7 @@
(global-set-key (kbd "C-x k") `proj-kill-buffer)
(global-set-key (kbd "C-c k") `kill-buffer)
+
;; == toggle-window
(require 'toggle-window)
(global-set-key (kbd "C-c w") 'toggle-window)
diff --git a/.config/emacs/lisp/odin-mode.el b/.config/emacs/lisp/odin-mode.el
new file mode 120000
index 0000000..452595d
--- /dev/null
+++ b/.config/emacs/lisp/odin-mode.el
@@ -0,0 +1 @@
+odin-mode/odin-mode.el \ No newline at end of file
diff --git a/.config/emacs/lisp/odin-mode/odin-mode.el b/.config/emacs/lisp/odin-mode/odin-mode.el
new file mode 100644
index 0000000..8a769aa
--- /dev/null
+++ b/.config/emacs/lisp/odin-mode/odin-mode.el
@@ -0,0 +1,311 @@
+;;; odin-mode.el --- A minor mode for odin
+
+;; Author: Ethan Morgan
+;; Keywords: odin, language, languages, mode
+;; Package-Requires: ((emacs "24.1"))
+;; Homepage: https://github.com/glassofethanol/odin-mode
+
+;; This file is NOT part of GNU Emacs.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'rx)
+(require 'js)
+
+(defgroup odin nil
+ "Odin mode"
+ :group 'languages)
+
+;; `compilation-mode' configuration
+
+(eval-after-load 'compile
+ '(add-to-list 'compilation-error-regexp-alist '("^\\(.*?\\)(\\([0-9]+\\):\\([0-9]+\\).*" 1 2 3)))
+
+(defconst odin-mode-syntax-table
+ (let ((table (make-syntax-table)))
+ (modify-syntax-entry ?\" "\"" table)
+ (modify-syntax-entry ?\\ "\\" table)
+
+ ;; additional symbols
+ (modify-syntax-entry ?' "\"" table)
+ (modify-syntax-entry ?` "\"" table)
+ (modify-syntax-entry ?: "." table)
+ (modify-syntax-entry ?+ "." table)
+ (modify-syntax-entry ?- "." table)
+ (modify-syntax-entry ?% "." table)
+ (modify-syntax-entry ?& "." table)
+ (modify-syntax-entry ?| "." table)
+ (modify-syntax-entry ?^ "." table)
+ (modify-syntax-entry ?! "." table)
+ (modify-syntax-entry ?$ "." table)
+ (modify-syntax-entry ?= "." table)
+ (modify-syntax-entry ?< "." table)
+ (modify-syntax-entry ?> "." table)
+ (modify-syntax-entry ?? "." table)
+
+ ;; Need this for #directive regexes to work correctly
+ (modify-syntax-entry ?# "_" table)
+
+ ;; Modify some syntax entries to allow nested block comments
+ (modify-syntax-entry ?/ ". 124b" table)
+ (modify-syntax-entry ?* ". 23n" table)
+ (modify-syntax-entry ?\n "> b" table)
+ (modify-syntax-entry ?\^m "> b" table)
+
+ table))
+
+(defconst odin-builtins
+ '("len" "cap"
+ "typeid_of" "type_info_of"
+ "swizzle" "complex" "real" "imag" "quaternion" "conj"
+ "jmag" "kmag"
+ "min" "max" "abs" "clamp"
+ "expand_to_tuple"
+
+ "init_global_temporary_allocator"
+ "copy" "pop" "unordered_remove" "ordered_remove" "clear" "reserve"
+ "resize" "new" "new_clone" "free" "free_all" "delete" "make"
+ "clear_map" "reserve_map" "delete_key" "append_elem" "append_elems"
+ "append" "append_string" "clear_dynamic_array" "reserve_dynamic_array"
+ "resize_dynamic_array" "incl_elem" "incl_elems" "incl_bit_set"
+ "excl_elem" "excl_elems" "excl_bit_set" "incl" "excl" "card"
+ "assert" "panic" "unimplemented" "unreachable"))
+
+(defconst odin-keywords
+ '("import" "foreign" "package"
+ "where" "when" "if" "else" "for" "switch" "in" "not_in" "do" "case"
+ "break" "continue" "fallthrough" "defer" "return" "proc"
+ "struct" "union" "enum" "bit_field" "bit_set" "map" "dynamic"
+ "auto_cast" "cast" "transmute" "distinct" "opaque"
+ "using" "inline" "no_inline"
+ "size_of" "align_of" "offset_of" "type_of"
+ "or_return" "or_else" "or_continue" "or_break"
+
+ "context"
+ ;; "_"
+
+ ;; Reserved
+ "macro" "const"))
+
+(defconst odin-constants
+ '("nil" "true" "false"
+ "ODIN_OS" "ODIN_ARCH" "ODIN_ENDIAN" "ODIN_VENDOR"
+ "ODIN_VERSION" "ODIN_ROOT" "ODIN_DEBUG"))
+
+(defconst odin-typenames
+ '("bool" "b8" "b16" "b32" "b64"
+
+ "int" "i8" "i16" "i32" "i64"
+ "i16le" "i32le" "i64le"
+ "i16be" "i32be" "i64be"
+ "i128" "u128"
+ "i128le" "u128le"
+ "i128be" "u128be"
+
+ "uint" "u8" "u16" "u32" "u64"
+ "u16le" "u32le" "u64le"
+ "u16be" "u32be" "u64be"
+
+ "f32" "f64"
+ "complex64" "complex128"
+
+ "quaternion128" "quaternion256"
+
+ "rune"
+ "string" "cstring"
+
+ "uintptr" "rawptr"
+ "typeid" "any"
+ "byte"))
+
+(defconst odin-attributes
+ '("builtin"
+ "export"
+ "static"
+ "deferred_in" "deferred_none" "deferred_out"
+ "require_results"
+ "default_calling_convention" "link_name" "link_prefix"
+ "deprecated" "private" "thread_local"))
+
+
+(defconst odin-proc-directives
+ '("#force_inline"
+ "#force_no_inline"
+ "#type")
+ "Directives that can appear before a proc declaration")
+
+(defconst odin-directives
+ (append '("#align" "#packed"
+ "#any_int"
+ "#raw_union"
+ "#no_nil"
+ "#complete"
+ "#no_alias"
+ "#c_vararg"
+ "#assert"
+ "#file" "#line" "#location" "#procedure" "#caller_location"
+ "#load"
+ "#defined"
+ "#bounds_check" "#no_bounds_check"
+ "#partial") odin-proc-directives))
+
+(defun odin-wrap-word-rx (s)
+ (concat "\\<" s "\\>"))
+
+(defun odin-wrap-keyword-rx (s)
+ (concat "\\(?:\\S.\\_<\\|\\`\\)" s "\\_>"))
+
+(defun odin-wrap-directive-rx (s)
+ (concat "\\_<" s "\\>"))
+
+(defun odin-wrap-attribute-rx (s)
+ (concat "[[:space:]\n]*@[[:space:]\n]*(?[[:space:]\n]*" s "\\>"))
+
+(defun odin-keywords-rx (keywords)
+ "build keyword regexp"
+ (odin-wrap-keyword-rx (regexp-opt keywords t)))
+
+(defun odin-directives-rx (directives)
+ (odin-wrap-directive-rx (regexp-opt directives t)))
+
+(defun odin-attributes-rx (attributes)
+ (odin-wrap-attribute-rx (regexp-opt attributes t)))
+
+(defconst odin-identifier-rx "[[:word:][:multibyte:]_]+")
+(defconst odin-hat-type-rx (rx (group (and "^" (1+ (any word "." "_"))))))
+(defconst odin-dollar-type-rx (rx (group "$" (or (1+ (any word "_")) (opt "$")))))
+(defconst odin-number-rx
+ (rx (and
+ symbol-start
+ (or (and (+ digit) (opt (and (any "eE") (opt (any "-+")) (+ digit))))
+ (and "0" (any "xX") (+ hex-digit)))
+ (opt (and (any "_" "A-Z" "a-z") (* (any "_" "A-Z" "a-z" "0-9"))))
+ symbol-end)))
+(defconst odin-proc-rx (concat "\\(\\_<" odin-identifier-rx "\\_>\\)\\s *::\\s *\\(" (odin-directives-rx odin-proc-directives) "\\)?\\s *\\_<proc\\_>"))
+
+(defconst odin-type-rx (concat "\\_<\\(" odin-identifier-rx "\\)\\s *::\\s *\\(?:struct\\|enum\\|union\\|distinct\\)\\s *\\_>"))
+
+
+(defconst odin-font-lock-defaults
+ `(
+ ;; Types
+ (,odin-hat-type-rx 1 font-lock-type-face)
+ (,odin-dollar-type-rx 1 font-lock-type-face)
+ (,(odin-keywords-rx odin-typenames) 1 font-lock-type-face)
+ (,odin-type-rx 1 font-lock-type-face)
+
+ ;; Hash directives
+ (,(odin-directives-rx odin-directives) 1 font-lock-preprocessor-face)
+
+ ;; At directives
+ (,(odin-attributes-rx odin-attributes) 1 font-lock-preprocessor-face)
+
+ ;; Keywords
+ (,(odin-keywords-rx odin-keywords) 1 font-lock-keyword-face)
+
+ ;; single quote characters
+ ("'\\(\\\\.\\|[^']\\)'" . font-lock-constant-face)
+
+ ;; Variables
+ (,(odin-keywords-rx odin-builtins) 1 font-lock-builtin-face)
+
+ ;; Constants
+ (,(odin-keywords-rx odin-constants) 1 font-lock-constant-face)
+
+ ;; Strings
+ ;; ("\\\".*\\\"" . font-lock-string-face)
+
+ ;; Numbers
+ (,(odin-wrap-word-rx odin-number-rx) . font-lock-constant-face)
+
+ ;; Procedures
+ (,odin-proc-rx 1 font-lock-function-name-face)
+
+ ("---" . font-lock-constant-face)
+ ("\\.\\.<" . font-lock-constant-face)
+ ("\\.\\." . font-lock-constant-face)
+ ))
+
+;; add setq-local for older emacs versions
+(unless (fboundp 'setq-local)
+ (defmacro setq-local (var val)
+ `(set (make-local-variable ',var) ,val)))
+
+(defconst odin--defun-rx "\(.*\).*\{")
+
+(defmacro odin-paren-level ()
+ `(car (syntax-ppss)))
+
+(defun odin-line-is-defun ()
+ "return t if current line begins a procedure"
+ (interactive)
+ (save-excursion
+ (beginning-of-line)
+ (let (found)
+ (while (and (not (eolp)) (not found))
+ (if (looking-at odin--defun-rx)
+ (setq found t)
+ (forward-char 1)))
+ found)))
+
+(defun odin-beginning-of-defun (&optional count)
+ "Go to line on which current function starts."
+ (interactive)
+ (let ((orig-level (odin-paren-level)))
+ (while (and
+ (not (odin-line-is-defun))
+ (not (bobp))
+ (> orig-level 0))
+ (setq orig-level (odin-paren-level))
+ (while (>= (odin-paren-level) orig-level)
+ (skip-chars-backward "^{")
+ (backward-char))))
+ (if (odin-line-is-defun)
+ (beginning-of-line)))
+
+(defun odin-end-of-defun ()
+ "Go to line on which current function ends."
+ (interactive)
+ (let ((orig-level (odin-paren-level)))
+ (when (> orig-level 0)
+ (odin-beginning-of-defun)
+ (end-of-line)
+ (setq orig-level (odin-paren-level))
+ (skip-chars-forward "^}")
+ (while (>= (odin-paren-level) orig-level)
+ (skip-chars-forward "^}")
+ (forward-char)))))
+
+(defalias 'odin-parent-mode
+ (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))
+
+;;;###autoload
+(define-derived-mode odin-mode odin-parent-mode "Odin"
+ :syntax-table odin-mode-syntax-table
+ :group 'odin
+ (setq bidi-paragraph-direction 'left-to-right)
+ (setq-local require-final-newline mode-require-final-newline)
+ (setq-local parse-sexp-ignore-comments t)
+ (setq-local comment-start-skip "\\(//+\\|/\\*+\\)\\s *")
+ (setq-local comment-start "//")
+ (setq-local comment-end "")
+ (setq-local indent-line-function 'js-indent-line)
+ (setq-local font-lock-defaults '(odin-font-lock-defaults))
+ (setq-local beginning-of-defun-function 'odin-beginning-of-defun)
+ (setq-local end-of-defun-function 'odin-end-of-defun)
+ (setq-local electric-indent-chars
+ (append "{}():;," electric-indent-chars))
+ (setq imenu-generic-expression
+ `(("type" ,(concat "^" odin-type-rx) 1)
+ ("proc" ,(concat "^" odin-proc-rx) 1)))
+
+ (font-lock-ensure))
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.odin\\'" . odin-mode))
+
+(provide 'odin-mode)
+
+
+;;; odin-mode.el ends here
diff --git a/.config/emacs/lisp/proj b/.config/emacs/lisp/proj
-Subproject 2c3e7050a2cf6d51dd274f7a03721d1fdb8fbf3
+Subproject 35b4d077bc3d9026df365b20db38778f85e8293
diff --git a/.config/emacs/lisp/toggle-window/toggle-window.el b/.config/emacs/lisp/toggle-window/toggle-window.el
index 28c7c62..c518159 100644
--- a/.config/emacs/lisp/toggle-window/toggle-window.el
+++ b/.config/emacs/lisp/toggle-window/toggle-window.el
@@ -1,17 +1,21 @@
(defvar toggle-window-configuration nil
"Stores the window configuration")
-;; should rewrite to not do the save configuration thing
-
(defun toggle-window ()
(interactive)
(if (count-windows)
(if (one-window-p)
;; reset configuration if single window
(if toggle-window-configuration
- (progn
- (set-window-configuration toggle-window-configuration)
- (setq toggle-window-configuration nil))
+ (let* ((current-window (selected-window))
+ (current-buffer (window-buffer current-window)))
+ (progn
+ (set-window-configuration toggle-window-configuration)
+ (set-window-buffer current-window current-buffer)
+ ;; make sure current window keeps state
+ (window-state-put current-window-state)
+ (setq toggle-window-configuration nil))
+ )
(message "No previous window layout to restore."))
;; if multiple windows save configuration
(setq toggle-window-configuration (current-window-configuration))
diff --git a/.config/sway/config b/.config/sway/config
index 62830c8..1cca1e9 100644
--- a/.config/sway/config
+++ b/.config/sway/config
@@ -18,7 +18,7 @@ exec startup
### Output configuration
#
# Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/)
-output * bg ~/dotfiles/files/wallpapers/mill.png fill
+output * bg ~/dotfiles/files/wallpapers/sunset.jpg fill
#
# Example configuration:
#
@@ -26,7 +26,7 @@ output * bg ~/dotfiles/files/wallpapers/mill.png fill
#
# You can get the names of your outputs by running: swaymsg -t get_outputs
output eDP-1 position -0,0
-output HDMI-A-1 position -0,0
+# output HDMI-A-1 position -0,0 mode 1920x1080
### Idle configuration
exec swayidle -w \
@@ -35,6 +35,7 @@ exec swayidle -w \
### Input configuration
input type:touchpad {
natural_scroll enabled
+ dwt disabled
}
input type:keyboard {
@@ -44,7 +45,7 @@ input type:keyboard {
}
### Style
-default_border pixel
+default_border none
### Key bindings
#
@@ -72,8 +73,8 @@ default_border pixel
bindsym $mod+Ctrl+l exec lock
# screenshot
- bindsym $mod+s exec screenshot
- bindsym $mod+Shift+s exec screenshot -save
+ bindsym $mod+s exec screenshot -save
+ bindsym $mod+Shift+s exec screenshot
# Drag floating windows by holding down $mod and left mouse button.
floating_modifier $mod normal
@@ -141,7 +142,7 @@ default_border pixel
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym $mod+b splith
- bindsym $mod+v splitv
+ # bindsym $mod+v splitv
# Switch the current container between different layout styles
# bindsym $mod+s layout stacking
@@ -152,7 +153,7 @@ default_border pixel
bindsym $mod+f fullscreen
# Toggle the current focus between tiling and floating mode
- bindsym $mod+Shift+space floating toggle
+ bindsym $mod+v floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle
diff --git a/.config/swenu/conf.ini b/.config/swenu/conf.ini
index 2c2e901..649aaa9 100644
--- a/.config/swenu/conf.ini
+++ b/.config/swenu/conf.ini
@@ -1,7 +1,7 @@
fancy_scroll = no
exit_on_focus_lost = true
min_width = 500
-font_size = 16
+font_size = 18
[colors]
text_color = (0.85, 0.85, 0.85, 1.0)
diff --git a/files/wallpapers/weirdhouse.webp b/files/wallpapers/weirdhouse.webp
new file mode 100644
index 0000000..352ee73
--- /dev/null
+++ b/files/wallpapers/weirdhouse.webp
Binary files differ
diff --git a/scripts/aimos/alloc b/scripts/aimos/alloc
new file mode 100755
index 0000000..46e23f6
--- /dev/null
+++ b/scripts/aimos/alloc
@@ -0,0 +1,7 @@
+#!/bin/bash
+if [ "$#" -ne 2 ]; then
+ echo "Provide two arguments (number of minutes to allocate)" >&2
+ exit 1
+fi
+
+salloc -N 1 --partition=$2 --gres=gpu:4 -t $1
diff --git a/scripts/aimos/cnr b/scripts/aimos/cnr
new file mode 100755
index 0000000..e8d5ce5
--- /dev/null
+++ b/scripts/aimos/cnr
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# cnr - compile and run
+
+path=$(realpath $1)
+out="$path.out"
+shift
+args="$@"
+
+
+# compile
+echo "===> COMPILING..."
+nvcc -g -G -gencode arch=compute_70,code=sm_70 "$path" -o "$out"
+if [[ $? -ne 0 ]]; then
+ exit 1
+fi
+echo "Success"
+
+# get node
+node=$(getactivenode)
+if [[ -z "$node" || "$node" == "(Priority)" || "$node" == "(Resources)" ]]; then
+ echo "No active nodes to run on, exiting."
+ exit 1
+fi
+
+# run
+echo "===> EXECUTING ON NODE $node ..."
+ssh $node "$out $args"
diff --git a/scripts/aimos/getactivenode b/scripts/aimos/getactivenode
new file mode 100755
index 0000000..b088853
--- /dev/null
+++ b/scripts/aimos/getactivenode
@@ -0,0 +1,2 @@
+#!/bin/bash
+squeue | awk 'NR > 1 {print $8; exit}'
diff --git a/scripts/dafny b/scripts/dafny
new file mode 100755
index 0000000..93b26a7
--- /dev/null
+++ b/scripts/dafny
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+# get args
+file="${!#}"
+set -- "${@:1:$(($#-1))}"
+args="$@"
+
+cat "$file" | ssh vm "tee ~/dafny/torun.dfy > /dev/null; dafny $args ~/dafny/torun.dfy"
diff --git a/scripts/open-emacs-project b/scripts/open-emacs-project
index f2e83ab..48360b1 100755
--- a/scripts/open-emacs-project
+++ b/scripts/open-emacs-project
@@ -10,9 +10,9 @@ emacs_attached() {
switch_to() {
if emacs_attached; then
- emacsclient -e "(proj-set-dir \"$1\")"
+ emacsclient -e "(proj-set \"$1\")"
else
- emacsclient -ce "(proj-set-dir \"$1\")"
+ emacsclient -ce "(proj-set \"$1\")"
fi
}
diff --git a/scripts/sysinfo b/scripts/sysinfo
index 90bac9a..8acc18d 100755
--- a/scripts/sysinfo
+++ b/scripts/sysinfo
@@ -1,15 +1,11 @@
#!/bin/sh
-batperc=$(cat /sys/class/power_supply/BAT0/capacity)
-batstate=$(cat /sys/class/power_supply/BAT0/status)
-brightness=$(brightnessctl -m | cut -d, -f 4)
-
-network_info() {
+get_network_info() {
device=$(ip a | grep "state UP" | awk -F': ' '{ printf($2) }')
case "${device}" in
wlan*)
network=$(iwctl station ${device} show | grep 'Connected network' \
- | awk -F' ' '{ printf($3) }')
+ | awk -F' ' '{ printf($3) }')
echo "${device}: ${network}"
;;
eth*)
@@ -18,24 +14,24 @@ network_info() {
esac
}
-get_volume() {
- wpctl get-volume @DEFAULT_SINK@ | awk -F' ' '{ printf "%s %s%% %s", $1, ($2 * 100), $3; }'
-}
-if [ "$TERM" = "linux" ]; then
- notify-send \
- "System Info:" \
- "\
+batperc=$(cat /sys/class/power_supply/BAT0/capacity)
+batstate=$(cat /sys/class/power_supply/BAT0/status)
+brightness=$(brightnessctl -m | cut -d, -f 4)
+volume=$(wpctl get-volume @DEFAULT_SINK@ | awk -F' ' '{ printf "%s %s%% %s", $1, ($2 * 100), $3; }')
+network=$(get_network_info)
+
+header="System Info:"
+message="\
+Date: $(date +"%a %b %d")
Time: $(date "+%I:%M:%S")
-$(get_volume)
+${volume}
Brightness: ${brightness}
${batstate}: ${batperc}%
-$(network_info)"
+${network}"
+
+if [ "$TERM" = "linux" ]; then
+ notify-send "$header" "$message"
else
- echo "\
-Time: $(date "+%I:%M:%S")
-$(get_volume)
-Brightness: ${brightness}
-${batstate}: ${batperc}%
-$(network_info)"
+ echo "$message"
fi