diff options
| -rw-r--r-- | glide/.config/glide/glide.ts | 135 | ||||
| -rw-r--r-- | glide/.config/glide/sitesearch.glide.ts | 147 | ||||
| -rw-r--r-- | oni/home/config/pop-os.scm | 40 | ||||
| -rw-r--r-- | oni/home/config/pop-os/emacs.el | 79 | ||||
| -rw-r--r-- | oni/packages/emacs-config.scm | 36 |
5 files changed, 263 insertions, 174 deletions
diff --git a/glide/.config/glide/glide.ts b/glide/.config/glide/glide.ts index 1c3449f..49c66de 100644 --- a/glide/.config/glide/glide.ts +++ b/glide/.config/glide/glide.ts @@ -132,7 +132,8 @@ glide.keymaps.set('insert', '<C-s>', 'search_next'); glide.keymaps.set('insert', '<C-r>', 'search_prev'); async function installPuntAddons() { - await glide.addons.install("https://addons.mozilla.org/firefox/downloads/file/4677239/1password_x_password_manager-8.12.1.3.xpi"); + await glide.addons.install("https://addons.mozilla.org/firefox/downloads/file/4677239/1password_x_password_manager-8.12.1.3.xpi"); + await glide.addons.install('https://addons.mozilla.org/firefox/downloads/file/4508409/vue_js_devtools-7.7.7.xpi'); } async function installPersonalAddons() { @@ -269,137 +270,6 @@ glide.keymaps.set("normal", "gh", async () => { }); }, { description: "Jump to heading in current page" }); -// From https://github.com/glide-browser/glide/discussions/147#discussioncomment-15337351 - -/** - * custom search providers - */ -const search_info: Record<string, { url: string, sep: string }> = { - 'youtube': { - url: "https://www.youtube.com/results?search_query=", sep: "+" - } -} as const - -/* - * pick tabs via a selection of bookmarks and history - */ -glide.keymaps.set("normal", "<leader>t", async () => { - - //let combined: Array<Browser.Bookmarks.BookmarkTreeNode | Browser.History.HistoryItem> = [] - let combined = [] - const tabs = await browser.tabs.query({}); - tabs.forEach(entry => combined.push({ title: entry.title ?? 'Unnamed Tab', url: entry.url, type: 'T', favIconUrl: entry.favIconUrl })); - - const bookmarks = await browser.bookmarks.search({}); - bookmarks - .filter(bmark => bmark.type !== 'folder') - .forEach(bmark => combined.push({ title: bmark.title, url: bmark.url, type: 'B', favIconUrl: null })); - - const history = await browser.history.search({ text: "", maxResults: 100 }); - history.forEach(entry => combined.push({ title: entry.title, url: entry.url, type: 'H', favIconUrl: null })); - - // filtering - const newtab = (await browser.runtime.getManifest()).chrome_url_overrides?.newtab - const startpage = glide.prefs.get("browser.startup.homepage") - - let filtered_combined = combined.filter(e => e.url !== startpage && e.url !== newtab) - - glide.commandline.show({ - title: "open", - options: filtered_combined.map((entry) => ({ - label: entry.title, - render() { - return DOM.create_element("div", { - style: { - display: "flex", - alignItems: "center", - gap: "8px", - }, - children: [ - DOM.create_element("span", [entry.type], { - style: { color: "#777", fontSize: "0.9em" }, - }), - DOM.create_element("span", [entry.title]), - DOM.create_element("span", [entry.url], { - style: { color: "#777", fontSize: "0.9em" }, - }), - ], - }); - }, - async execute({ input: input }) { - if (entry.title.toLowerCase().includes(input.toLowerCase())) { - const tab = await glide.tabs.get_first({ - url: entry.url, - }); - if (tab) { - const windowid = tab.windowId; - if (windowid === undefined) { - return - } - await browser.windows.update(windowid, { - focused: true - }) - await browser.tabs.update(tab.id, { - active: true, - }); - } else { - - await browser.tabs.create({ - active: true, - url: entry.url, - windowId: browser.windows.getCurrent().id, - }); - } - } else { - const terms = input.split(" ",) - const first = terms[0] - if (terms.length > 1 && first !== undefined && first in search_info) { - let info = search_info[first]; - let query = info?.url + terms.slice(1).join(info?.sep) - browser.tabs.create({ - active: true, - url: query - }); - return; - } - - let url: URL; - try { - url = new URL(input) - } catch (_) { - try { - url = new URL("http://" + input) // firefox automatically makes this https - - // avoids single word searches becoming URLs - if (url.hostname.split(".").length == 1 && url.hostname !== "localhost") { - throw "probably not a hostname"; - } - } catch (_) { // probably not a url - browser.search.search({ - query: terms.filter(s => s).join(" "), - disposition: "NEW_TAB", - }) - return - } - - } - // so it IS a URL! - - const tab = await glide.tabs.get_first({ url }); - - if (tab) { - browser.tabs.update(tab.id, { active: true }); - } - else { - browser.tabs.create({ active: true, url }); - } - } - - }, - })), - }); -}, { description: "Open the site searcher" }); - glide.keymaps.set('normal', 'ab', async () => { const currentTab = await glide.tabs.get_first({ active: true }); @@ -473,6 +343,7 @@ glide.keymaps.set('normal', '<C-x>4b', 'split_window'); glide.keymaps.set('normal', '<C-x>1', 'unsplit_window'); glide.keymaps.set('normal', '<A-o>', 'other_window'); +glide.include('sitesearch.glide.ts'); glide.include('tabbar.glide.ts'); const toggle_reader_mode = glide.excmds.create({ diff --git a/glide/.config/glide/sitesearch.glide.ts b/glide/.config/glide/sitesearch.glide.ts new file mode 100644 index 0000000..f575015 --- /dev/null +++ b/glide/.config/glide/sitesearch.glide.ts @@ -0,0 +1,147 @@ +// From https://github.com/glide-browser/glide/discussions/147#discussioncomment-15337351 + +/** + * custom search providers + */ +const search_info: Record<string, { url: string, sep: string }> = { + 'youtube': { + url: "https://www.youtube.com/results?search_query=", sep: "+" + } +} as const + +/* + * pick tabs via a selection of bookmarks and history + */ +glide.keymaps.set("normal", "<leader>t", async () => { + + //let combined: Array<Browser.Bookmarks.BookmarkTreeNode | Browser.History.HistoryItem> = [] + let combined = [] + const tabs = await browser.tabs.query({}); + tabs.forEach(entry => combined.push({ + title: entry.title ?? 'Unnamed Tab', + url: entry.url, + type: 'T', + favIconUrl: entry.favIconUrl + })); + + const bookmarks = await browser.bookmarks.search({}); + bookmarks + .filter(bmark => bmark.type !== 'folder') + .forEach(bmark => combined.push({ title: bmark.title, url: bmark.url, type: 'B', favIconUrl: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAE/ElEQVR4Xu2cW2wUVRjHvzPdXdou0gvUemniegnRQtquimBNa4kpJfrCJrQ+Gewjb5oQfJPLG8akjzxawpMtyeKDpuBDkWqEBNMFEcUINEQTTEVrwbZ7mTmeb9xZ5j6zZXbd7X4n2YdOz3xz5rf//3fOmZ1zGPgsyelvY7m0vIcz/jpw3iNOi/k8teKqMQYLHNg5YNJnI7teG3drIPNq/cTZb95lirKPAx/wqlul/5+TGLy/d6j/tF37HQEJMD0CzNgaBmPmMT6yu3/U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AmR+T/qri6lwJJTQw6mIHFQpCorWR2z3ECCL5b8hAuTxnjQBcgGE457G+rA67jEXshiOvyRptCESGidAOgKFtRoMUtF1kcK4hxSUJ6ACYmxBioTiDYwVxj2OgCanZqaL2SsoqKlGObp5XHmIS6K0grvU7Ih3pqRIOOEGxzgO8tgWx3wj1QQIVx3iwroCoJamI29s7z7s58sxDI7c9u+oVkBLyyvw/fUbD5pvmmt5QTIAUjdyy2Rn/ew8VQ0KkmVZhZPO/LeJgN1cqyhAWBkhZTO5pNNOMFrASgeEysFVhhocQcd2rlU0IO0Er93vKhUQJuQ/RL7Rcg4OArkknfDaDtAJ1L+Y5wqFFVK3lAAAAABJRU5ErkJggg==' })); + + const topsites = await browser.topSites.get({includeFavicon: true}); + topsites + .forEach(s => combined.push({ title: s.title, url: s.url, type: 'S', favIconUrl: s.favicon})); + + const history = await browser.history.search({ text: "", maxResults: 100 }); + history.forEach(entry => combined.push({ title: entry.title, url: entry.url, type: 'H', favIconUrl: null })); + + // filtering + const newtab = (await browser.runtime.getManifest()).chrome_url_overrides?.newtab + const startpage = glide.prefs.get("browser.startup.homepage") + + let filtered_combined = combined.filter(e => e.url !== startpage && e.url !== newtab) + + glide.commandline.show({ + title: "open", + options: filtered_combined.map((entry) => ({ + label: entry.title, + render() { + return DOM.create_element("div", { + style: { + display: "flex", + alignItems: "center", + gap: "8px", + }, + children: [ + entry.favIconUrl + ? DOM.create_element("img", [], { + src: entry.favIconUrl, + style: { + width: '16px', + height: '16px', + } + }) + : DOM.create_element("span", [entry.type], { + style: { color: "#777", fontSize: "0.9em" }, + }), + DOM.create_element("span", [entry.title]), + DOM.create_element("span", [entry.url], { + style: { color: "#777", fontSize: "0.9em" }, + }), + ], + }); + }, + async execute({ input: input }) { + if (entry.title.toLowerCase().includes(input.toLowerCase())) { + const tab = await glide.tabs.get_first({ + url: entry.url, + }); + if (tab) { + const windowid = tab.windowId; + if (windowid === undefined) { + return + } + await browser.windows.update(windowid, { + focused: true + }) + await browser.tabs.update(tab.id, { + active: true, + }); + } else { + + await browser.tabs.create({ + active: true, + url: entry.url, + windowId: browser.windows.getCurrent().id, + }); + } + } else { + const terms = input.split(" ",) + const first = terms[0] + if (terms.length > 1 && first !== undefined && first in search_info) { + let info = search_info[first]; + let query = info?.url + terms.slice(1).join(info?.sep) + browser.tabs.create({ + active: true, + url: query + }); + return; + } + + let url: URL; + try { + url = new URL(input) + } catch (_) { + try { + url = new URL("http://" + input) // firefox automatically makes this https + + // avoids single word searches becoming URLs + if (url.hostname.split(".").length == 1 && url.hostname !== "localhost") { + throw "probably not a hostname"; + } + } catch (_) { // probably not a url + browser.search.search({ + query: terms.filter(s => s).join(" "), + disposition: "NEW_TAB", + }) + return + } + + } + // so it IS a URL! + + const tab = await glide.tabs.get_first({ url: url.href }); + + if (tab) { + browser.tabs.update(tab.id, { active: true }); + } + else { + browser.tabs.create({ active: true, url }); + } + } + + }, + })), + }); +}, { description: "Open the site searcher" }); diff --git a/oni/home/config/pop-os.scm b/oni/home/config/pop-os.scm index dd47402..8bae7c7 100644 --- a/oni/home/config/pop-os.scm +++ b/oni/home/config/pop-os.scm @@ -29,37 +29,7 @@ #:use-module (oni home services rofi) #:use-module (oni home services xdisorg) #:use-module (oni packages emacs) - #:use-module ((oni packages emacs-config) - #:select (emacs-oni-bookmark - emacs-oni-browse-url - emacs-oni-common-lisp - emacs-oni-compilation - emacs-oni-core - emacs-oni-css - emacs-oni-diff-hl - emacs-oni-dired - emacs-oni-elisp - emacs-oni-git-commit - emacs-oni-grep - emacs-oni-gui - emacs-oni-html - emacs-oni-log-edit - emacs-oni-magit - emacs-oni-org - emacs-oni-org-roam - emacs-oni-package - emacs-oni-php - emacs-oni-project - emacs-oni-projectile - emacs-oni-scheme - emacs-oni-shr - emacs-oni-tramp - emacs-oni-web-mode - emacs-oni-yaml - emacs-oni-lua - emacs-oni-sh - emacs-oni-js - emacs-oni-elfeed)) + #:use-module (oni packages emacs-config) #:use-module ((oni packages fonts) #:select (font-comfortaa font-annotation-mono)) @@ -201,6 +171,7 @@ "wezterm" "tree-sitter-vue" "tree-sitter-typescript" + "tree-sitter-css" "emacs-popup" "emacs-git-messenger" "emacs-csv-mode" @@ -224,7 +195,8 @@ "emacs-sops" "emacs-dockerfile-mode" "emacs-slack" - "emacs-combobulate")) + "emacs-combobulate" + "emacs-prodigy")) (list emacs-oni-core emacs-oni-compilation emacs-oni-common-lisp @@ -255,6 +227,10 @@ emacs-oni-sh emacs-oni-js emacs-oni-elfeed + emacs-oni-eshell + emacs-oni-outline + emacs-oni-sql + emacs-oni-logview emacs-flycheck-phpstan emacs-vue-ts-mode diff --git a/oni/home/config/pop-os/emacs.el b/oni/home/config/pop-os/emacs.el index 63cfcac..621c0ec 100644 --- a/oni/home/config/pop-os/emacs.el +++ b/oni/home/config/pop-os/emacs.el @@ -156,7 +156,7 @@ buffers.") (command (with-current-buffer buffer (format "../../chanced-scripts/test %s %s %s %s" name - (if filter (format "--filter='::%s$'" filter) "") + (if filter (format "--filter='::%s( |$)'" filter) "") (if stop-on-failure-p "--stop-on-defect" "") (or file ""))))) (cl-letf (((symbol-function 'compilation-buffer-name) @@ -399,9 +399,9 @@ Optional argument STOPP means stop on any defect." (add-hook 'dashboard-mode-hook 'olivetti-mode) (add-hook 'dashboard-after-initialize-hook (lambda () (setq truncate-lines t))) -(setq browse-url-browser-function #'browse-url-firefox) -(setq browse-url-generic-args '("run" "--branch=stable" "--arch=x86_64" "--command=launch-script.sh" "--file-forwarding" "app.zen_browser.zen")) -(setq browse-url-generic-program "/usr/bin/flatpak") +(setq browse-url-browser-function #'browse-url-generic) +(setq browse-url-generic-args nil) +(setq browse-url-generic-program "~/Downloads/glide/glide") (defun oni-fixup-phpstan-filenames (errors) "Change the file name from each error in ERRORS to one on local disk." @@ -1256,8 +1256,10 @@ Optional argument STOPP means stop on any defect." (require 'oni-js) -(with-eval-after-load 'sh-script - (require 'oni-sh)) +(with-eval-after-load 'sh-script (require 'oni-sh)) +(with-eval-after-load 'sql (require 'oni-sql)) +(with-eval-after-load 'outline (require 'oni-outline)) +(with-eval-after-load 'logview (require 'oni-logview)) (eval-when-compile (require 'magit-section)) @@ -1279,11 +1281,72 @@ Optional argument STOPP means stop on any defect." (add-hook 'magit-status-sections-hook #'oni-magit-insert-locked-files 20)) -(setq elfeed-feeds - '("https://www.reddit.com/r/PHP/.rss")) +(with-eval-after-load 'elfeed + (setq elfeed-feeds + '(("https://www.reddit.com/r/PHP/.rss" php) + ("https://phpreads.com/feed" php) + ("https://phpstan.org/rss.xml" php)) + elfeed-curl-program-name "curl")) (setq git-messenger:show-detail t) (global-set-key (kbd "C-c g .") '("Show commit at point" . git-messenger:popup-message)) (global-set-key (kbd "C-c g b") '("Git Blame current file" . magit-blame)) (global-set-key (kbd "C-c g l") '("Show file's git log" . magit-log-buffer-file)) +(defun my-set-agenda-files (&rest _) + (setq org-agenda-files + (cl-loop + for file in (org-mem-all-files) + unless (string-search "archive" file) + when (seq-find (lambda (entry) + (or (org-mem-entry-active-timestamps entry) + (org-mem-entry-todo-state entry) + (org-mem-entry-scheduled entry) + (org-mem-entry-deadline entry))) + (org-mem-entries-in file)) + collect file))) +(add-hook 'org-mem-post-full-scan-functions #'my-set-agenda-files) + +;;; Prodigy services + +(with-eval-after-load 'prodigy + (prodigy-define-tag + :name 'tunnel + :command "~/code/diamond-interactive/social-api/toolbox/connect_db.sh" + :args (lambda (&rest args) + (let ((service (map-elt args :service))) + (list "-e" + (if (prodigy-service-tagged-with? service 'production) + "prd" + "stg") + "-a" + (cond + ((prodigy-service-tagged-with? service 'chanced) + "chanced") + ((prodigy-service-tagged-with? service 'punt) + "punt") + (t (error "Unknown project"))) + "-k" + (expand-file-name "~/.ssh/id_ed25519.pub")))) + :cwd "~/code/diamond-interactive/social-api" + :stop-signal 'kill + :ready-message "Waiting for connections...") + + (prodigy-define-service + :name "Chanced Production Database Connection" + :tags '(chanced production tunnel)) + + (prodigy-define-service + :name "Chanced Staging Database Connection" + :tags '(chanced staging tunnel)) + + (prodigy-define-service + :name "Punt Production Database Connection" + :tags '(punt production tunnel)) + + (prodigy-define-service + :name "Punt Staging Database Connection" + :tags '(punt staging tunnel))) + +(autoload 'vue-ts-mode "vue-ts-mode" nil t) +(add-to-list 'auto-mode-alist (cons (rx ".vue" eos) 'vue-ts-mode)) diff --git a/oni/packages/emacs-config.scm b/oni/packages/emacs-config.scm index 4aeee76..6794a62 100644 --- a/oni/packages/emacs-config.scm +++ b/oni/packages/emacs-config.scm @@ -38,7 +38,7 @@ (define-public emacs-oni-config (let - ((commit "ddabed921df62062010156178317c79e612e889d") + ((commit "b3b63e7322acd6fe373454bf5c8a41a97f000938") (revision "0")) (package (name "emacs-oni-config") (version (git-version "0.0.1" revision commit)) @@ -52,7 +52,7 @@ (file-name (git-file-name name version)) (sha256 (base32 - "02jgsg42qa6nw8bzd6rn17cnkj8pfy4i788cjsyygxy3z01kcs3c")))) + "0nj8gyzvajza2bsq20a2k1hljsmqw6a18l6bakff4d8l0wbmamzn")))) (build-system emacs-build-system) (home-page "https://code.ryuslash.org/emacs-config/") (synopsis "My Emacs configuration") @@ -1021,3 +1021,35 @@ Emacs"))) (synopsis "My configuration for JavaScript.") (description "This package provides my configuration for editing JavaScript files."))) + +(define-public emacs-oni-outline + (package + (inherit emacs-oni-config) + (name "emacs-oni-outline") + (arguments + '(#:include '("oni-outline\\.el$"))) + (synopsis "My configuration for outline-mode and outline-minor-mode") + (description + "This package provides my configuration for outline modes."))) + +(define-public emacs-oni-sql + (package + (inherit emacs-oni-config) + (name "emacs-oni-sql") + (arguments + '(#:include '("oni-sql\\.el$"))) + (synopsis "My configuration for sql-mode") + (description + "This package provides my configuration for sql mode."))) + +(define-public emacs-oni-logview + (package + (inherit emacs-oni-config) + (name "emacs-oni-logview") + (arguments + '(#:include '("oni-logview\\.el$"))) + (synopsis "My configuration for logview-mode") + (propagated-inputs + (list emacs-logview)) + (description + "This package provides my configuration for logview mode."))) |
