new and impruved
This commit is contained in:
153
dots/doom/.back.modules/completion/corfu/README.org
Executable file
153
dots/doom/.back.modules/completion/corfu/README.org
Executable file
@@ -0,0 +1,153 @@
|
||||
#+title: :completion corfu
|
||||
#+subtitle: Complete with cap(f), cape and a flying feather
|
||||
#+created: September 9, 2022
|
||||
#+since: 3.0.0 (#7002)
|
||||
|
||||
* Description :unfold:
|
||||
This module provides code completion, powered by [[https://github.com/minad/corfu][corfu]].
|
||||
|
||||
It is recommended to enable either this or [[doom-module:][:completion company]], in case you
|
||||
desire pre-configured auto-completion. Corfu is much lighter weight and focused,
|
||||
plus it's built on native Emacs functionality, whereas company is heavy and
|
||||
highly non-native, but has some extra features and more maturity.
|
||||
|
||||
** Maintainers
|
||||
- [[doom-user:][@LuigiPiucco]]
|
||||
|
||||
[[doom-contrib-maintainer:][Become a maintainer?]]
|
||||
|
||||
** Module flags
|
||||
- +icons ::
|
||||
Display icons beside completion suggestions.
|
||||
- +tng ::
|
||||
Invoke completion on [[kbd:][TAB]]. When corfu is active, [[kbd:][TAB]] and [[kbd:][S-TAB]] will navigate
|
||||
the completion candidates. Arrow keys and evil-style movement are still
|
||||
supported.
|
||||
|
||||
** Packages
|
||||
- [[doom-package:][corfu]]
|
||||
- [[doom-package:][cape]]
|
||||
- [[doom-package:][kind-icon]] if [[doom-module:][:completion corfu +icons]]
|
||||
- [[doom-package:][corfu-terminal]] if [[doom-module:][:os tty]]
|
||||
|
||||
** Hacks
|
||||
/No hacks documented for this module./
|
||||
|
||||
** TODO Changelog
|
||||
# This section will be machine generated. Don't edit it by hand.
|
||||
/This module does not have a changelog yet./
|
||||
|
||||
* Installation
|
||||
Enable this module in your ~doom!~ block.
|
||||
|
||||
This module has no direct requirements, but some languages may have their own
|
||||
requirements to fulfill before you get code completion in them (and some
|
||||
languages may lack code completion support altogether). Run ~$ doom doctor~ to
|
||||
find out if you're missing any dependencies. Note that corfu may have support
|
||||
for completions in languages that have no development intelligence, since it
|
||||
supports generic, context insensitive candidates such as file names or recurring
|
||||
words.
|
||||
|
||||
* TODO Usage
|
||||
#+begin_quote
|
||||
🔨 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]]
|
||||
#+end_quote
|
||||
|
||||
** Code completion
|
||||
By default, completion gets triggered after typing 2 non-space consecutive
|
||||
characters, or by means of the [[kbd:][C-SPC]] keybinding at any moment. While the popup
|
||||
is visible, the following relevant keys are available:
|
||||
|
||||
| Keybind | Description |
|
||||
|----------+------------------------------------------------------|
|
||||
| [[kbd:][<down>]] | Go to next candidate |
|
||||
| [[kbd:][<up>]] | Go to previous candidate |
|
||||
| [[kbd:][C-n]] | Go to next candidate |
|
||||
| [[kbd:][C-p]] | Go to previous candidate |
|
||||
| [[kbd:][C-j]] | (evil) Go to next candidate |
|
||||
| [[kbd:][C-k]] | (evil) Go to previous candidate |
|
||||
| [[kbd:][C-<down>]] | Go to next doc line |
|
||||
| [[kbd:][C-<up>]] | Go to previous doc line |
|
||||
| [[kbd:][C-S-n]] | Go to next doc line |
|
||||
| [[kbd:][C-S-p]] | Go to previous doc line |
|
||||
| [[kbd:][C-S-j]] | (evil) Go to next doc line |
|
||||
| [[kbd:][C-S-k]] | (evil) Go to previous doc line |
|
||||
| [[kbd:][C-h]] | Toggle documentation (if available) |
|
||||
| [[kbd:][s-<down>]] | Export to minibuffer (if [[doom-module:][:completion vertico]]) |
|
||||
| [[kbd:][s-j]] | (evil) Export to minibuffer (if [[doom-module:][:completion vertico]]) |
|
||||
| [[kbd:][RET]] | Insert candidate |
|
||||
| [[kbd:][C-SPC]] | (when completing) Insert separator (see below) |
|
||||
| [[kbd:][C-SPC]] | Complete (unless [[doom-module:][:completion corfu +tng]]) |
|
||||
|
||||
If you prefer a [[kbd:][TAB]]-centric completion style, enable the [[doom-module:][:completion corfu +tng]]
|
||||
flag so that, instead, you trigger completion with [[kbd:][TAB]], getting the following
|
||||
additional binds:
|
||||
|
||||
| Keybind | Description |
|
||||
|---------+--------------------------------------------|
|
||||
| [[kbd:][TAB]] | Complete |
|
||||
| [[kbd:][TAB]] | (when completing) Go to next candidate |
|
||||
| [[kbd:][S-TAB]] | (when completing) Go to previous candidate |
|
||||
|
||||
** Searching with multiple keywords
|
||||
If the [[doom-module:][:completion vertico]] module is enabled, users can perform code completion
|
||||
with multiple search keywords by use of space as separator. More information can
|
||||
be found [[https://github.com/oantolin/orderless#company][here]]. Pressing [[kdb:][C-SPC]] again while completing inserts a space as
|
||||
separator. This allows searching with space-separated terms; each piece will
|
||||
match individually and in any order, with smart casing. Pressing just [[kbd:][SPC]] acts
|
||||
as normal and restarts completion, so that when typing sentences it doesn't try
|
||||
to complete the whole sentence instead of just the word.
|
||||
|
||||
Without [[doom-module:][:completion vertico]], it still works, just not as intelligently, due to
|
||||
the lack of orderless.
|
||||
|
||||
** Exporting to the minibuffer (requires [[doom-module:][:completion vertico]])
|
||||
When using the [[doom-module:][:completion vertico]] module, which pulls in the [[doom-package:][consult]] package,
|
||||
the entries shown in the completion popup can be exported to a consult
|
||||
minibuffer, giving access to all the manipulations the vertico suite allows. For
|
||||
instance, one could use this to export with [[doom-package:][embark]] via [[kbd:][C-c C-l]] and get a buffer
|
||||
with all candidates.
|
||||
|
||||
** Ispell completion
|
||||
Ispell completion is supported, so long as you point to the right ~.dic~ file in
|
||||
~ispell-alternate-dictionary~. For selected text modes (see the configuration
|
||||
section) it completes everywhere, for programming modes it can complete in
|
||||
comments and strings.
|
||||
|
||||
* Configuration
|
||||
A few variables may be set to change behavior of this module:
|
||||
|
||||
- +corfu-auto-delay ::
|
||||
Number of seconds till completion occurs automatically. Defaults to 0.1.
|
||||
- +corfu-auto-prefix ::
|
||||
Number of characters till auto-completion starts to happen. Defaults to 2.
|
||||
- +corfu-want-multi-component ::
|
||||
Sets whether orderless-style matching should be supported with space as a
|
||||
separator.
|
||||
- +corfu-ispell-completion-modes ::
|
||||
Lists modes in which to add ~cape-ispell~ as a capf. These show be majorly
|
||||
text modes, else you will get lots of bad suggestions, since when this matches
|
||||
it interrupts the flow of candidate selection.
|
||||
- +corfu-ispell-in-comments-and-strings ::
|
||||
Whether we should complete when point is inside a string or comment. If
|
||||
non-nil, works as in a text mode, else gives programming completions just like
|
||||
in the rest of the buffer.
|
||||
|
||||
Additionally, if you prefer to never stop completion on [[kbd:][SPC]], add the following
|
||||
to your ~config.el~:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(map! :map corfu-map
|
||||
:desc "insert separator" "C-SPC" #'corfu-insert-separator)
|
||||
#+end_src
|
||||
|
||||
* Troubleshooting
|
||||
[[doom-report:][Report an issue?]]
|
||||
|
||||
* Frequently asked questions
|
||||
/This module has no FAQs yet./ [[doom-suggest-faq:][Ask one?]]
|
||||
|
||||
* TODO Appendix
|
||||
#+begin_quote
|
||||
🔨 This module has no appendix yet. [[doom-contrib-module:][Write one?]]
|
||||
#+end_quote
|
||||
188
dots/doom/.back.modules/completion/corfu/config.el
Executable file
188
dots/doom/.back.modules/completion/corfu/config.el
Executable file
@@ -0,0 +1,188 @@
|
||||
;;; completion/corfu/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +corfu-auto-delay 0.1
|
||||
"How long after point stands still will completion be called automatically,
|
||||
in seconds.
|
||||
|
||||
Setting `corfu-auto-delay' directly may not work, as it needs to be set *before*
|
||||
enabling `corfu-mode'.")
|
||||
(defvar +corfu-auto-prefix 2
|
||||
"How many characters should be typed before auto-complete starts to kick in.
|
||||
|
||||
Setting `corfu-auto-prefix' directly may not work, as it needs to be set
|
||||
*before* enabling `corfu-mode'.")
|
||||
(defvar +corfu-want-multi-component t
|
||||
"Enables multiple component search, with pieces separated by spaces.
|
||||
|
||||
This allows search of non-contiguous unordered bits, for instance by typing
|
||||
\"tear rip\" to match \"rip-and-tear\". Notice the space, it does not break
|
||||
completion in this case.")
|
||||
(defvar +corfu-icon-height 0.9
|
||||
"The height applied to the icons (it is passed to both svg-lib and kind-icon).
|
||||
|
||||
It may need tweaking for the completions to not become cropped at the end.
|
||||
Note that changes are applied only after a cache reset, via
|
||||
`kind-icon-reset-cache'.")
|
||||
|
||||
(defvar +corfu-ispell-completion-modes '(org-mode markdown-mode text-mode)
|
||||
"Modes to enable ispell completion in.
|
||||
|
||||
For completion in comments, see `+corfu-ispell-in-comments-and-strings'.")
|
||||
(defvar +corfu-ispell-in-comments-and-strings t
|
||||
"Enable completion with ispell inside comments when in a `prog-mode'
|
||||
derivative.")
|
||||
|
||||
;;
|
||||
;;; Packages
|
||||
(use-package! corfu
|
||||
:hook (doom-first-buffer . global-corfu-mode)
|
||||
:init
|
||||
;; Auto-completion settings, must be set before calling `global-corfu-mode'.
|
||||
(setq corfu-auto t
|
||||
corfu-auto-delay +corfu-auto-delay
|
||||
corfu-auto-prefix +corfu-auto-prefix
|
||||
corfu-excluded-modes '(erc-mode
|
||||
circe-mode
|
||||
help-mode
|
||||
gud-mode
|
||||
vterm-mode))
|
||||
|
||||
:config
|
||||
(when (and (modulep! :tools lsp) (not (modulep! :tools lsp +eglot)))
|
||||
(add-hook 'lsp-mode-hook (defun doom--add-lsp-capf ()
|
||||
(add-to-list 'completion-at-point-functions (cape-capf-buster #'lsp-completion-at-point)))
|
||||
;; Below is so that context specific completions in cape come first.
|
||||
:depth 1))
|
||||
(add-to-list 'completion-styles 'partial-completion t)
|
||||
(add-to-list 'completion-styles 'initials t)
|
||||
(setq corfu-cycle t
|
||||
corfu-separator (when +corfu-want-multi-component ?\s)
|
||||
corfu-preselect t
|
||||
corfu-count 16
|
||||
corfu-max-width 120
|
||||
corfu-preview-current 'insert
|
||||
corfu-quit-at-boundary (if +corfu-want-multi-component 'separator t)
|
||||
corfu-quit-no-match (if +corfu-want-multi-component 'separator t)
|
||||
;; In the case of +tng, TAB should be smart regarding completion;
|
||||
;; However, it should otherwise behave like normal, whatever normal was.
|
||||
tab-always-indent (if (modulep! +tng) 'complete tab-always-indent))
|
||||
;; Only done with :tools vertico active due to orderless. Alternatively, we
|
||||
;; could set it up here if it's not there.
|
||||
(when (and +corfu-want-multi-component (modulep! :completion vertico))
|
||||
(cond ((modulep! :tools lsp +eglot) (add-to-list 'completion-category-overrides '(eglot (styles orderless))))
|
||||
((modulep! :tools lsp) (add-hook 'lsp-completion-mode-hook
|
||||
(defun doom--use-orderless-lsp-capf ()
|
||||
(setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
|
||||
'(orderless)))))))
|
||||
(map! (:unless (modulep! +tng)
|
||||
:desc "complete" "C-SPC" #'completion-at-point)
|
||||
(:map 'corfu-map
|
||||
(:when +corfu-want-multi-component
|
||||
:desc "insert separator" "C-SPC" #'corfu-insert-separator)
|
||||
(:when (modulep! :completion vertico)
|
||||
:desc "move to minibuffer" "s-<down>" #'corfu-move-to-minibuffer
|
||||
(:when (modulep! :editor evil)
|
||||
:desc "move to minibuffer" "s-j" #'corfu-move-to-minibuffer))
|
||||
(:when (modulep! +tng)
|
||||
:desc "next" [tab] #'corfu-next
|
||||
:desc "previous" [backtab] #'corfu-previous
|
||||
:desc "next" "TAB" #'corfu-next
|
||||
:desc "previous" "S-TAB" #'corfu-previous))))
|
||||
|
||||
;; Taken from corfu's README.
|
||||
;; TODO: extend this to other completion front-ends, mainly helm and ido, since
|
||||
;; ivy is being considered for removal.
|
||||
(when (modulep! :completion vertico)
|
||||
(defun corfu-move-to-minibuffer ()
|
||||
(interactive)
|
||||
(let ((completion-extra-properties corfu--extra)
|
||||
completion-cycle-threshold completion-cycling)
|
||||
(apply #'consult-completion-in-region completion-in-region--data))))
|
||||
|
||||
(use-package! cape
|
||||
:after corfu
|
||||
:commands (cape-dabbrev
|
||||
cape-file
|
||||
cape-history
|
||||
cape-keyword
|
||||
cape-tex
|
||||
cape-sgml
|
||||
cape-rfc1345
|
||||
cape-abbrev
|
||||
cape-ispell
|
||||
cape-dict
|
||||
cape-symbol
|
||||
cape-line)
|
||||
:init
|
||||
(add-to-list 'completion-at-point-functions #'cape-file)
|
||||
(when +corfu-ispell-in-comments-and-strings
|
||||
(defalias 'corfu--ispell-in-comments-and-strings
|
||||
(cape-super-capf (cape-capf-inside-comment #'cape-ispell)
|
||||
(cape-capf-inside-string #'cape-ispell)))
|
||||
(add-hook 'prog-mode-hook
|
||||
(lambda ()
|
||||
(add-to-list 'completion-at-point-functions #'corfu--ispell-in-comments-and-strings))))
|
||||
(dolist (sym +corfu-ispell-completion-modes)
|
||||
(add-hook (intern (concat (symbol-name sym) "-hook"))
|
||||
(lambda ()
|
||||
(add-to-list 'completion-at-point-functions #'cape-ispell))))
|
||||
(add-hook! '(TeX-mode-hook LaTeX-mode-hook org-mode-hook)
|
||||
(lambda ()
|
||||
(add-to-list 'completion-at-point-functions #'cape-tex t))
|
||||
:depth 2)
|
||||
(add-hook! '(html-mode-hook +web-react-mode-hook typescript-tsx-mode-hook org-mode-hook markdown-mode-hook)
|
||||
(lambda ()
|
||||
(add-to-list 'completion-at-point-functions #'cape-sgml t))
|
||||
:depth 2)
|
||||
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
|
||||
(add-to-list 'completion-at-point-functions #'cape-keyword)
|
||||
:config
|
||||
;; Enhances speed on large projects, for which many buffers may be open.
|
||||
(setq cape-dabbrev-check-other-buffers nil))
|
||||
|
||||
(use-package! kind-icon
|
||||
:when (modulep! +icons)
|
||||
:commands kind-icon-margin-formatter
|
||||
:init
|
||||
(add-hook 'corfu-margin-formatters #'kind-icon-margin-formatter)
|
||||
:config
|
||||
(setq kind-icon-default-face 'corfu-default
|
||||
kind-icon-blend-background t
|
||||
kind-icon-blend-frac 0.2)
|
||||
(plist-put kind-icon-default-style :height +corfu-icon-height)
|
||||
(plist-put svg-lib-style-default :height +corfu-icon-height))
|
||||
|
||||
(use-package! corfu-terminal
|
||||
:when (and (modulep! :os tty) (not (display-graphic-p)))
|
||||
:hook (corfu-mode . corfu-terminal-mode))
|
||||
|
||||
(use-package! dabbrev
|
||||
:config
|
||||
(setq dabbrev-ignored-buffer-regexps '("\\.\\(?:pdf\\|jpe?g\\|png\\)\\'")))
|
||||
|
||||
(setq read-extended-command-predicate
|
||||
#'command-completion-default-include-p)
|
||||
|
||||
;;
|
||||
;;; Extensions
|
||||
(use-package! corfu-history
|
||||
:after savehist
|
||||
:hook (corfu-mode . corfu-history-mode)
|
||||
:config
|
||||
(add-to-list 'savehist-additional-variables 'corfu-history))
|
||||
(use-package! corfu-popupinfo
|
||||
:hook (corfu-mode . corfu-popupinfo-mode)
|
||||
:config
|
||||
(setq corfu-popupinfo-delay '(0.5 . 1.0))
|
||||
(map! (:map 'corfu-map
|
||||
:desc "scroll info up" "C-<up>" #'corfu-popupinfo-scroll-down
|
||||
:desc "scroll info down" "C-<down>" #'corfu-popupinfo-scroll-up
|
||||
:desc "scroll info up" "C-S-p" #'corfu-popupinfo-scroll-down
|
||||
:desc "scroll info down" "C-S-n" #'corfu-popupinfo-scroll-up
|
||||
:desc "toggle info" "C-h" #'corfu-popupinfo-toggle)
|
||||
(:map 'corfu-popupinfo-map
|
||||
:when (modulep! :editor evil)
|
||||
;; Reversed because popupinfo assumes opposite of what feels intuitive
|
||||
;; with evil.
|
||||
:desc "scroll info up" "C-S-k" #'corfu-popupinfo-scroll-down
|
||||
:desc "scroll info down" "C-S-j" #'corfu-popupinfo-scroll-up)))
|
||||
10
dots/doom/.back.modules/completion/corfu/packages.el
Executable file
10
dots/doom/.back.modules/completion/corfu/packages.el
Executable file
@@ -0,0 +1,10 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; completion/corfu/packages.el
|
||||
|
||||
(package! corfu :recipe (:files ("*.el" "extensions/*.el")))
|
||||
(package! cape)
|
||||
(package! dabbrev)
|
||||
(when (modulep! +icons)
|
||||
(package! kind-icon))
|
||||
(when (modulep! :os tty)
|
||||
(package! corfu-terminal))
|
||||
57
dots/doom/.back.modules/tools/lsp2/+eglot.el
Executable file
57
dots/doom/.back.modules/tools/lsp2/+eglot.el
Executable file
@@ -0,0 +1,57 @@
|
||||
;;; tools/lsp/+eglot.el -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package! eglot
|
||||
:commands eglot eglot-ensure
|
||||
:hook (eglot-managed-mode . +lsp-optimization-mode)
|
||||
:init
|
||||
(setq eglot-sync-connect 1
|
||||
eglot-connect-timeout 10
|
||||
eglot-autoshutdown t
|
||||
eglot-send-changes-idle-time 0.5
|
||||
;; NOTE We disable eglot-auto-display-help-buffer because :select t in
|
||||
;; its popup rule causes eglot to steal focus too often.
|
||||
eglot-auto-display-help-buffer nil)
|
||||
(when (modulep! :checkers syntax)
|
||||
(setq eglot-stay-out-of '(flymake)))
|
||||
|
||||
:config
|
||||
(set-popup-rule! "^\\*eglot-help" :size 0.15 :quit t :select t)
|
||||
(set-lookup-handlers! 'eglot--managed-mode
|
||||
:definition #'xref-find-definitions
|
||||
:references #'xref-find-references
|
||||
:implementations #'eglot-find-implementation
|
||||
:type-definition #'eglot-find-typeDefinition
|
||||
:documentation #'+eglot-lookup-documentation)
|
||||
|
||||
(add-to-list 'doom-debug-variables '(eglot-events-buffer-size . 0))
|
||||
|
||||
(when (modulep! :checkers syntax)
|
||||
(after! flycheck
|
||||
(load! "autoload/flycheck-eglot")))
|
||||
|
||||
(defadvice! +lsp--defer-server-shutdown-a (fn &optional server)
|
||||
"Defer server shutdown for a few seconds.
|
||||
This gives the user a chance to open other project files before the server is
|
||||
auto-killed (which is a potentially expensive process). It also prevents the
|
||||
server getting expensively restarted when reverting buffers."
|
||||
:around #'eglot--managed-mode
|
||||
(letf! (defun eglot-shutdown (server)
|
||||
(if (or (null +lsp-defer-shutdown)
|
||||
(eq +lsp-defer-shutdown 0))
|
||||
(prog1 (funcall eglot-shutdown server)
|
||||
(+lsp-optimization-mode -1))
|
||||
(run-at-time
|
||||
(if (numberp +lsp-defer-shutdown) +lsp-defer-shutdown 3)
|
||||
nil (lambda (server)
|
||||
(unless (eglot--managed-buffers server)
|
||||
(prog1 (funcall eglot-shutdown server)
|
||||
(+lsp-optimization-mode -1))))
|
||||
server)))
|
||||
(funcall fn server))))
|
||||
|
||||
|
||||
(use-package! consult-eglot
|
||||
:defer t
|
||||
:when (modulep! :completion vertico)
|
||||
:init
|
||||
(map! :map eglot-mode-map [remap xref-find-apropos] #'consult-eglot-symbols))
|
||||
193
dots/doom/.back.modules/tools/lsp2/+lsp.el
Executable file
193
dots/doom/.back.modules/tools/lsp2/+lsp.el
Executable file
@@ -0,0 +1,193 @@
|
||||
;;; tools/lsp/+lsp.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +lsp-company-backends
|
||||
(if (modulep! :editor snippets)
|
||||
'(:separate company-capf company-yasnippet)
|
||||
'company-capf)
|
||||
"The backends to prepend to `company-backends' in `lsp-mode' buffers.
|
||||
Can be a list of backends; accepts any value `company-backends' accepts.")
|
||||
|
||||
|
||||
;;
|
||||
;;; Packages
|
||||
|
||||
(use-package! lsp-mode
|
||||
:commands lsp-install-server
|
||||
:init
|
||||
;; Don't touch ~/.emacs.d, which could be purged without warning
|
||||
(setq lsp-session-file (concat doom-cache-dir "lsp-session")
|
||||
lsp-server-install-dir (concat doom-data-dir "lsp"))
|
||||
;; Don't auto-kill LSP server after last workspace buffer is killed, because I
|
||||
;; will do it for you, after `+lsp-defer-shutdown' seconds.
|
||||
(setq lsp-keep-workspace-alive nil)
|
||||
|
||||
;; NOTE I tweak LSP's defaults in order to make its more expensive or imposing
|
||||
;; features opt-in. Some servers implement these poorly and, in most
|
||||
;; cases, it's safer to rely on Emacs' native mechanisms (eldoc vs
|
||||
;; lsp-ui-doc, open in popup vs sideline, etc).
|
||||
|
||||
;; Disable features that have great potential to be slow.
|
||||
(setq lsp-enable-folding nil
|
||||
lsp-enable-text-document-color nil)
|
||||
;; Reduce unexpected modifications to code
|
||||
(setq lsp-enable-on-type-formatting nil)
|
||||
;; Make breadcrumbs opt-in; they're redundant with the modeline and imenu
|
||||
(setq lsp-headerline-breadcrumb-enable nil)
|
||||
|
||||
;; Let doom bind the lsp keymap.
|
||||
(when (modulep! :config default +bindings)
|
||||
(setq lsp-keymap-prefix nil))
|
||||
|
||||
:config
|
||||
(add-to-list 'doom-debug-variables 'lsp-log-io)
|
||||
|
||||
(setq lsp-intelephense-storage-path (concat doom-data-dir "lsp-intelephense/")
|
||||
lsp-vetur-global-snippets-dir
|
||||
(expand-file-name
|
||||
"vetur" (or (bound-and-true-p +snippets-dir)
|
||||
(concat doom-user-dir "snippets/")))
|
||||
lsp-xml-jar-file (expand-file-name "org.eclipse.lsp4xml-0.3.0-uber.jar" lsp-server-install-dir)
|
||||
lsp-groovy-server-file (expand-file-name "groovy-language-server-all.jar" lsp-server-install-dir))
|
||||
|
||||
;; REVIEW Remove this once this is fixed upstream.
|
||||
(add-to-list 'lsp-client-packages 'lsp-racket)
|
||||
|
||||
(add-hook! 'doom-escape-hook
|
||||
(defun +lsp-signature-stop-maybe-h ()
|
||||
"Close the displayed `lsp-signature'."
|
||||
(when lsp-signature-mode
|
||||
(lsp-signature-stop)
|
||||
t)))
|
||||
|
||||
(set-popup-rule! "^\\*lsp-\\(help\\|install\\)" :size 0.35 :quit t :select t)
|
||||
(set-lookup-handlers! 'lsp-mode
|
||||
:definition #'+lsp-lookup-definition-handler
|
||||
:references #'+lsp-lookup-references-handler
|
||||
:documentation '(lsp-describe-thing-at-point :async t)
|
||||
:implementations '(lsp-find-implementation :async t)
|
||||
:type-definition #'lsp-find-type-definition)
|
||||
|
||||
(defadvice! +lsp--respect-user-defined-checkers-a (fn &rest args)
|
||||
"Ensure user-defined `flycheck-checker' isn't overwritten by `lsp'."
|
||||
:around #'lsp-diagnostics-flycheck-enable
|
||||
(if flycheck-checker
|
||||
(let ((old-checker flycheck-checker))
|
||||
(apply fn args)
|
||||
(setq-local flycheck-checker old-checker))
|
||||
(apply fn args)))
|
||||
|
||||
(add-hook! 'lsp-mode-hook #'+lsp-optimization-mode)
|
||||
|
||||
(when (modulep! :completion company)
|
||||
(add-hook! 'lsp-completion-mode-hook
|
||||
(defun +lsp-init-company-backends-h ()
|
||||
(when lsp-completion-mode
|
||||
(set (make-local-variable 'company-backends)
|
||||
(cons +lsp-company-backends
|
||||
(remove +lsp-company-backends
|
||||
(remq 'company-capf company-backends))))))))
|
||||
|
||||
(defvar +lsp--deferred-shutdown-timer nil)
|
||||
(defadvice! +lsp-defer-server-shutdown-a (fn &optional restart)
|
||||
"Defer server shutdown for a few seconds.
|
||||
This gives the user a chance to open other project files before the server is
|
||||
auto-killed (which is a potentially expensive process). It also prevents the
|
||||
server getting expensively restarted when reverting buffers."
|
||||
:around #'lsp--shutdown-workspace
|
||||
(if (or lsp-keep-workspace-alive
|
||||
restart
|
||||
(null +lsp-defer-shutdown)
|
||||
(= +lsp-defer-shutdown 0))
|
||||
(prog1 (funcall fn restart)
|
||||
(+lsp-optimization-mode -1))
|
||||
(when (timerp +lsp--deferred-shutdown-timer)
|
||||
(cancel-timer +lsp--deferred-shutdown-timer))
|
||||
(setq +lsp--deferred-shutdown-timer
|
||||
(run-at-time
|
||||
(if (numberp +lsp-defer-shutdown) +lsp-defer-shutdown 3)
|
||||
nil (lambda (workspace)
|
||||
(with-lsp-workspace workspace
|
||||
(unless (lsp--workspace-buffers workspace)
|
||||
(let ((lsp-restart 'ignore))
|
||||
(funcall fn))
|
||||
(+lsp-optimization-mode -1))))
|
||||
lsp--cur-workspace))))
|
||||
|
||||
(when (modulep! :ui modeline +light)
|
||||
(defvar-local lsp-modeline-icon nil)
|
||||
|
||||
(add-hook! '(lsp-before-initialize-hook
|
||||
lsp-after-initialize-hook
|
||||
lsp-after-uninitialized-functions
|
||||
lsp-before-open-hook
|
||||
lsp-after-open-hook)
|
||||
(defun +lsp-update-modeline (&rest _)
|
||||
"Update modeline with lsp state."
|
||||
(let* ((workspaces (lsp-workspaces))
|
||||
(face (if workspaces 'success 'warning))
|
||||
(label (if workspaces "LSP Connected" "LSP Disconnected")))
|
||||
(setq lsp-modeline-icon (concat
|
||||
" "
|
||||
(+modeline-format-icon 'faicon "rocket" "" face label -0.0575)
|
||||
" "))
|
||||
(add-to-list 'global-mode-string
|
||||
'(t (:eval lsp-modeline-icon)))))))
|
||||
(when (modulep! :completion corfu)
|
||||
(setq lsp-completion-provider :none)
|
||||
(add-hook 'lsp-mode-hook #'lsp-completion-mode)))
|
||||
|
||||
(use-package! lsp-ui
|
||||
:hook (lsp-mode . lsp-ui-mode)
|
||||
:init
|
||||
(defadvice! +lsp--use-hook-instead-a (fn &rest args)
|
||||
"Change `lsp--auto-configure' to not force `lsp-ui-mode' on us. Using a hook
|
||||
instead is more sensible."
|
||||
:around #'lsp--auto-configure
|
||||
(letf! ((#'lsp-ui-mode #'ignore))
|
||||
(apply fn args)))
|
||||
|
||||
:config
|
||||
(when (modulep! +peek)
|
||||
(set-lookup-handlers! 'lsp-ui-mode
|
||||
:definition 'lsp-ui-peek-find-definitions
|
||||
:implementations 'lsp-ui-peek-find-implementation
|
||||
:references 'lsp-ui-peek-find-references
|
||||
:async t))
|
||||
|
||||
(setq lsp-ui-peek-enable (modulep! +peek)
|
||||
lsp-ui-doc-max-height 8
|
||||
lsp-ui-doc-max-width 72 ; 150 (default) is too wide
|
||||
lsp-ui-doc-delay 0.75 ; 0.2 (default) is too naggy
|
||||
lsp-ui-doc-show-with-mouse nil ; don't disappear on mouseover
|
||||
lsp-ui-doc-position 'at-point
|
||||
lsp-ui-sideline-ignore-duplicate t
|
||||
;; Don't show symbol definitions in the sideline. They are pretty noisy,
|
||||
;; and there is a bug preventing Flycheck errors from being shown (the
|
||||
;; errors flash briefly and then disappear).
|
||||
lsp-ui-sideline-show-hover nil
|
||||
;; Re-enable icon scaling (it's disabled by default upstream for Emacs
|
||||
;; 26.x compatibility; see emacs-lsp/lsp-ui#573)
|
||||
lsp-ui-sideline-actions-icon lsp-ui-sideline-actions-icon-default)
|
||||
|
||||
(map! :map lsp-ui-peek-mode-map
|
||||
"j" #'lsp-ui-peek--select-next
|
||||
"k" #'lsp-ui-peek--select-prev
|
||||
"C-k" #'lsp-ui-peek--select-prev-file
|
||||
"C-j" #'lsp-ui-peek--select-next-file))
|
||||
|
||||
|
||||
(use-package! helm-lsp
|
||||
:when (modulep! :completion helm)
|
||||
:commands helm-lsp-workspace-symbol helm-lsp-global-workspace-symbol)
|
||||
|
||||
|
||||
(use-package! lsp-ivy
|
||||
:when (modulep! :completion ivy)
|
||||
:commands lsp-ivy-workspace-symbol lsp-ivy-global-workspace-symbol)
|
||||
|
||||
|
||||
(use-package! consult-lsp
|
||||
:defer t
|
||||
:when (modulep! :completion vertico)
|
||||
:init
|
||||
(map! :map lsp-mode-map [remap xref-find-apropos] #'consult-lsp-symbols))
|
||||
155
dots/doom/.back.modules/tools/lsp2/README.org
Executable file
155
dots/doom/.back.modules/tools/lsp2/README.org
Executable file
@@ -0,0 +1,155 @@
|
||||
#+title: :tools lsp
|
||||
#+subtitle: M-x vscode
|
||||
#+created: March 05, 2019
|
||||
#+since: 21.12.0
|
||||
|
||||
* Description :unfold:
|
||||
This module integrates [[https://langserver.org/][language servers]] into Doom Emacs. They provide features
|
||||
you'd expect from IDEs, like code completion, realtime linting, language-aware
|
||||
[[doom-package:imenu]]/[[doom-package:xref]] integration, jump-to-definition/references support, and more.
|
||||
|
||||
As of this writing, this is the state of LSP support in Doom Emacs:
|
||||
|
||||
| Module | Major modes | Default language server |
|
||||
|------------------+---------------------------------------------------------+---------------------------------------------------------------|
|
||||
| [[doom-module::lang cc]] | c-mode, c++-mode, objc-mode | ccls, clangd |
|
||||
| [[doom-module::lang clojure]] | clojure-mode | clojure-lsp |
|
||||
| [[doom-module::lang csharp]] | csharp-mode | omnisharp |
|
||||
| [[doom-module::lang elixir]] | elixir-mode | elixir-ls |
|
||||
| [[doom-module::lang fsharp]] | fsharp-mode | Mono, .NET core |
|
||||
| [[doom-module::lang go]] | go-mode | go-langserver |
|
||||
| [[doom-module::lang haskell]] | haskell-mode | haskell-language-server |
|
||||
| [[doom-module::lang java]] | java-mode | lsp-java |
|
||||
| [[doom-module::lang javascript]] | js2-mode, rjsx-mode, typescript-mode | ts-ls, deno-ls |
|
||||
| [[doom-module::lang julia]] | julia-mode | LanguageServer.jl |
|
||||
| [[doom-module::lang ocaml]] | tuareg-mode | ocaml-language-server |
|
||||
| [[doom-module::lang php]] | php-mode | php-language-server |
|
||||
| [[doom-module::lang purescript]] | purescript-mode | purescript-language-server |
|
||||
| [[doom-module::lang python]] | python-mode | lsp-python-ms |
|
||||
| [[doom-module::lang ruby]] | ruby-mode | solargraph |
|
||||
| [[doom-module::lang rust]] | rust-mode | rls |
|
||||
| [[doom-module::lang scala]] | scala-mode | metals |
|
||||
| [[doom-module::lang sh]] | sh-mode | bash-language-server |
|
||||
| [[doom-module::lang swift]] | swift-mode | sourcekit |
|
||||
| [[doom-module::lang web]] | web-mode, css-mode, scss-mode, sass-mode, less-css-mode | vscode-css-languageserver-bin, vscode-html-languageserver-bin |
|
||||
| [[doom-module::lang zig]] | zig-mode | zls |
|
||||
|
||||
** Maintainers
|
||||
/This module has no dedicated maintainers./ [[doom-contrib-maintainer:][Become a maintainer?]]
|
||||
|
||||
** Module flags
|
||||
- +eglot ::
|
||||
Use [[https://elpa.gnu.org/packages/eglot.html][Eglot]] instead of [[https://github.com/emacs-lsp/lsp-mode][LSP-mode]] to implement the LSP client in Emacs.
|
||||
- +peek ::
|
||||
Use ~lsp-ui-peek~ when looking up definitions and references with
|
||||
functionality from the [[doom-module::tools lookup]] module.
|
||||
|
||||
** Packages
|
||||
- [[doom-package:lsp-mode]]
|
||||
- [[doom-package:lsp-ui]]
|
||||
- [[doom-package:lsp-ivy]] ([[doom-module::completion ivy]])
|
||||
- [[doom-package:helm-lsp]] ([[doom-module::completion helm]])
|
||||
- [[doom-package:consult-lsp]] ([[doom-module::completion vertico]])
|
||||
- [[doom-package:eglot]]
|
||||
|
||||
** Hacks
|
||||
/No hacks documented for this module./
|
||||
|
||||
** TODO Changelog
|
||||
# This section will be machine generated. Don't edit it by hand.
|
||||
/This module does not have a changelog yet./
|
||||
|
||||
* Installation
|
||||
[[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]]
|
||||
|
||||
To get LSP working, you'll need to do three things:
|
||||
|
||||
1. Enable this module,
|
||||
2. Install a language server appropriate for your targeted language(s).
|
||||
3. Enable the [[doom-module:+lsp]] flag on the [[doom-module::lang]] modules you want to enable LSP support for.
|
||||
|
||||
Different languages will need different language servers, some of which [[doom-package:lsp-mode]]
|
||||
will prompt you to auto-install, but [[doom-package:eglot]] will not.
|
||||
|
||||
A table that lists available language servers and how to install them can be
|
||||
found [[https://emacs-lsp.github.io/lsp-mode/page/languages/][on the lsp-mode project README]]. The documentation of the module for your
|
||||
targeted language will contain brief instructions as well.
|
||||
|
||||
For eglot users, a list of [[https://github.com/joaotavora/eglot/blob/master/README.md#connecting-to-a-server][default servers supported is on Eglot's README]],
|
||||
including instructions to register your own.
|
||||
|
||||
* TODO Usage
|
||||
#+begin_quote
|
||||
🔨 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]]
|
||||
#+end_quote
|
||||
|
||||
** LSP-powered project search
|
||||
Without the [[doom-module:+eglot]] flag, and when [[doom-module::completion ivy]], [[doom-module::completion helm]] or
|
||||
[[doom-module::completion vertico]] is active, LSP is used to search a symbol indexed by the LSP
|
||||
server:
|
||||
| Keybind | Description |
|
||||
|---------+-------------------------------------|
|
||||
| [[kbd:][SPC c j]] | Jump to symbol in current workspace |
|
||||
| [[kbd:][SPC c J]] | Jump to symbol in any workspace |
|
||||
|
||||
** Differences between eglot and lsp-mode
|
||||
The two projects are large and actively developed, so without writing a novel,
|
||||
it can only be compared in (very) broad strokes:
|
||||
|
||||
- [[doom-package:lsp-mode]] tends to be more featureful, beginner-friendly (e.g. offers to
|
||||
install servers for you and has more [[https://emacs-lsp.github.io/lsp-mode][helpful documentation]]), and has a user
|
||||
experience that feels familiar to modern editors/IDEs, but at the cost of
|
||||
performance (at baseline) and complexity (it has more moving parts and
|
||||
reinvents a number of wheels to achieve a slicker UI, like ~lsp-ui-peek~,
|
||||
~lsp-ui-sideline~, etc).
|
||||
|
||||
- [[doom-package:eglot]] has fewer bells and whistles: it relies on built-in Emacs functionality
|
||||
more (eldoc, xref, capf, project.el, etc), offers less pre-configuration for
|
||||
you, and is more performant than lsp-mode (again, at baseline). It also works
|
||||
with TRAMP out-of-the-box (lsp-mode needs some extra configuration).
|
||||
|
||||
#+begin_quote
|
||||
💬 I recommend beginners use lsp-mode. More experienced users may also opt to
|
||||
disable many of [[https://emacs-lsp.github.io/lsp-mode/tutorials/how-to-turn-off/][its inessential features]] to gain back some ground on
|
||||
performance and complexity costs.
|
||||
#+end_quote
|
||||
|
||||
All that said, it's easy to switch between the two implementations by swapping
|
||||
in/out the [[doom-module:+lsp]] or [[doom-module:+eglot]] flag when [[id:01cffea4-3329-45e2-a892-95a384ab2338][enabling this module]].
|
||||
|
||||
* TODO Configuration
|
||||
#+begin_quote
|
||||
🔨 /This module's configuration documentation is incomplete./ [[doom-contrib-module:][Complete it?]]
|
||||
#+end_quote
|
||||
|
||||
** Turn off lsp-mode's intrusive features
|
||||
Many users may not like how many UI elements that lsp-mode adds. They have [[https://emacs-lsp.github.io/lsp-mode/tutorials/how-to-turn-off/][some
|
||||
excellent documentation]] outlining what these features are called and how to turn
|
||||
them off.
|
||||
|
||||
* Troubleshooting
|
||||
[[doom-report:][Report an issue?]]
|
||||
|
||||
** My language server is not found
|
||||
Check the entry in the [[../../../docs/faq.org][FAQ]] about "Doom can't find my executables/doesn't inherit
|
||||
the correct ~PATH~"
|
||||
|
||||
** LSP/Eglot is not started automatically in my buffer
|
||||
Make sure that you have enabled the [[doom-module:+lsp]] flag on the appropriate module(s) (in
|
||||
your ~doom!~ block in =$DOOMDIR/init.el=):
|
||||
#+begin_src diff
|
||||
:lang
|
||||
-python
|
||||
+(python +lsp)
|
||||
#+end_src
|
||||
|
||||
** LSP is slow
|
||||
Follow [[https://emacs-lsp.github.io/lsp-mode/page/performance/#tuning][lsp-tuning-guide]] to further fine-tune LSP mode performance.
|
||||
|
||||
* Frequently asked questions
|
||||
/This module has no FAQs yet./ [[doom-suggest-faq:][Ask one?]]
|
||||
|
||||
* TODO Appendix
|
||||
#+begin_quote
|
||||
🔨 This module has no appendix yet. [[doom-contrib-module:][Write one?]]
|
||||
#+end_quote
|
||||
10
dots/doom/.back.modules/tools/lsp2/autoload/common.el
Executable file
10
dots/doom/.back.modules/tools/lsp2/autoload/common.el
Executable file
@@ -0,0 +1,10 @@
|
||||
;;; tools/lsp/autoload/common.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autodef (fset 'lsp! #'ignore)
|
||||
(defun lsp! ()
|
||||
"Dispatch to call the currently used lsp client entrypoint"
|
||||
(interactive)
|
||||
(if (modulep! +eglot)
|
||||
(eglot-ensure)
|
||||
(unless (bound-and-true-p lsp-mode)
|
||||
(lsp-deferred))))
|
||||
39
dots/doom/.back.modules/tools/lsp2/autoload/eglot.el
Executable file
39
dots/doom/.back.modules/tools/lsp2/autoload/eglot.el
Executable file
@@ -0,0 +1,39 @@
|
||||
;;; tools/lsp/autoload/eglot.el -*- lexical-binding: t; -*-
|
||||
;;;###if (modulep! +eglot)
|
||||
|
||||
;;;###autodef
|
||||
(defun set-eglot-client! (mode server-call)
|
||||
"Add SERVER-CALL list as a possible lsp server for given major MODE.
|
||||
|
||||
Example : (set-eglot-client! 'python-mode `(,(concat doom-data-dir \"lsp/mspyls/Microsoft.Python.LanguageServer\")))"
|
||||
(after! eglot
|
||||
(add-to-list 'eglot-server-programs `(,mode . ,server-call))))
|
||||
|
||||
;; HACK Eglot removed `eglot-help-at-point' in joaotavora/eglot@a044dec for a
|
||||
;; more problematic approach of deferred to eldoc. Here, I've restored it.
|
||||
;; Doom's lookup handlers try to open documentation in a separate window
|
||||
;; (so they can be copied or kept open), but doing so with an eldoc buffer
|
||||
;; is difficult because a) its contents are generated asynchronously,
|
||||
;; making them tough to scrape, and b) their contents change frequently
|
||||
;; (every time you move your cursor).
|
||||
(defvar +eglot--help-buffer nil)
|
||||
;;;###autoload
|
||||
(defun +eglot-lookup-documentation (_identifier)
|
||||
"Request documentation for the thing at point."
|
||||
(eglot--dbind ((Hover) contents range)
|
||||
(jsonrpc-request (eglot--current-server-or-lose) :textDocument/hover
|
||||
(eglot--TextDocumentPositionParams))
|
||||
(let ((blurb (and (not (seq-empty-p contents))
|
||||
(eglot--hover-info contents range)))
|
||||
(hint (thing-at-point 'symbol)))
|
||||
(if blurb
|
||||
(with-current-buffer
|
||||
(or (and (buffer-live-p +eglot--help-buffer)
|
||||
+eglot--help-buffer)
|
||||
(setq +eglot--help-buffer (generate-new-buffer "*eglot-help*")))
|
||||
(with-help-window (current-buffer)
|
||||
(rename-buffer (format "*eglot-help for %s*" hint))
|
||||
(with-current-buffer standard-output (insert blurb))
|
||||
(setq-local nobreak-char-display nil)))
|
||||
(display-local-help))))
|
||||
'deferred)
|
||||
76
dots/doom/.back.modules/tools/lsp2/autoload/flycheck-eglot.el
Executable file
76
dots/doom/.back.modules/tools/lsp2/autoload/flycheck-eglot.el
Executable file
@@ -0,0 +1,76 @@
|
||||
;;; flycheck-eglot --- Hacky eglot support in flycheck -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;; This file sets up flycheck so that, when eglot receives a publishDiagnostics method
|
||||
;; from the server, flycheck updates the reports.
|
||||
;;
|
||||
;; Thanks to:
|
||||
;; - joaotavora for adding a handle to plug flycheck, and
|
||||
;; - purcell for finding out the initial stub and the current implementation
|
||||
;;
|
||||
;; It works by creating a bridge function which can be used as the argument of
|
||||
;; `eglot-flymake-backend', which both consumes diagnostics and queue a call to
|
||||
;; 'flycheck-buffer'
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(defvar-local +lsp--flycheck-eglot--current-errors nil)
|
||||
|
||||
(defun +lsp--flycheck-eglot-init (checker callback)
|
||||
"CHECKER is the checker (eglot).
|
||||
CALLBACK is the function that we need to call when we are done, on all the errors."
|
||||
(eglot-flymake-backend #'+lsp--flycheck-eglot--on-diagnostics)
|
||||
(funcall callback 'finished +lsp--flycheck-eglot--current-errors))
|
||||
|
||||
(defun +lsp--flycheck-eglot--on-diagnostics (diags &rest _)
|
||||
(cl-labels
|
||||
((flymake-diag->flycheck-err
|
||||
(diag)
|
||||
(with-current-buffer (flymake--diag-buffer diag)
|
||||
(flycheck-error-new-at-pos
|
||||
(flymake--diag-beg diag)
|
||||
(pcase (flymake--diag-type diag)
|
||||
('eglot-note 'info)
|
||||
('eglot-warning 'warning)
|
||||
('eglot-error 'error)
|
||||
(_ (error "Unknown diagnostic type, %S" diag)))
|
||||
(flymake--diag-text diag)
|
||||
:end-pos (flymake--diag-end diag)
|
||||
:checker 'eglot
|
||||
:buffer (current-buffer)
|
||||
:filename (buffer-file-name)))))
|
||||
(setq +lsp--flycheck-eglot--current-errors
|
||||
(mapcar #'flymake-diag->flycheck-err diags))
|
||||
;; Call Flycheck to update the diagnostics annotations
|
||||
(flycheck-buffer-deferred)))
|
||||
|
||||
(defun +lsp--flycheck-eglot-available-p ()
|
||||
(bound-and-true-p eglot--managed-mode))
|
||||
|
||||
(flycheck-define-generic-checker 'eglot
|
||||
"Report `eglot' diagnostics using `flycheck'."
|
||||
:start #'+lsp--flycheck-eglot-init
|
||||
:predicate #'+lsp--flycheck-eglot-available-p
|
||||
:modes '(prog-mode text-mode))
|
||||
|
||||
(push 'eglot flycheck-checkers)
|
||||
|
||||
(add-hook! 'eglot-managed-mode-hook
|
||||
(defun +lsp-eglot-prefer-flycheck-h ()
|
||||
(when eglot--managed-mode
|
||||
(flymake-mode -1)
|
||||
(when-let ((current-checker (flycheck-get-checker-for-buffer)))
|
||||
(unless (equal current-checker 'eglot)
|
||||
(flycheck-add-next-checker 'eglot current-checker)))
|
||||
(flycheck-add-mode 'eglot major-mode)
|
||||
(flycheck-mode 1)
|
||||
;; Call flycheck on initilization to make sure to display initial
|
||||
;; errors
|
||||
(flycheck-buffer-deferred))))
|
||||
|
||||
(after! flymake
|
||||
(when (and
|
||||
(not (fboundp 'flymake--diag-buffer))
|
||||
(fboundp 'flymake--diag-locus))
|
||||
(defalias 'flymake--diag-buffer 'flymake--diag-locus)))
|
||||
|
||||
;;; flycheck-eglot.el ends here
|
||||
75
dots/doom/.back.modules/tools/lsp2/autoload/lsp-mode.el
Executable file
75
dots/doom/.back.modules/tools/lsp2/autoload/lsp-mode.el
Executable file
@@ -0,0 +1,75 @@
|
||||
;;; tools/lsp/autoload/lsp-mode.el -*- lexical-binding: t; -*-
|
||||
;;;###if (not (modulep! +eglot))
|
||||
|
||||
;;;###autodef
|
||||
(defun set-lsp-priority! (client priority)
|
||||
"Change the PRIORITY of lsp CLIENT."
|
||||
(require 'lsp-mode)
|
||||
(if-let (client (gethash client lsp-clients))
|
||||
(setf (lsp--client-priority client)
|
||||
priority)
|
||||
(error "No LSP client named %S" client)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +lsp/uninstall-server (dir)
|
||||
"Delete a LSP server from `lsp-server-install-dir'."
|
||||
(interactive
|
||||
(list (read-directory-name "Uninstall LSP server: " lsp-server-install-dir nil t)))
|
||||
(unless (file-directory-p dir)
|
||||
(user-error "Couldn't find %S directory" dir))
|
||||
(delete-directory dir 'recursive)
|
||||
(message "Uninstalled %S" (file-name-nondirectory dir)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +lsp/switch-client (client)
|
||||
"Switch to another LSP server."
|
||||
(interactive
|
||||
(progn
|
||||
(require 'lsp-mode)
|
||||
(list (completing-read
|
||||
"Select server: "
|
||||
(or (mapcar #'lsp--client-server-id (lsp--filter-clients (-andfn #'lsp--supports-buffer?
|
||||
#'lsp--server-binary-present?)))
|
||||
(user-error "No available LSP clients for %S" major-mode))))))
|
||||
(require 'lsp-mode)
|
||||
(let* ((client (if (symbolp client) client (intern client)))
|
||||
(match (car (lsp--filter-clients (lambda (c) (eq (lsp--client-server-id c) client)))))
|
||||
(workspaces (lsp-workspaces)))
|
||||
(unless match
|
||||
(user-error "Couldn't find an LSP client named %S" client))
|
||||
(let ((old-priority (lsp--client-priority match)))
|
||||
(setf (lsp--client-priority match) 9999)
|
||||
(unwind-protect
|
||||
(if workspaces
|
||||
(lsp-workspace-restart
|
||||
(if (cdr workspaces)
|
||||
(lsp--completing-read "Select server: "
|
||||
workspaces
|
||||
'lsp--workspace-print
|
||||
nil t)
|
||||
(car workspaces)))
|
||||
(lsp-mode +1))
|
||||
(add-transient-hook! 'lsp-after-initialize-hook
|
||||
(setf (lsp--client-priority match) old-priority))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +lsp-lookup-definition-handler ()
|
||||
"Find definition of the symbol at point using LSP."
|
||||
(interactive)
|
||||
(when-let (loc (lsp-request "textDocument/definition"
|
||||
(lsp--text-document-position-params)))
|
||||
(lsp-show-xrefs (lsp--locations-to-xref-items loc) nil nil)
|
||||
'deferred))
|
||||
|
||||
;;;###autoload
|
||||
(defun +lsp-lookup-references-handler (&optional include-declaration)
|
||||
"Find project-wide references of the symbol at point using LSP."
|
||||
(interactive "P")
|
||||
(when-let
|
||||
(loc (lsp-request "textDocument/references"
|
||||
(append (lsp--text-document-position-params)
|
||||
(list
|
||||
:context `(:includeDeclaration
|
||||
,(lsp-json-bool include-declaration))))))
|
||||
(lsp-show-xrefs (lsp--locations-to-xref-items loc) nil t)
|
||||
'deferred))
|
||||
47
dots/doom/.back.modules/tools/lsp2/config.el
Executable file
47
dots/doom/.back.modules/tools/lsp2/config.el
Executable file
@@ -0,0 +1,47 @@
|
||||
;;; tools/lsp/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +lsp-defer-shutdown 3
|
||||
"If non-nil, defer shutdown of LSP servers for this many seconds after last
|
||||
workspace buffer is closed.
|
||||
|
||||
This delay prevents premature server shutdown when a user still intends on
|
||||
working on that project after closing the last buffer, or when programmatically
|
||||
killing and opening many LSP/eglot-powered buffers.")
|
||||
|
||||
|
||||
;;
|
||||
;;; Common
|
||||
|
||||
(defvar +lsp--default-read-process-output-max nil)
|
||||
(defvar +lsp--default-gcmh-high-cons-threshold nil)
|
||||
(defvar +lsp--optimization-init-p nil)
|
||||
|
||||
(define-minor-mode +lsp-optimization-mode
|
||||
"Deploys universal GC and IPC optimizations for `lsp-mode' and `eglot'."
|
||||
:global t
|
||||
:init-value nil
|
||||
(if (not +lsp-optimization-mode)
|
||||
(setq-default read-process-output-max +lsp--default-read-process-output-max
|
||||
gcmh-high-cons-threshold +lsp--default-gcmh-high-cons-threshold
|
||||
+lsp--optimization-init-p nil)
|
||||
;; Only apply these settings once!
|
||||
(unless +lsp--optimization-init-p
|
||||
(setq +lsp--default-read-process-output-max (default-value 'read-process-output-max)
|
||||
+lsp--default-gcmh-high-cons-threshold (default-value 'gcmh-high-cons-threshold))
|
||||
(setq-default read-process-output-max (* 1024 1024))
|
||||
;; REVIEW LSP causes a lot of allocations, with or without the native JSON
|
||||
;; library, so we up the GC threshold to stave off GC-induced
|
||||
;; slowdowns/freezes. Doom uses `gcmh' to enforce its GC strategy,
|
||||
;; so we modify its variables rather than `gc-cons-threshold'
|
||||
;; directly.
|
||||
(setq-default gcmh-high-cons-threshold (* 2 +lsp--default-gcmh-high-cons-threshold))
|
||||
(gcmh-set-high-threshold)
|
||||
(setq +lsp--optimization-init-p t))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Implementations
|
||||
|
||||
(if (modulep! +eglot)
|
||||
(load! "+eglot")
|
||||
(load! "+lsp"))
|
||||
9
dots/doom/.back.modules/tools/lsp2/doctor.el
Executable file
9
dots/doom/.back.modules/tools/lsp2/doctor.el
Executable file
@@ -0,0 +1,9 @@
|
||||
;;; tools/lsp/doctor.el -*- lexical-binding: t; -*-
|
||||
|
||||
(assert! (not (and (modulep! +eglot)
|
||||
(modulep! +peek)))
|
||||
"+eglot and +peek flags are not compatible. Peek uses lsp-mode, while Eglot is another package altogether for LSP.")
|
||||
|
||||
(unless (executable-find "npm")
|
||||
(warn! "Couldn't find npm, most server installers won't work and will have to be installed manually.
|
||||
For more information, see https://emacs-lsp.github.io/lsp-mode/page/languages/."))
|
||||
16
dots/doom/.back.modules/tools/lsp2/packages.el
Executable file
16
dots/doom/.back.modules/tools/lsp2/packages.el
Executable file
@@ -0,0 +1,16 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; tools/lsp/packages.el
|
||||
|
||||
(if (modulep! +eglot)
|
||||
(progn
|
||||
(package! eglot :pin "e501275e06952889056268dabe08ccd0dbaf23e5")
|
||||
(when (modulep! :completion vertico)
|
||||
(package! consult-eglot :pin "0da8801dd8435160ce1f62ad8066bd52e38f5cbd")))
|
||||
(package! lsp-mode :pin "a3b3c15359405f442fc51a2db09e503ca3b39f3d")
|
||||
(package! lsp-ui :pin "3cd7cc61273341023b863dcf45906ac9142fd1aa")
|
||||
(when (modulep! :completion ivy)
|
||||
(package! lsp-ivy :pin "9ecf4dd9b1207109802bd1882aa621eb1c385106"))
|
||||
(when (modulep! :completion helm)
|
||||
(package! helm-lsp :pin "c2c6974dadfac459b1a69a1217441283874cea92"))
|
||||
(when (modulep! :completion vertico)
|
||||
(package! consult-lsp :pin "58b541476203fa68e9e7682531f2a10e11780857")))
|
||||
BIN
dots/doom/asm-ref.pdf
Executable file
BIN
dots/doom/asm-ref.pdf
Executable file
Binary file not shown.
255
dots/doom/config.el
Executable file
255
dots/doom/config.el
Executable file
@@ -0,0 +1,255 @@
|
||||
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; Place your private configuration here! Remember, you do not need to run 'doom
|
||||
;; sync' after modifying this file!
|
||||
|
||||
|
||||
;; Some functionality uses this to identify you, e.g. GPG configuration, email
|
||||
;; clients, file templates and snippets.
|
||||
(setq user-full-name "Zastian Pretorius"
|
||||
user-mail-address "Zastian00@gmail.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:
|
||||
;; (setq doom-font (font-spec :family "monospace" :size 12 :weight 'semi-light)
|
||||
;; doom-variable-pitch-font (font-spec :family "sans" :size 13))
|
||||
|
||||
;; 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:
|
||||
;;(add-to-list 'load-path "~/.config/doom/themes")
|
||||
(setq doom-theme 'doom-dracula)
|
||||
|
||||
|
||||
|
||||
;; 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 "~/org/")
|
||||
|
||||
|
||||
(add-to-list 'load-path "~/.config/doom/lisp")
|
||||
|
||||
|
||||
;; 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)
|
||||
|
||||
;; scroll one line at a time (less "jumpy" than defaults)
|
||||
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
|
||||
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
|
||||
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
|
||||
(setq scroll-step 1) ;; keyboard scroll one line at a time
|
||||
(setq auto-window-vscroll nil)
|
||||
|
||||
(set-fontset-font "fontset-default" nil (font-spec :size 17 :name "ZedMono Nerd Font"))
|
||||
|
||||
(setq doom-font (font-spec :family "Illusion Z" :size 17)
|
||||
doom-variable-pitch-font (font-spec :family "Illusion Z" :size 17)
|
||||
doom-big-font (font-spec :family "Illusion Z" :size 24))
|
||||
|
||||
(require 'whitespace)
|
||||
(setq whitespace-line-column 99)
|
||||
(setq whitespace-style '(face lines-tail))
|
||||
(add-hook 'prog-mode-hook 'whitespace-mode)
|
||||
|
||||
(require 'fill-column-indicator)
|
||||
(setq fci-rule-column 99)
|
||||
(setq fci-rule-width 1)
|
||||
(setq fci-rule-color "#a280d5")
|
||||
(add-hook 'prog-mode-hook 'fci-mode)
|
||||
|
||||
;; tab width
|
||||
(setq-default tab-width 4) ;; Set tab width to 2 spaces
|
||||
(setq-default indent-tabs-mode nil) ;; Use spaces instead of tabs
|
||||
(add-hook 'prog-mode-hook
|
||||
(lambda ()
|
||||
(setq-local tab-width 4)
|
||||
(setq-local indent-tabs-mode nil)))
|
||||
(setq lisp-indent-offset 4)
|
||||
(use-package nix-mode
|
||||
:mode "\\.nix\\'"
|
||||
:config
|
||||
(setq nix-indent-function (lambda (_) 4)))
|
||||
|
||||
(setq rust-indent-offset 4)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
(custom-set-faces
|
||||
'(org-level-1 ((t (:inherit outline-1 :height 1.4))))
|
||||
'(org-level-2 ((t (:inherit outline-2 :height 1.3))))
|
||||
'(org-level-3 ((t (:inherit outline-3 :height 1.2))))
|
||||
'(org-level-4 ((t (:inherit outline-4 :height 1.1))))
|
||||
'(org-level-5 ((t (:inherit outline-5 :height 1.0)))))
|
||||
|
||||
|
||||
;; company mode delay 0
|
||||
(setq company-idle-delay 0)
|
||||
|
||||
|
||||
|
||||
|
||||
;;japanese stuff
|
||||
(setq default-input-method "japanese")
|
||||
|
||||
|
||||
|
||||
(remove-hook '+doom-dashboard-functions #'doom-dashboard-widget-shortmenu)
|
||||
(remove-hook '+doom-dashboard-functions #'doom-dashboard-widget-footer)
|
||||
(add-hook! '+doom-dashboard-functions :append
|
||||
(insert "\n" (+doom-dashboard--center +doom-dashboard--width "The UwU Editor")))
|
||||
|
||||
;;
|
||||
;;
|
||||
;;
|
||||
(setq org-image-actual-width 300)
|
||||
|
||||
(setq fancy-splash-image (concat doom-user-dir "xenia.png"))
|
||||
|
||||
(setq ess-r--no-company-meta t)
|
||||
|
||||
(set-frame-parameter nil 'alpha-background 90) ; For current frame
|
||||
(add-to-list 'default-frame-alist '(alpha-background . 90)) ; For all new frames henceforth
|
||||
(add-to-list 'default-frame-alist '(undecorated . t))
|
||||
|
||||
|
||||
|
||||
;undo fix
|
||||
(setq undo-tree-enable-undo-in-region nil)
|
||||
(setq undo-limit 8000000000)
|
||||
|
||||
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'((emacs-lisp . t)
|
||||
(julia . t)
|
||||
(python . t)
|
||||
(jupyter . t)))
|
||||
|
||||
;; accept completion from copilot and fallback to company
|
||||
(defun my-tab ()
|
||||
(interactive)
|
||||
(or (copilot-accept-completion)
|
||||
(company-indent-or-complete-common nil)))
|
||||
|
||||
|
||||
(use-package! copilot
|
||||
:hook (prog-mode . copilot-mode)
|
||||
:bind (("C-TAB" . 'copilot-accept-completion-by-word)
|
||||
("C-<tab>" . 'copilot-accept-completion-by-word)
|
||||
:map company-active-map
|
||||
("<tab>" . 'my-tab)
|
||||
("TAB" . 'my-tab)
|
||||
:map company-mode-map
|
||||
("<tab>" . 'my-tab)
|
||||
("TAB" . 'my-tab)))
|
||||
(setq copilot-log-max 1000)
|
||||
|
||||
;; asm stuff
|
||||
(use-package! nasm-mode
|
||||
:mode "\\.[n]*\\(asm\\|s\\)\\'")
|
||||
|
||||
;; Get Haxor VM from https://github.com/krzysztof-magosa/haxor
|
||||
(use-package! haxor-mode
|
||||
:mode "\\.hax\\'")
|
||||
|
||||
(use-package! mips-mode
|
||||
:mode "\\.mips\\'")
|
||||
|
||||
(use-package! riscv-mode
|
||||
:mode "\\.riscv\\'")
|
||||
|
||||
(use-package x86-lookup
|
||||
:ensure t
|
||||
:config
|
||||
(setq x86-lookup-pdf "~/.config/doom/asm-ref.pdf"))
|
||||
|
||||
(setq openai-key (getenv "OPENAIKEY"))
|
||||
(setq chatgpt-input-method 'minibuffer)
|
||||
|
||||
|
||||
|
||||
;;discord rich presence
|
||||
;;(require 'elcord)
|
||||
;;(add-hook 'doom-switch-buffer-hook
|
||||
;; (lambda ()
|
||||
;; (if (string= (buffer-name) "*doom*")
|
||||
;; (elcord-mode -1)
|
||||
;; (elcord-mode 1))))
|
||||
;;
|
||||
;;(defun elcord--disable-elcord-if-no-frames (f)
|
||||
;; (declare (ignore f))
|
||||
;; (when (let ((frames (delete f (visible-frame-list))))
|
||||
;; (or (null frames)
|
||||
;; (and (null (cdr frames))
|
||||
;; (eq (car frames) terminal-frame))))
|
||||
;; (elcord-mode -1)
|
||||
;; (add-hook 'after-make-frame-functions 'elcord--enable-on-frame-created)))
|
||||
;;
|
||||
;;(defun elcord--enable-on-frame-created (f)
|
||||
;; (declare (ignore f))
|
||||
;; (elcord-mode +1))
|
||||
;;
|
||||
;;(defun my/elcord-mode-hook ()
|
||||
;; (if elcord-mode
|
||||
;; (add-hook 'delete-frame-functions 'elcord--disable-elcord-if-no-frames)
|
||||
;; (remove-hook 'delete-frame-functions 'elcord--disable-elcord-if-no-frames)))
|
||||
;;
|
||||
;;(add-hook 'elcord-mode-hook 'my/elcord-mode-hook)
|
||||
;;
|
||||
;;(setq elcord-idle-message "Out doing your mom")
|
||||
|
||||
|
||||
;; add my_stuff.el here and load it
|
||||
(load! "my_stuff.el")
|
||||
|
||||
|
||||
;;ollama stuff
|
||||
;;
|
||||
(use-package ellama
|
||||
:init
|
||||
;; setup key bindings
|
||||
(setopt ellama-keymap-prefix "C-c e")
|
||||
;; language you want ellama to translate to
|
||||
(setopt ellama-language "English")
|
||||
;; could be llm-openai for example
|
||||
(require 'llm-ollama)
|
||||
(setopt ellama-provider
|
||||
(make-llm-ollama
|
||||
;; this model should be pulled to use it
|
||||
;; value should be the same as you print in terminal during pull
|
||||
:chat-model "codellama:13b"
|
||||
:embedding-model "codellama:13b"))
|
||||
)
|
||||
|
||||
|
||||
;; custom functions
|
||||
|
||||
|
||||
|
||||
;; Here are some additional functions/macros that could help you configure Doom:
|
||||
;;
|
||||
;; - `load!' for loading external *.el files relative to this one
|
||||
;; - `use-package!' for configuring packages
|
||||
;; - `after!' for running code after a package has loaded
|
||||
;; - `add-load-path!' for adding directories to the `load-path', relative to
|
||||
;; this file. Emacs searches the `load-path' when you load packages with
|
||||
;; `require' or `use-package'.
|
||||
;; - `map!' for binding new keys
|
||||
;;
|
||||
;; To get information about any of these functions/macros, move the cursor over
|
||||
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
|
||||
;; This will open documentation for it, including demos of how they are used.
|
||||
;;
|
||||
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
|
||||
;; they are implemented.
|
||||
24
dots/doom/custom.el
Executable file
24
dots/doom/custom.el
Executable file
@@ -0,0 +1,24 @@
|
||||
(custom-set-variables
|
||||
;; custom-set-variables was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(elfeed-feeds '("https://www.reddit.com/r/pcmasterrace/rss"))
|
||||
'(warning-suppress-log-types '((initialization)))
|
||||
'(warning-suppress-types
|
||||
'((lsp-mode)
|
||||
(lsp-mode)
|
||||
(lsp-mode)
|
||||
(lsp-mode)
|
||||
(initialization)
|
||||
(initialization))))
|
||||
(custom-set-faces
|
||||
;; custom-set-faces was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(org-level-1 ((t (:inherit outline-1 :height 1.4))))
|
||||
'(org-level-2 ((t (:inherit outline-2 :height 1.3))))
|
||||
'(org-level-3 ((t (:inherit outline-3 :height 1.2))))
|
||||
'(org-level-4 ((t (:inherit outline-4 :height 1.1))))
|
||||
'(org-level-5 ((t (:inherit outline-5 :height 1.0)))))
|
||||
192
dots/doom/init.el
Executable file
192
dots/doom/init.el
Executable file
@@ -0,0 +1,192 @@
|
||||
;;; 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 "Module Index" link where you'll find
|
||||
;; a comprehensive list 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 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
|
||||
;;chinese
|
||||
japanese
|
||||
;;layout ; auie,ctsrnm is the superior home row
|
||||
|
||||
:completion
|
||||
;;(corfu +icons +orderless) ; the even more ultimate completion backend
|
||||
(company +icons +childframe) ; the ultimate code completion backend
|
||||
;;(helm +fuzzy) ; the *other* search engine for love and life
|
||||
;;ido ; the other *other* search engine...
|
||||
;;(ivy +fuzzy) ; a search engine for love and life
|
||||
(vertico +icons) ; 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 +hasklig) ; 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 ; 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 +icons) ; 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
|
||||
collab
|
||||
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
|
||||
;;biblio ; Writes a PhD for you (citation needed)
|
||||
(eval +overlay) ; run code, run (also, repls)
|
||||
;;gist ; interacting with github gists
|
||||
lookup ; navigate your code and its documentation
|
||||
lsp ; M-x vscode
|
||||
;;lsp2 ; my custom one
|
||||
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
|
||||
;;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 +lsp) ; 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
|
||||
;;fsharp ; ML stands for Microsoft's Language
|
||||
;;fstar ; (dependent) types and (monadic) effects and Z3
|
||||
(gdscript +lsp) ; the language you waited for
|
||||
(go +lsp) ; the hipster dialect
|
||||
(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 +lsp) ; I hereby declare "nix geht mehr!"
|
||||
;;ocaml ; an objective camel
|
||||
(org +lsp) ; organize your plain life in plain text
|
||||
;;php ; perl's insecure younger brother
|
||||
;;plantuml ; diagrams for confusing people more
|
||||
;;purescript ; javascript, but functional
|
||||
(python +lsp) ; 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 +org) ; emacs as an RSS reader
|
||||
;;twitter ; twitter client https://twitter.com/vnought
|
||||
|
||||
:config
|
||||
;;literate
|
||||
(default +bindings +smartparens))
|
||||
112
dots/doom/lisp/ollama.el
Executable file
112
dots/doom/lisp/ollama.el
Executable file
@@ -0,0 +1,112 @@
|
||||
;;; ollama.el --- ollama client for Emacs
|
||||
|
||||
;; Copyright (C) 2023 ZHOU Feng
|
||||
|
||||
;; Author: ZHOU Feng <zf.pascal@gmail.com>
|
||||
;; URL: http://github.com/zweifisch/ollama
|
||||
;; Keywords: ollama llama2
|
||||
;; Version: 0.0.1
|
||||
;; Created: 6th Aug 2023
|
||||
|
||||
;; This file 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.
|
||||
|
||||
;; This file 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 should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; ollama client for Emacs
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
(require 'json)
|
||||
(require 'cl-lib)
|
||||
(require 'url)
|
||||
|
||||
(defgroup ollama nil
|
||||
"Ollama client for Emacs."
|
||||
:group 'ollama)
|
||||
|
||||
(defcustom ollama:endpoint "http://localhost:11434/api/generate"
|
||||
"Ollama http service endpoint."
|
||||
:group 'ollama
|
||||
:type 'string)
|
||||
|
||||
(defcustom ollama:model "codellama:13b"
|
||||
"Ollama model."
|
||||
:group 'ollama
|
||||
:type 'string)
|
||||
|
||||
(defcustom ollama:language "English"
|
||||
"Language to translate to."
|
||||
:group 'ollama
|
||||
:type 'string)
|
||||
|
||||
(defun ollama-fetch (url prompt model)
|
||||
(let* ((url-request-method "POST")
|
||||
(url-request-extra-headers
|
||||
'(("Content-Type" . "application/json")))
|
||||
(url-request-data
|
||||
(encode-coding-string
|
||||
(json-encode `((model . ,model) (prompt . ,prompt)))
|
||||
'utf-8)))
|
||||
(with-current-buffer (url-retrieve-synchronously url)
|
||||
(goto-char url-http-end-of-headers)
|
||||
(decode-coding-string
|
||||
(buffer-substring-no-properties
|
||||
(point)
|
||||
(point-max))
|
||||
'utf-8))))
|
||||
|
||||
(defun ollama-get-response-from-line (line)
|
||||
(cdr
|
||||
(assoc 'response
|
||||
(json-read-from-string line))))
|
||||
|
||||
(defun ollama-prompt (url prompt model)
|
||||
(mapconcat 'ollama-get-response-from-line
|
||||
(cl-remove-if #'(lambda (str) (string= str ""))
|
||||
(split-string (ollama-fetch url prompt model) "\n")) ""))
|
||||
|
||||
;;;###autoload
|
||||
(defun ollama-prompt-line ()
|
||||
"Prompt with current word."
|
||||
(interactive)
|
||||
(with-output-to-temp-buffer "*ollama*"
|
||||
(princ
|
||||
(ollama-prompt ollama:endpoint (thing-at-point 'line) ollama:model))))
|
||||
|
||||
;;;###autoload
|
||||
(defun ollama-define-word ()
|
||||
"Find definition of current word."
|
||||
(interactive)
|
||||
(with-output-to-temp-buffer "*ollama*"
|
||||
(princ
|
||||
(ollama-prompt ollama:endpoint (format "define %s" (thing-at-point 'word)) ollama:model))))
|
||||
|
||||
;;;###autoload
|
||||
(defun ollama-translate-word ()
|
||||
"Translate current word."
|
||||
(interactive)
|
||||
(with-output-to-temp-buffer "*ollama*"
|
||||
(princ
|
||||
(ollama-prompt ollama:endpoint (format "translate \"%s\" to %s" (thing-at-point 'word) ollama:language) ollama:model))))
|
||||
|
||||
;;;###autoload
|
||||
(defun ollama-summarize-region ()
|
||||
"Summarize marked text."
|
||||
(interactive)
|
||||
(with-output-to-temp-buffer "*ollama*"
|
||||
(princ
|
||||
(ollama-prompt ollama:endpoint (format "summarize \"\"\"%s\"\"\"" (buffer-substring (region-beginning) (region-end))) ollama:model))))
|
||||
|
||||
(provide 'ollama)
|
||||
;;; ollama.el ends here
|
||||
111
dots/doom/lisp/oxycarbon.el
Executable file
111
dots/doom/lisp/oxycarbon.el
Executable file
@@ -0,0 +1,111 @@
|
||||
|
||||
(autothemer-deftheme oxocarbon "A port of oxocarbon"
|
||||
|
||||
;; Specify the color classes used by the theme
|
||||
((((class color) (min-colors #xFFFFFF))
|
||||
((class color) (min-colors #xFF)))
|
||||
|
||||
;; Specify the color palette, color columns correspond to each of the classes above.
|
||||
(oxocarbon-bg "#161616")
|
||||
(oxocarbon-fg "#f2f4f8")
|
||||
|
||||
(oxocarbon-base00 "#161616")
|
||||
(oxocarbon-base01 "#262626")
|
||||
(oxocarbon-base02 "#393939")
|
||||
(oxocarbon-base03 "#525252")
|
||||
|
||||
(oxocarbon-base04 "#dde1e6")
|
||||
(oxocarbon-base05 "#f2f4f8")
|
||||
(oxocarbon-base06 "#ffffff")
|
||||
(oxocarbon-base07 "#08bdba")
|
||||
(oxocarbon-base08 "#3ddbd9")
|
||||
(oxocarbon-base09 "#78a9ff")
|
||||
(oxocarbon-base10 "#ee5396")
|
||||
(oxocarbon-base11 "#33b1ff")
|
||||
(oxocarbon-base12 "#ff7eb6")
|
||||
(oxocarbon-base13 "#42be65")
|
||||
(oxocarbon-base14 "#be95ff")
|
||||
(oxocarbon-base15 "#82cfff"))
|
||||
|
||||
;; Specifications for Emacs faces.
|
||||
;; Simpler than deftheme, just specify a face name and
|
||||
;; a plist of face definitions (nested for :underline, :box etc.)
|
||||
(
|
||||
(default (:foreground oxocarbon-fg :background oxocarbon-bg)) ;; background and foreground
|
||||
(button (:foreground oxocarbon-fg :background oxocarbon-base01))
|
||||
;; (counsel--mark-ring-highlight)
|
||||
|
||||
;; Programming ;;
|
||||
(font-lock-string-face (:foreground oxocarbon-base14)) ;; strings
|
||||
(font-lock-keyword-face (:foreground oxocarbon-base09)) ;; keywords
|
||||
(font-lock-type-face (:foreground oxocarbon-base09)) ;; variable types
|
||||
(font-lock-variable-name-face (:foreground oxocarbon-base04)) ;; variable names
|
||||
(font-lock-comment-face (:foreground oxocarbon-base03)) ;; comments
|
||||
(font-lock-builtin-face (:foreground oxocarbon-base12)) ;; builtin functions
|
||||
(font-lock-constant-face (:foreground oxocarbon-base14)) ;; constants
|
||||
(font-lock-function-name-face (:foreground oxocarbon-base08)) ;; function names
|
||||
(font-lock-preprocessor-face (:foreground oxocarbon-base09))
|
||||
(font-lock-doc-face (:foreground oxocarbon-base14))
|
||||
|
||||
(corfu-current (:background oxocarbon-base02 :foreground oxocarbon-base08))
|
||||
|
||||
;; END ;;
|
||||
|
||||
;; General ;;
|
||||
(error (:foreground oxocarbon-base10))
|
||||
(warning (:foreground oxocarbon-base13))
|
||||
;; END ;;
|
||||
|
||||
;; UI ;;
|
||||
(region (:background oxocarbon-base02)) ;; selction background
|
||||
(highlight (:background oxocarbon-base02)) ;; highlight when hovering over a link etc.
|
||||
|
||||
(mode-line (:foreground oxocarbon-fg :background oxocarbon-bg)) ;; modeline
|
||||
(mode-line-inactive (:foreground oxocarbon-fg :background oxocarbon-bg))
|
||||
|
||||
(line-number-current-line (:foreground oxocarbon-base04 :background oxocarbon-base00)) ;; the current line num
|
||||
(line-number (:foreground oxocarbon-base02)) ;; line numbers
|
||||
|
||||
;; parens
|
||||
(show-paren-match (:background oxocarbon-base02)) ;; matching parens
|
||||
(show-paren-mismatch (:background oxocarbon-base11)) ;; mismatching parens
|
||||
|
||||
;; isearch
|
||||
(isearch-fail (:background oxocarbon-base10))
|
||||
|
||||
;; ivy
|
||||
(ivy-current-match (:background oxocarbon-base02 :foreground oxocarbon-base08))
|
||||
(ivy-minibuffer-match-face-1 (:foreground oxocarbon-base08))
|
||||
(ivy-minibuffer-match-face-2 (:foreground oxocarbon-base08))
|
||||
(ivy-minibuffer-match-face-3 (:foreground oxocarbon-base08))
|
||||
(ivy-minibuffer-match-face-4 (:foreground oxocarbon-base08))
|
||||
;; END ;;
|
||||
|
||||
|
||||
)
|
||||
|
||||
|
||||
;; (custom-theme-set-variables 'oxocarbon
|
||||
;; `(ansi-color-names-vector [
|
||||
;; ,oxocarbon-base00
|
||||
;; ,oxocarbon-base01
|
||||
;; ,oxocarbon-base02
|
||||
;; ,oxocarbon-base03
|
||||
;; ,oxocarbon-base04
|
||||
;; ,oxocarbon-base05
|
||||
;; ,oxocarbon-base06
|
||||
;; ,oxocarbon-base07
|
||||
;; ,oxocarbon-base08
|
||||
;; ,oxocarbon-base09
|
||||
;; ,oxocarbon-base10
|
||||
;; ,oxocarbon-base11
|
||||
;; ,oxocarbon-base12
|
||||
;; ,oxocarbon-base13
|
||||
;; ,oxocarbon-base14
|
||||
;; ,oxocarbon-base15
|
||||
;; ]))
|
||||
|
||||
|
||||
)
|
||||
|
||||
(provide-theme 'oxocarbon) ;; theme ends here
|
||||
9
dots/doom/lisp/programs.el
Executable file
9
dots/doom/lisp/programs.el
Executable file
@@ -0,0 +1,9 @@
|
||||
;;; ../../dotfiles/doom/.config/doom/lisp/programs.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; make a function to run a program with a given name and arguments
|
||||
(defun run-program (name &rest args)
|
||||
(interactive)
|
||||
(let ((program (executable-find name)))
|
||||
(if program
|
||||
(apply #'start-process name nil program args)
|
||||
(error "Could not find program %s" name))))
|
||||
0
dots/doom/lisp/test.el
Executable file
0
dots/doom/lisp/test.el
Executable file
129
dots/doom/my_stuff.el
Executable file
129
dots/doom/my_stuff.el
Executable file
@@ -0,0 +1,129 @@
|
||||
;;; ../../dotfiles/doom/.config/doom/my_stuff.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defun emenu ()
|
||||
"List all executable programs in the PATH environment variable and open the selected one.
|
||||
Any text entered after the program name (separated by a space) is taken as arguments to the program."
|
||||
(interactive)
|
||||
(let* ((path-dirs (delete-dups (split-string (getenv "PATH") path-separator)))
|
||||
(executables (apply #'append
|
||||
(mapcar #'(lambda (dir)
|
||||
(when (file-directory-p dir)
|
||||
(mapcar #'file-name-nondirectory
|
||||
(directory-files dir t ".+"
|
||||
'nosort))))
|
||||
path-dirs)))
|
||||
(buf (generate-new-buffer "Programs")))
|
||||
(with-current-buffer buf
|
||||
(insert (mapconcat 'identity executables "\n")))
|
||||
(let* ((program (completing-read "Program: " executables))
|
||||
(args (if (string-match (concat "^" program " ") (buffer-substring-no-properties
|
||||
(line-beginning-position)
|
||||
(line-end-position)))
|
||||
(substring-no-properties (buffer-substring-no-properties
|
||||
(line-beginning-position)
|
||||
(line-end-position)) (length program) nil)
|
||||
nil))
|
||||
(program-args (if args (concat program " " args) program)))
|
||||
(when program
|
||||
(start-process-shell-command program nil program-args)
|
||||
(kill-buffer buf)))))
|
||||
(map! :leader
|
||||
:desc "Emenu" "d e" #'emenu)
|
||||
|
||||
|
||||
;; open pdfs scaled in zathura
|
||||
(defun open-pdf-with-zathura ()
|
||||
(interactive)
|
||||
(start-process "zathura" nil "zathura" (buffer-file-name)))
|
||||
|
||||
(add-hook 'pdf-view-mode-hook
|
||||
(lambda ()
|
||||
(open-pdf-with-zathura)
|
||||
(kill-buffer)))
|
||||
|
||||
;; open images in imv
|
||||
(defun open-image-with-imv ()
|
||||
"Open the current image file with imv, then kill the current buffer and
|
||||
open a dired buffer in the directory of the image file."
|
||||
(interactive)
|
||||
(let* ((current-file (buffer-file-name))
|
||||
(directory (file-name-directory current-file))
|
||||
(all-files (directory-files directory nil "\\(png\\|jpg\\|jpeg\\|gif\\|bmp\\)$"))
|
||||
(selected-file (file-relative-name current-file directory))
|
||||
(selected-index (cl-position selected-file all-files :test #'equal))
|
||||
(sorted-files (append (nthcdr selected-index all-files)
|
||||
(butlast all-files (- (length all-files) selected-index)))))
|
||||
(apply 'start-process "imv" nil "imv" sorted-files))
|
||||
(let ((image-dir (when buffer-file-name (file-name-directory buffer-file-name))))
|
||||
(kill-buffer)
|
||||
(when image-dir
|
||||
(cd image-dir)
|
||||
(dired image-dir))))
|
||||
|
||||
(add-hook 'image-mode-hook
|
||||
(lambda ()
|
||||
(open-image-with-imv)))
|
||||
|
||||
|
||||
;;(add-hook 'doom-switch-buffer-hook
|
||||
;; (lambda ()
|
||||
;; (if (string= (buffer-name) "*doom*")
|
||||
;; (elcord-mode -1)
|
||||
;; (elcord-mode 1))))
|
||||
|
||||
;; search forwards for link and copy the link under point to the clipboard withouth external dependencies
|
||||
(defun elfeed-copy-image ()
|
||||
"Copy the URL of the image under point to the clipboard."
|
||||
(interactive)
|
||||
(or (search-forward "link" nil t)
|
||||
(search-backward "link" nil t))
|
||||
(let ((url (get-text-property (point) 'shr-url)))
|
||||
(if url
|
||||
(progn
|
||||
(message (concat "Copying image URL to clipboard: " url))
|
||||
(kill-new url)
|
||||
(message "Copied image URL to clipboard."))
|
||||
(message "No image under point."))))
|
||||
;;bind the function to a key spc i c
|
||||
(map! :leader
|
||||
:desc "Copy image URL to clipboard" "i c" #'elfeed-copy-image)
|
||||
|
||||
|
||||
(defun open-video-with-mpv ()
|
||||
"Open the current video file with mpv, then kill the current buffer and
|
||||
open a dired buffer in the directory of the video file."
|
||||
(interactive)
|
||||
(setq large-file-warning-threshold nil) ; disable threshold
|
||||
(let ((current-file (buffer-file-name)))
|
||||
(start-process "mpv" nil "mpv" current-file))
|
||||
(let ((video-dir (when buffer-file-name (file-name-directory buffer-file-name))))
|
||||
(kill-buffer)
|
||||
(when video-dir
|
||||
(cd video-dir)
|
||||
(dired video-dir))))
|
||||
|
||||
(add-hook 'find-file-hook
|
||||
(lambda ()
|
||||
(when (and buffer-file-name
|
||||
(string-match-p "\\(mp4\\|avi\\|mkv\\|webm\\|flv\\|mov\\|wmv\\)$" buffer-file-name))
|
||||
(open-video-with-mpv))))
|
||||
|
||||
|
||||
(defun open-audio-with-mpv ()
|
||||
"Open the current audio file with mpv, then kill the current buffer and
|
||||
open a dired buffer in the directory of the audio file."
|
||||
(interactive)
|
||||
(setq large-file-warning-threshold nil) ; disable threshold
|
||||
(let ((current-file (buffer-file-name)))
|
||||
(start-process "mpv" nil "mpv" "--no-video" current-file))
|
||||
(let ((audio-dir (when buffer-file-name (file-name-directory buffer-file-name))))
|
||||
(kill-buffer)
|
||||
(when audio-dir
|
||||
(cd audio-dir)
|
||||
(dired audio-dir))))
|
||||
|
||||
(add-hook 'find-file-hook
|
||||
(lambda ()
|
||||
(when (and buffer-file-name
|
||||
(string-match-p "\\(mp3\\|flac\\|wav\\|aac\\|ogg\\|m4b\\)$" buffer-file-name))
|
||||
(open-audio-with-mpv))))
|
||||
78
dots/doom/packages.el
Executable file
78
dots/doom/packages.el
Executable file
@@ -0,0 +1,78 @@
|
||||
;; -*- 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)
|
||||
|
||||
;; 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/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, 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 raxod502/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)
|
||||
(package! catppuccin-theme)
|
||||
;;(package! elcord)
|
||||
(package! fill-column-indicator)
|
||||
(package! rainbow-mode)
|
||||
(package! poly-org)
|
||||
(package! ein)
|
||||
(package! copilot
|
||||
:recipe (:host github :repo "zerolfx/copilot.el" :files ("*.el" "dist")))
|
||||
;;(package! codeium
|
||||
;; :recipe (:host github :repo "Exafunction/codeium.el" :files ("*.el")))
|
||||
|
||||
(package! ellama)
|
||||
(package! highlight-indent-guides)
|
||||
(package! yuck-mode)
|
||||
(package! openai
|
||||
:recipe (:host github :repo "emacs-openai/openai" :files ("*.el")))
|
||||
(package! chatgpt
|
||||
:recipe (:host github :repo "mrfluffy-dev/chatgpt" :files ("*.el")))
|
||||
|
||||
(package! nasm-mode :pin "65ca6546fc395711fac5b3b4299e76c2303d43a8")
|
||||
(package! haxor-mode :pin "6fa25a8e6b6a59481bc0354c2fe1e0ed53cbdc91")
|
||||
(package! mips-mode :pin "98795cdc81979821ac35d9f94ce354cd99780c67")
|
||||
(package! riscv-mode :pin "8e335b9c93de93ed8dd063d702b0f5ad48eef6d7")
|
||||
(package! x86-lookup :pin "1573d61cc4457737b94624598a891c837fb52c16")
|
||||
(package! package-lint :pin "21edc6d0d0eadd2d0a537f422fb9b7b8a3ae6991")
|
||||
|
||||
|
||||
;;(package! jupyter)
|
||||
120
dots/doom/themes/doom-hardcore-theme.el
Executable file
120
dots/doom/themes/doom-hardcore-theme.el
Executable file
@@ -0,0 +1,120 @@
|
||||
;;; doom-hardcore-theme.el --- inspired by the Hardcore theme -*- lexical-binding: t; no-byte-compile: t; -*-
|
||||
;;
|
||||
;; Added: February 23, 2025
|
||||
;; Author: Your Name <https://github.com/yourusername>
|
||||
;; Maintainer: Your Name <https://github.com/yourusername>
|
||||
;; Source: Hardcore Theme
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(require 'doom-themes)
|
||||
|
||||
;;
|
||||
;;; Variables
|
||||
|
||||
(defgroup doom-hardcore-theme nil
|
||||
"Options for the `doom-hardcore' theme."
|
||||
:group 'doom-themes)
|
||||
|
||||
(defcustom doom-hardcore-brighter-modeline nil
|
||||
"If non-nil, more vivid colors will be used to style the mode-line."
|
||||
:group 'doom-hardcore-theme
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom doom-hardcore-brighter-comments nil
|
||||
"If non-nil, comments will be highlighted in more vivid colors."
|
||||
:group 'doom-hardcore-theme
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom doom-hardcore-colorful-headers nil
|
||||
"If non-nil, headers in org-mode will be more colorful."
|
||||
:group 'doom-hardcore-theme
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom doom-hardcore-comment-bg doom-hardcore-brighter-comments
|
||||
"If non-nil, comments will have a subtle, darker background."
|
||||
:group 'doom-hardcore-theme
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom doom-hardcore-padded-modeline doom-themes-padded-modeline
|
||||
"If non-nil, adds a 4px padding to the mode-line. Can be an integer."
|
||||
:group 'doom-hardcore-theme
|
||||
:type '(choice integer boolean))
|
||||
|
||||
;;
|
||||
;;; Theme definition
|
||||
|
||||
(def-doom-theme doom-hardcore
|
||||
"A dark theme based on the Hardcore theme."
|
||||
|
||||
;; name default 256 16
|
||||
((bg '("#141414" "#121212" "black" ))
|
||||
(bg-alt '("#141414" "#0d0d0d" "black" ))
|
||||
(base0 '("#0f0f0f" "#0a0a0a" "black" ))
|
||||
(base1 '("#191919" "#161616" "brightblack" ))
|
||||
(base2 '("#242424" "#202020" "brightblack" ))
|
||||
(base3 '("#303030" "#282828" "brightblack" ))
|
||||
(base4 '("#3c3c3c" "#363636" "brightblack" ))
|
||||
(base5 '("#4e4e4e" "#484848" "brightblack" ))
|
||||
(base6 '("#8c8c8c" "#888888" "brightblack" ))
|
||||
(base7 '("#b2b2b2" "#b0b0b0" "brightblack" ))
|
||||
(base8 '("#ffffff" "#eeeeee" "white" ))
|
||||
(fg '("#e0e0e0" "#ffffff" "white" ))
|
||||
(fg-alt '("#c6c6c6" "#b0b0b0" "brightwhite" ))
|
||||
|
||||
(grey base4)
|
||||
(red '("#ff5f5f" "#ff6b6b" "red" ))
|
||||
(orange '("#ffaf5f" "#ffae5f" "brightred" ))
|
||||
(green '("#5fff5f" "#6bff6b" "green" ))
|
||||
(teal '("#5fafd7" "#5faed7" "brightgreen" ))
|
||||
(yellow '("#ffff5f" "#ffff6b" "yellow" ))
|
||||
(blue '("#5fafff" "#5faeff" "brightblue" ))
|
||||
(dark-blue '("#005f87" "#004f77" "blue" ))
|
||||
(magenta '("#af5fff" "#ae5fff" "magenta" ))
|
||||
(violet '("#875fff" "#865fff" "brightmagenta"))
|
||||
(cyan '("#5fdfff" "#5fceff" "brightcyan" ))
|
||||
(dark-cyan '("#0087af" "#00779f" "cyan" ))
|
||||
|
||||
;; face categories -- required for all themes
|
||||
(highlight magenta)
|
||||
(vertical-bar (doom-darken base1 0.1))
|
||||
(selection dark-blue)
|
||||
(builtin orange)
|
||||
(comments (if doom-hardcore-brighter-comments dark-cyan base5))
|
||||
(doc-comments (doom-lighten (if doom-hardcore-brighter-comments dark-cyan base5) 0.25))
|
||||
(constants cyan)
|
||||
(functions green)
|
||||
(keywords magenta)
|
||||
(methods teal)
|
||||
(operators violet)
|
||||
(type violet)
|
||||
(strings yellow)
|
||||
(variables (doom-lighten magenta 0.6))
|
||||
(numbers violet)
|
||||
(region `(,(car base3) ,@(cdr base1)))
|
||||
(error red)
|
||||
(warning yellow)
|
||||
(success green)
|
||||
(vc-modified orange)
|
||||
(vc-added green)
|
||||
(vc-deleted red)
|
||||
|
||||
;; modeline
|
||||
(-modeline-bright doom-hardcore-brighter-modeline)
|
||||
(-modeline-pad (when doom-hardcore-padded-modeline (if (integerp doom-hardcore-padded-modeline) doom-hardcore-padded-modeline 4)))
|
||||
(modeline-bg `(,(doom-darken (car bg) 0.15) ,@(cdr base0)))
|
||||
(modeline-bg-l `(,(car bg) ,@(cdr base0)))
|
||||
(modeline-bg-inactive `(,(doom-darken (car bg) 0.075) ,@(cdr base1)))
|
||||
(modeline-bg-inactive-l (doom-darken bg 0.1)))
|
||||
|
||||
;; Base theme face overrides
|
||||
(((line-number &override) :foreground base5)
|
||||
((line-number-current-line &override) :foreground fg)
|
||||
(mode-line :background modeline-bg :foreground base8
|
||||
:box (if -modeline-pad `(:line-width ,-modeline-pad :color ,modeline-bg)))
|
||||
(mode-line-inactive :background modeline-bg-inactive :foreground base5
|
||||
:box (if -modeline-pad `(:line-width ,-modeline-pad :color ,modeline-bg-inactive))))
|
||||
)
|
||||
|
||||
;;; doom-hardcore-theme.el ends here
|
||||
107
dots/doom/themes/doom-pandora-theme.el
Executable file
107
dots/doom/themes/doom-pandora-theme.el
Executable file
@@ -0,0 +1,107 @@
|
||||
;;; doom-pandora-theme.el --- Pandora Base16 theme for Doom Emacs -*- lexical-binding: t; no-byte-compile: t; -*-
|
||||
;;
|
||||
;; Based on Base16 Pandora scheme by Cassandra Fox.
|
||||
;; Adapted from doom-dracula-theme.el
|
||||
;;
|
||||
;;; Commentary:
|
||||
;; This theme is a modification of the Doom Dracula theme,
|
||||
;; replacing the Dracula palette with the Base16 Pandora colors.
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(require 'doom-themes)
|
||||
|
||||
(defgroup doom-pandora-theme nil
|
||||
"Options for the `doom-pandora' theme."
|
||||
:group 'doom-themes)
|
||||
|
||||
(defcustom doom-pandora-brighter-modeline nil
|
||||
"If non-nil, more vivid colors will be used to style the mode-line."
|
||||
:group 'doom-pandora-theme
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom doom-pandora-brighter-comments nil
|
||||
"If non-nil, comments will be highlighted in more vivid colors."
|
||||
:group 'doom-pandora-theme
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom doom-pandora-colorful-headers nil
|
||||
"If non-nil, headers in org-mode will be more colorful."
|
||||
:group 'doom-pandora-theme
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom doom-pandora-comment-bg doom-pandora-brighter-comments
|
||||
"If non-nil, comments will have a subtle, darker background to enhance legibility."
|
||||
:group 'doom-pandora-theme
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom doom-pandora-padded-modeline doom-themes-padded-modeline
|
||||
"If non-nil, adds a padding to the mode-line. It can be an integer to specify exact padding."
|
||||
:group 'doom-pandora-theme
|
||||
:type '(choice integer boolean))
|
||||
|
||||
|
||||
(def-doom-theme doom-pandora
|
||||
"A dark theme based on the Base16 Pandora color scheme by Cassandra Fox."
|
||||
|
||||
;; Palette:
|
||||
;; Base16 Pandora (keys from base00 to base0F)
|
||||
((bg '("#131213" nil nil)) ; base00
|
||||
(bg-alt '("#2f1823" nil nil)) ; base01
|
||||
(base02 '("#472234" nil nil)) ; base02
|
||||
(base03 '("#ffbee3" nil nil)) ; base03
|
||||
(base04 '("#9b2a46" nil nil)) ; base04
|
||||
(fg '("#f15c99" "#f15c99" "brightwhite")) ; base05
|
||||
(fg-alt '("#9ddf69" "#9ddf69" "white")) ; base0B
|
||||
(accent '("#008080" nil nil)) ; base0D
|
||||
|
||||
(base06 '("#81506a" nil nil)) ; base06
|
||||
(base07 '("#632227" nil nil)) ; base07
|
||||
(base08 '("#b00b69" nil nil)) ; base08 (red)
|
||||
(base09 '("#ff9153" nil nil)) ; base09 (orange)
|
||||
(base0A '("#ffcc00" nil nil)) ; base0A (yellow)
|
||||
(base0C '("#714ca6" nil nil)) ; base0C (blue)
|
||||
(base0D '("#008080" nil nil)) ; base0D (teal; reused as accent)
|
||||
(base0E '("#a24030" nil nil)) ; base0E (magenta)
|
||||
(base0F '("#a24030" nil nil)) ; base0F (duplicate of base0E)
|
||||
|
||||
;; You may optionally define a "grey" for extra use:
|
||||
(grey base04))
|
||||
|
||||
;; Face categories:
|
||||
;; Here we map our palette to Doom's standard face categories.
|
||||
((red base08)
|
||||
(orange base09)
|
||||
(green base0B)
|
||||
(teal base0D)
|
||||
(yellow base0A)
|
||||
(blue base0C)
|
||||
(dark-blue (doom-darken base0C 0.2))
|
||||
(magenta base0E)
|
||||
(violet (doom-blend base0E base0C 0.5))
|
||||
(cyan base0D)) ; Using base0D for cyan (teal)
|
||||
|
||||
;; Base theme face overrides
|
||||
(((line-number &override) :foreground base04)
|
||||
((line-number-current-line &override) :foreground fg)
|
||||
((font-lock-comment-face &override)
|
||||
:background (if doom-pandora-comment-bg (doom-lighten bg 0.05) 'unspecified))
|
||||
(mode-line
|
||||
:background accent :foreground fg
|
||||
:box (when doom-pandora-padded-modeline
|
||||
`(:line-width ,(if (integerp doom-pandora-padded-modeline)
|
||||
doom-pandora-padded-modeline 4)
|
||||
:color ,accent)))
|
||||
(mode-line-inactive
|
||||
:background (doom-darken bg 0.075) :foreground base04
|
||||
:box (when doom-pandora-padded-modeline
|
||||
`(:line-width ,(if (integerp doom-pandora-padded-modeline)
|
||||
doom-pandora-padded-modeline 4)
|
||||
:color ,(doom-darken bg 0.075))))
|
||||
(mode-line-emphasis :foreground (if doom-pandora-brighter-modeline fg accent))
|
||||
;; Example for org-mode customizations:
|
||||
((org-tag &override) :foreground (doom-lighten orange 0.3)))
|
||||
;; No additional variable overrides
|
||||
())
|
||||
|
||||
;;; doom-pandora-theme.el ends here
|
||||
BIN
dots/doom/xenia.png
Executable file
BIN
dots/doom/xenia.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 203 KiB |
20
dots/foot.nix
Executable file
20
dots/foot.nix
Executable file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
programs.foot = {
|
||||
enable = true;
|
||||
settings = {
|
||||
main = {
|
||||
pad = "5x5";
|
||||
};
|
||||
colors = {
|
||||
alpha = lib.mkForce (0.9);
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
273
dots/hyprland.nix
Executable file
273
dots/hyprland.nix
Executable file
@@ -0,0 +1,273 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
window_manager,
|
||||
systemName,
|
||||
...
|
||||
}:
|
||||
let
|
||||
mod = "Alt";
|
||||
terminal = "footclient";
|
||||
fileManager = "pcmanfm";
|
||||
runner = "anyrun";
|
||||
browser = "zen-twilight";
|
||||
editor = "emacsclient -c";
|
||||
in
|
||||
{
|
||||
wayland = {
|
||||
windowManager = {
|
||||
hyprland = {
|
||||
enable = window_manager == "hyprland" || window_manager == "all";
|
||||
plugins = [
|
||||
pkgs.hyprlandPlugins.hyprsplit
|
||||
];
|
||||
settings = {
|
||||
# Autostart necessary processes (like notifications daemons, status bars, etc.)
|
||||
# Or execute your favorite apps at launch like this:
|
||||
exec-once =
|
||||
[
|
||||
"waybar"
|
||||
"${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
|
||||
"fcitx5 -d"
|
||||
"foot -s"
|
||||
]
|
||||
++ lib.optional (systemName == "laptop") "swaybg -o eDP-1 -i ${../assets/Wallpapers/138.png}"
|
||||
++
|
||||
lib.optional (systemName == "pc")
|
||||
"swaybg -o HDMI-A-1 -i ${../assets/Wallpapers/138.png} -o DP-1 -i ${../assets/Wallpapers/138.png}";
|
||||
|
||||
#plugins
|
||||
plugin = {
|
||||
hyprsplit = {
|
||||
num_workspaces = 9;
|
||||
persistent_workspaces = true;
|
||||
};
|
||||
};
|
||||
|
||||
# See https://wiki.hyprland.org/Configuring/Monitors/
|
||||
monitor = lib.mkMerge [
|
||||
(lib.mkIf (systemName == "laptop") [ "eDP-1,1920x1080@59.99700,0x0,1" ])
|
||||
(lib.mkIf (systemName == "pc") [
|
||||
"HDMI-A-1,1920x1080@60,0x0,1"
|
||||
"DP-1,2560x1440@144,1920x0,1"
|
||||
])
|
||||
];
|
||||
|
||||
env = [
|
||||
"XCURSOR_SIZE, 24"
|
||||
"HYPRCURSOR_SIZE, 24"
|
||||
];
|
||||
# Refer to https://wiki.hyprland.org/Configuring/Variables/
|
||||
# https://wiki.hyprland.org/Configuring/Variables/#general
|
||||
general = {
|
||||
gaps_in = 5;
|
||||
gaps_out = 20;
|
||||
border_size = 2;
|
||||
# https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors
|
||||
#"col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
|
||||
#"col.inactive_border" = "rgba(595959aa)";
|
||||
# Set to true enable resizing windows by clicking and dragging on borders and gaps
|
||||
resize_on_border = false;
|
||||
# Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
|
||||
allow_tearing = false;
|
||||
layout = "dwindle";
|
||||
};
|
||||
|
||||
# https://wiki.hyprland.org/Configuring/Variables/#decoration
|
||||
decoration = {
|
||||
rounding = 10;
|
||||
rounding_power = 2;
|
||||
# Change transparency of focused and unfocused windows
|
||||
active_opacity = 1.0;
|
||||
inactive_opacity = 1.0;
|
||||
shadow = {
|
||||
enabled = true;
|
||||
range = 4;
|
||||
render_power = 3;
|
||||
#color = "rgba(1a1a1aee)";
|
||||
};
|
||||
# https://wiki.hyprland.org/Configuring/Variables/#blur
|
||||
blur = {
|
||||
enabled = true;
|
||||
size = 3;
|
||||
passes = 1;
|
||||
vibrancy = 0.1696;
|
||||
};
|
||||
};
|
||||
animations = {
|
||||
enabled = "yes, please :)";
|
||||
# Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
|
||||
bezier = [
|
||||
"easeOutQuint,0.23,1,0.32,1"
|
||||
"easeInOutCubic,0.65,0.05,0.36,1"
|
||||
"linear,0,0,1,1"
|
||||
"almostLinear,0.5,0.5,0.75,1.0"
|
||||
"quick,0.15,0,0.1,1"
|
||||
];
|
||||
animation = [
|
||||
"global, 1, 10, default"
|
||||
"border, 1, 5.39, easeOutQuint"
|
||||
"windows, 1, 4.79, easeOutQuint"
|
||||
"windowsIn, 1, 4.1, easeOutQuint, popin 87%"
|
||||
"windowsOut, 1, 1.49, linear, popin 87%"
|
||||
"fadeIn, 1, 1.73, almostLinear"
|
||||
"fadeOut, 1, 1.46, almostLinear"
|
||||
"fade, 1, 3.03, quick"
|
||||
"layers, 1, 3.81, easeOutQuint"
|
||||
"layersIn, 1, 4, easeOutQuint, fade"
|
||||
"layersOut, 1, 1.5, linear, fade"
|
||||
"fadeLayersIn, 1, 1.79, almostLinear"
|
||||
"fadeLayersOut, 1, 1.39, almostLinear"
|
||||
"workspaces, 1, 1.94, almostLinear, fade"
|
||||
"workspacesIn, 1, 1.21, almostLinear, fade"
|
||||
"workspacesOut, 1, 1.94, almostLinear, fade"
|
||||
];
|
||||
};
|
||||
# Ref https://wiki.hyprland.org/Configuring/Workspace-Rules/
|
||||
# "Smart gaps" / "No gaps when only"
|
||||
# uncomment all if you wish to use that.
|
||||
# workspace = w[tv1], gapsout:0, gapsin:0
|
||||
# workspace = f[1], gapsout:0, gapsin:0
|
||||
# windowrule = bordersize 0, floating:0, onworkspace:w[tv1]
|
||||
# windowrule = rounding 0, floating:0, onworkspace:w[tv1]
|
||||
# windowrule = bordersize 0, floating:0, onworkspace:f[1]
|
||||
# windowrule = rounding 0, floating:0, onworkspace:f[1]
|
||||
|
||||
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
|
||||
dwindle = {
|
||||
pseudotile = true; # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
|
||||
preserve_split = true; # You probably want this
|
||||
force_split = 2;
|
||||
};
|
||||
|
||||
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
|
||||
master = {
|
||||
new_status = "master";
|
||||
};
|
||||
|
||||
# https://wiki.hyprland.org/Configuring/Variables/#misc
|
||||
misc = {
|
||||
force_default_wallpaper = -1; # Set to 0 or 1 to disable the anime mascot wallpapers
|
||||
disable_hyprland_logo = false; # If true disables the random hyprland logo / anime girl background. :(
|
||||
enable_swallow = true;
|
||||
swallow_regex = "foot";
|
||||
};
|
||||
|
||||
# https://wiki.hyprland.org/Configuring/Variables/#input
|
||||
input = {
|
||||
kb_layout = lib.mkMerge [
|
||||
(lib.mkIf (systemName == "laptop") "ie")
|
||||
(lib.mkIf (systemName == "pc") "us")
|
||||
];
|
||||
#kb_variant =
|
||||
#kb_model =
|
||||
#kb_options =
|
||||
#kb_rules =
|
||||
follow_mouse = 1;
|
||||
sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
|
||||
touchpad = {
|
||||
natural_scroll = false;
|
||||
};
|
||||
};
|
||||
# https://wiki.hyprland.org/Configuring/Variables/#gestures
|
||||
gestures = {
|
||||
workspace_swipe = true;
|
||||
};
|
||||
|
||||
# Example per-device config
|
||||
# See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more
|
||||
device = {
|
||||
name = "epic-mouse-v1";
|
||||
sensitivity = -0.5;
|
||||
};
|
||||
|
||||
bind = [
|
||||
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
|
||||
"${mod}, Return, exec, ${terminal}"
|
||||
"${mod}, B, exec, ${browser}"
|
||||
"${mod}, Q, killactive,"
|
||||
"${mod}, M, exit,"
|
||||
"${mod}, F, exec, ${fileManager}"
|
||||
"${mod}, V, togglefloating,"
|
||||
"${mod}, D, exec, ${runner}"
|
||||
"${mod}, E, exec, ${editor}"
|
||||
"SUPER_SHIFT, S, exec, grim -g \"$(slurp)\" - | swappy -f -"
|
||||
"${mod}, P, pseudo, " # dwindle
|
||||
"${mod}, J, togglesplit," # dwindle
|
||||
#focus with mainMod + arrow keys
|
||||
"${mod}, left, movefocus, l"
|
||||
"${mod}, right, movefocus, r"
|
||||
"${mod}, up, movefocus, u"
|
||||
"${mod}, down, movefocus, d"
|
||||
|
||||
# Switch workspaces with Mod + [0-9]
|
||||
"${mod}, 1, split:workspace, 1 "
|
||||
"${mod}, 2, split:workspace, 2 "
|
||||
"${mod}, 3, split:workspace, 3 "
|
||||
"${mod}, 4, split:workspace, 4 "
|
||||
"${mod}, 5, split:workspace, 5 "
|
||||
"${mod}, 6, split:workspace, 6 "
|
||||
"${mod}, 7, split:workspace, 7 "
|
||||
"${mod}, 8, split:workspace, 8 "
|
||||
"${mod}, 9, split:workspace, 9 "
|
||||
"${mod}, 0, split:workspace, 10"
|
||||
# Move active window to a workspace with mainMod + SHIFT + [0-9]
|
||||
"${mod} SHIFT, 1, split:movetoworkspacesilent, 1 "
|
||||
"${mod} SHIFT, 2, split:movetoworkspacesilent, 2 "
|
||||
"${mod} SHIFT, 3, split:movetoworkspacesilent, 3 "
|
||||
"${mod} SHIFT, 4, split:movetoworkspacesilent, 4 "
|
||||
"${mod} SHIFT, 5, split:movetoworkspacesilent, 5 "
|
||||
"${mod} SHIFT, 6, split:movetoworkspacesilent, 6 "
|
||||
"${mod} SHIFT, 7, split:movetoworkspacesilent, 7 "
|
||||
"${mod} SHIFT, 8, split:movetoworkspacesilent, 8 "
|
||||
"${mod} SHIFT, 9, split:movetoworkspacesilent, 9 "
|
||||
"${mod} SHIFT, 0, split:movetoworkspacesilent, 10"
|
||||
# Example special workspace (scratchpad)
|
||||
"${mod}, S, togglespecialworkspace, magic"
|
||||
"${mod} SHIFT, S, movetoworkspace, special:magic"
|
||||
# Scroll through existing workspaces with mainMod + scroll
|
||||
"${mod}, mouse_down, workspace, e+1"
|
||||
"${mod}, mouse_up, workspace, e-1"
|
||||
];
|
||||
|
||||
bindm = [
|
||||
# Move/resize windows with mainMod + LMB/RMB and dragging
|
||||
"${mod}, mouse:272, movewindow"
|
||||
"${mod}, mouse:273, resizewindow"
|
||||
];
|
||||
|
||||
bindel = [
|
||||
",XF86AudioRaiseVolume, exec, pamixer -i 5"
|
||||
",XF86AudioLowerVolume, exec, pamixer -d 5"
|
||||
",XF86AudioMute, exec, pamixer --toggle-mute"
|
||||
",XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"
|
||||
",XF86MonBrightnessUp, exec, light -A 5"
|
||||
",XF86MonBrightnessDown, exec, light -U 5"
|
||||
];
|
||||
bindl = [
|
||||
", XF86AudioNext, exec, playerctl next"
|
||||
", XF86AudioPause, exec, playerctl play-pause"
|
||||
", XF86AudioPlay, exec, playerctl play-pause "
|
||||
", XF86AudioPrev, exec, playerctl previous "
|
||||
];
|
||||
|
||||
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
|
||||
# See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules
|
||||
|
||||
# Example windowrule
|
||||
# windowrule = float,class:^(kitty)$,title:^(kitty)$
|
||||
|
||||
# Ignore maximize requests from apps. You'll probably like this.
|
||||
windowrule = [
|
||||
# Ignore maximize requests from apps. You'll probably like this.
|
||||
"suppressevent maximize, class:.*"
|
||||
# Fix some dragging issues with XWayland
|
||||
"nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0"
|
||||
];
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
102
dots/hyprlock.nix
Executable file
102
dots/hyprlock.nix
Executable file
@@ -0,0 +1,102 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
systemName,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
services = {
|
||||
hypridle = {
|
||||
enable = true;
|
||||
settings = {
|
||||
general = {
|
||||
lock_cmd = "${lib.getExe pkgs.hyprlock}";
|
||||
unlock_cmd = "killall -s SIGUSR1 hyprlock";
|
||||
before_sleep_cmd = "loginctl lock-session && sleep 1.5";
|
||||
ignore_dbus_inhibit = false;
|
||||
};
|
||||
listener =
|
||||
[
|
||||
{
|
||||
timeout = 600;
|
||||
on-timeout = "loginctl lock-session";
|
||||
}
|
||||
|
||||
]
|
||||
++ lib.optional (systemName == "laptop") {
|
||||
timeout = 700;
|
||||
on-timeout = "light -S 0";
|
||||
on-resume = "light -I";
|
||||
}
|
||||
++ lib.optional (systemName == "laptop") {
|
||||
timeout = 800;
|
||||
on-timeout = "systemctl suspend-then-hibernate";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
systemd.user.services.hypridle = lib.mkForce {
|
||||
Unit = {
|
||||
Description = "hypridle";
|
||||
After = [ "graphical-session.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
# Remove ConditionEnvironment, handle in ExecStart or ensure variable is imported
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${lib.getExe pkgs.hypridle}";
|
||||
Restart = "always";
|
||||
RestartSec = "10s";
|
||||
# Check inside the service if needed
|
||||
ExecStartPre = "/bin/sh -c 'test -n \"$WAYLAND_DISPLAY\"'";
|
||||
};
|
||||
Install.WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
programs = {
|
||||
hyprlock = {
|
||||
enable = true;
|
||||
settings = {
|
||||
background = {
|
||||
path = "${../assets/Wallpapers/138.png}"; # only png supported for now
|
||||
color = "rgba(25, 20, 20, 1.0)";
|
||||
|
||||
# all these options are taken from hyprland, see https://wiki.hyprland.org/Configuring/Variables/#blur for explanations
|
||||
blur_passes = 0; # 0 disables blurring
|
||||
blur_size = 7;
|
||||
noise = 0.0117;
|
||||
contrast = 0.8916;
|
||||
brightness = 0.8172;
|
||||
vibrancy = 0.1696;
|
||||
vibrancy_darkness = 0.0;
|
||||
};
|
||||
input-field = {
|
||||
size = "200, 50";
|
||||
outline_thickness = 3;
|
||||
dots_size = 0.33; # Scale of input-field height, 0.2 - 0.8
|
||||
dots_spacing = 0.15; # Scale of dots' absolute size, 0.0 - 1.0
|
||||
dots_center = false;
|
||||
outer_color = "rgb(151515)";
|
||||
inner_color = "rgb(200, 200, 200)";
|
||||
font_color = "rgb(10, 10, 10)";
|
||||
fade_on_empty = true;
|
||||
placeholder_text = "<i>Input Password...</i>"; # Text rendered in the input box when it's empty.
|
||||
hide_input = false;
|
||||
position = "0, -20";
|
||||
halign = "center";
|
||||
valign = "center";
|
||||
};
|
||||
label = {
|
||||
text = "Hi there, $USER";
|
||||
color = "rgba(200, 200, 200, 1.0)";
|
||||
font_size = 25;
|
||||
font_family = "Noto Sans";
|
||||
position = "0, 80";
|
||||
halign = "center";
|
||||
valign = "center";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
19
dots/niri.nix
Executable file
19
dots/niri.nix
Executable file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
programs = {
|
||||
niri = {
|
||||
settings = {
|
||||
outputs."eDP-1".scale = 1.0;
|
||||
binds = {
|
||||
"Mod+T".action.spawn = "alacritty";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
111
dots/nixcord.nix
Executable file
111
dots/nixcord.nix
Executable file
@@ -0,0 +1,111 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
programs.nixcord = {
|
||||
enable = true;
|
||||
discord.enable = false;
|
||||
vesktop = {
|
||||
enable = true;
|
||||
};
|
||||
config = {
|
||||
plugins = {
|
||||
alwaysTrust = {
|
||||
enable = true;
|
||||
file = true;
|
||||
};
|
||||
translate = {
|
||||
enable = true;
|
||||
};
|
||||
anonymiseFileNames = {
|
||||
enable = true;
|
||||
anonymiseByDefault = true;
|
||||
};
|
||||
betterRoleContext = {
|
||||
enable = true;
|
||||
};
|
||||
betterRoleDot = {
|
||||
enable = true;
|
||||
};
|
||||
betterUploadButton = {
|
||||
enable = true;
|
||||
};
|
||||
biggerStreamPreview = {
|
||||
enable = true;
|
||||
};
|
||||
clearURLs = {
|
||||
enable = true;
|
||||
};
|
||||
copyFileContents = {
|
||||
enable = true;
|
||||
};
|
||||
emoteCloner = {
|
||||
enable = true;
|
||||
};
|
||||
fakeNitro = {
|
||||
enable = true;
|
||||
enableEmojiBypass = true;
|
||||
};
|
||||
fixImagesQuality = {
|
||||
enable = true;
|
||||
};
|
||||
fixYoutubeEmbeds = {
|
||||
enable = true;
|
||||
};
|
||||
forceOwnerCrown = {
|
||||
enable = true;
|
||||
};
|
||||
friendsSince = {
|
||||
enable = true;
|
||||
};
|
||||
gifPaste = {
|
||||
enable = true;
|
||||
};
|
||||
imageZoom = {
|
||||
enable = true;
|
||||
};
|
||||
memberCount = {
|
||||
enable = true;
|
||||
};
|
||||
messageLinkEmbeds = {
|
||||
enable = true;
|
||||
};
|
||||
messageLogger = {
|
||||
enable = true;
|
||||
};
|
||||
nsfwGateBypass = {
|
||||
enable = true;
|
||||
};
|
||||
petpet = {
|
||||
enable = true;
|
||||
};
|
||||
pictureInPicture = {
|
||||
enable = true;
|
||||
};
|
||||
reverseImageSearch = {
|
||||
enable = true;
|
||||
};
|
||||
showHiddenChannels = {
|
||||
enable = true;
|
||||
};
|
||||
showHiddenThings = {
|
||||
enable = true;
|
||||
};
|
||||
showTimeoutDuration = {
|
||||
enable = true;
|
||||
};
|
||||
whoReacted = {
|
||||
enable = true;
|
||||
};
|
||||
youtubeAdblock = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
249
dots/river.nix
Executable file
249
dots/river.nix
Executable file
@@ -0,0 +1,249 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
window_manager,
|
||||
systemName,
|
||||
...
|
||||
}:
|
||||
{
|
||||
wayland.windowManager.river = {
|
||||
enable = window_manager == "river" || window_manager == "all";
|
||||
xwayland.enable = true;
|
||||
extraConfig = ''
|
||||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
#systemctl --user import-environment
|
||||
#
|
||||
#
|
||||
#eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh)
|
||||
#export SSH_AUTH_SOCK
|
||||
browser="zen-twilight"
|
||||
file_manager="pcmanfm"
|
||||
terminal="footclient"
|
||||
drunner="anyrun"
|
||||
editor="emacs"
|
||||
|
||||
riverctl input "pointer-2362-8197-ASUP1204:00_093A:2005_Touchpad" tap enabled
|
||||
riverctl keyboard-layout -options "grp:ctrl_space_toggle" ${
|
||||
if systemName == "laptop" then "ie,us" else "us"
|
||||
}
|
||||
|
||||
#riverctl spawn 'export XDG_CURRENT_DESKTOP=river'
|
||||
#riverctl spawn 'systemctl --user restart xdg-desktop-portal'
|
||||
riverctl spawn 'dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP'
|
||||
riverctl spawn 'swaybg ${
|
||||
# Handle laptop case
|
||||
lib.optionalString (systemName == "laptop") "-o eDP-1 -i ${../assets/Wallpapers/138.png}"
|
||||
}${
|
||||
# Handle PC case (appends to laptop case if needed, but conditions should be mutually exclusive)
|
||||
lib.optionalString (
|
||||
systemName == "pc"
|
||||
) "-o HDMI-A-1 -i ${../assets/Wallpapers/138.png} -o DP-1 -i ${../assets/Wallpapers/138.png}"
|
||||
}'
|
||||
#riverctl spawn '/home/mrfluffy/.config/script/mic-gain-fix.sh'
|
||||
riverctl spawn 'waybar &'
|
||||
#riverctl spawn '(hypridle &) && loginctl unlock-session'
|
||||
#riverctl spawn '(sleep 10 && systemctl --user restart hypridle.service) &'
|
||||
#riverctl spawn '/nix/store/$(ls -la /nix/store | grep "polkit-gnome" | grep "^d" | awk ""$0=$NF" | head -n 1)/libexec/polkit-gnome-authentication-agent-1'
|
||||
riverctl spawn ' ${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1'
|
||||
riverctl spawn '/home/mrfluffy/.config/script/waylock.sh'
|
||||
riverctl spawn 'fcitx5 -d'
|
||||
riverctl spawn 'foot -s'
|
||||
riverctl spawn '[ -n "$(whereis swaync | awk '{print $2}')" ] && swaync'
|
||||
riverctl focus-follows-cursor normal
|
||||
riverctl set-cursor-warp on-focus-change
|
||||
#riverctl xcursor-theme oreo_spark_pink_cursors
|
||||
riverctl spawn '${
|
||||
# Handle laptop case
|
||||
lib.optionalString (systemName == "laptop") "wlr-randr --output eDP-1 --mode 1920x1080@60"
|
||||
}${
|
||||
# Handle PC case (appends to laptop case if needed, but conditions should be mutually exclusive)
|
||||
lib.optionalString (systemName == "pc")
|
||||
"wlr-randr --output DP-1 --mode 2560x1440@144 --pos 1920,0 --output HDMI-A-1 --mode 1920x1080@60 --pos 0,0"
|
||||
}'
|
||||
|
||||
# This is the example configuration file for river.
|
||||
#
|
||||
# If you wish to edit this, you will probably want to copy it to
|
||||
# $XDG_CONFIG_HOME/river/init or $HOME/.config/river/init first.
|
||||
#
|
||||
# See the river(1), riverctl(1), and rivertile(1) man pages for complete
|
||||
# documentation.
|
||||
|
||||
# Note: the "Mod4" modifier is also known as Logo, GUI, Windows, Mod4, etc.
|
||||
#
|
||||
riverctl map normal Mod1+Shift+Control L spawn way-inhibitor
|
||||
|
||||
# Mod4+Shift+Return to start an instance of foot (https://codeberg.org/dnkl/foot)
|
||||
riverctl map normal Mod1 Return spawn $terminal
|
||||
|
||||
# Mod4+D open wofi
|
||||
riverctl map normal Mod1 D spawn $drunner
|
||||
|
||||
#Mod4+b open browser
|
||||
riverctl map normal Mod1 B spawn $browser
|
||||
|
||||
#Mod1+F open file manager
|
||||
riverctl map normal Mod1 F spawn $file_manager
|
||||
|
||||
#mod1+e open emacs
|
||||
riverctl map normal Mod1 E spawn $editor
|
||||
|
||||
# Mod4+Q to close the focused view
|
||||
riverctl map normal Mod1 Q close
|
||||
|
||||
# Mod4+Shift+E to exit river
|
||||
riverctl map normal Mod1+Shift Q exit
|
||||
|
||||
# Mod4+J and Super+K to focus the next/previous view in the layout stack
|
||||
riverctl map normal Mod1 J focus-view next
|
||||
riverctl map normal Mod1 K focus-view previous
|
||||
|
||||
# Mod4+Shift+J and Super+Shift+K to swap the focused view with the next/previous
|
||||
# view in the layout stack
|
||||
riverctl map normal Mod1+Shift J swap next
|
||||
riverctl map normal Mod1+Shift K swap previous
|
||||
|
||||
# Mod4+Period and Super+Comma to focus the next/previous output
|
||||
riverctl map normal Mod1 L focus-output next
|
||||
riverctl map normal Mod1 H focus-output previous
|
||||
|
||||
# Mod4+Shift+{Period,Comma} to send the focused view to the next/previous output
|
||||
riverctl map normal Mod1+Shift L send-to-output next
|
||||
riverctl map normal Mod1+Shift H send-to-output previous
|
||||
|
||||
# Mod4+Return to bump the focused view to the top of the layout stack
|
||||
riverctl map normal Mod4 Return zoom
|
||||
|
||||
# Mod4+H and Super+L to decrease/increase the main ratio of rivertile(1)
|
||||
riverctl map normal Mod1+Control H send-layout-cmd rivertile "main-ratio -0.05"
|
||||
riverctl map normal Mod1+Control L send-layout-cmd rivertile "main-ratio +0.05"
|
||||
|
||||
# Mod4+Mod1+{H,J,K,L} to move views
|
||||
riverctl map normal Mod4+Mod1 H move left 100
|
||||
riverctl map normal Mod4+Mod1 J move down 100
|
||||
riverctl map normal Mod4+Mod1 K move up 100
|
||||
riverctl map normal Mod4+Mod1 L move right 100
|
||||
|
||||
# Mod4+Mod1+Control+{H,J,K,L} to snap views to screen edges
|
||||
riverctl map normal Mod4+Mod1+Control H snap left
|
||||
riverctl map normal Mod4+Mod1+Control J snap down
|
||||
riverctl map normal Mod4+Mod1+Control K snap up
|
||||
riverctl map normal Mod4+Mod1+Control L snap right
|
||||
|
||||
# Mod4+Mod1+Shif+{H,J,K,L} to resize views
|
||||
riverctl map normal Mod4+Mod1+Shift H resize horizontal -100
|
||||
riverctl map normal Mod4+Mod1+Shift J resize vertical 100
|
||||
riverctl map normal Mod4+Mod1+Shift K resize vertical -100
|
||||
riverctl map normal Mod4+Mod1+Shift L resize horizontal 100
|
||||
|
||||
# Mod4 + Left Mouse Button to move views
|
||||
riverctl map-pointer normal Alt BTN_LEFT move-view
|
||||
|
||||
# Mod4 + Right Mouse Button to resize views
|
||||
riverctl map-pointer normal Alt BTN_RIGHT resize-view
|
||||
|
||||
for i in $(seq 1 9); do
|
||||
tags=$((1 << ($i - 1)))
|
||||
|
||||
# Mod4+[1-9] to focus tag [0-8]
|
||||
riverctl map normal Mod1 $i set-focused-tags $tags
|
||||
|
||||
# Mod4+Shift+[1-9] to tag focused view with tag [0-8]
|
||||
riverctl map normal Mod1+Shift $i set-view-tags $tags
|
||||
|
||||
# Mod4+Ctrl+[1-9] to toggle focus of tag [0-8]
|
||||
riverctl map normal Mod1+Control $i toggle-focused-tags $tags
|
||||
|
||||
# Mod4+Shift+Ctrl+[1-9] to toggle tag [0-8] of focused view
|
||||
riverctl map normal Mod1+Shift+Control $i toggle-view-tags $tags
|
||||
done
|
||||
|
||||
# Mod4+0 to focus all tags
|
||||
# Mod4+Shift+0 to tag focused view with all tags
|
||||
all_tags=$(((1 << 32) - 1))
|
||||
riverctl map normal Mod4 0 set-focused-tags $all_tags
|
||||
riverctl map normal Mod4+Shift 0 set-view-tags $all_tags
|
||||
|
||||
# Mod4+Space to toggle float
|
||||
riverctl map normal Mod1 Space toggle-float
|
||||
|
||||
# Mod4+F to toggle fullscreen
|
||||
riverctl map normal Mod1 t toggle-fullscreen
|
||||
|
||||
# Mod4+{Up,Right,Down,Left} to change layout orientation
|
||||
riverctl map normal Mod4 Up send-layout-cmd rivertile "main-location top"
|
||||
riverctl map normal Mod4 Right send-layout-cmd rivertile "main-location right"
|
||||
riverctl map normal Mod4 Down send-layout-cmd rivertile "main-location bottom"
|
||||
riverctl map normal Mod4 Left send-layout-cmd rivertile "main-location left"
|
||||
|
||||
# Declare a passthrough mode. This mode has only a single mapping to return to
|
||||
# normal mode. This makes it useful for testing a nested wayland compositor
|
||||
riverctl declare-mode passthrough
|
||||
|
||||
# Mod4+F11 to enter passthrough mode
|
||||
riverctl map normal Mod4 F11 enter-mode passthrough
|
||||
|
||||
# Mod4+F11 to return to normal mode
|
||||
riverctl map passthrough Mod4 F11 enter-mode normal
|
||||
|
||||
# Various media key mapping examples for both normal and locked mode which do
|
||||
# not have a modifier
|
||||
for mode in normal locked; do
|
||||
# Eject the optical drive (well if you still have one that is)
|
||||
riverctl map $mode None XF86Eject spawn 'eject -T'
|
||||
|
||||
# Control pulse audio volume with pamixer (https://github.com/cdemoulins/pamixer)
|
||||
riverctl map $mode None XF86AudioRaiseVolume spawn 'pamixer -i 5'
|
||||
riverctl map $mode None XF86AudioLowerVolume spawn 'pamixer -d 5'
|
||||
riverctl map $mode None XF86AudioMute spawn 'pamixer --toggle-mute'
|
||||
|
||||
# Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl)
|
||||
riverctl map $mode None XF86AudioMedia spawn 'playerctl play-pause'
|
||||
riverctl map $mode None XF86AudioPlay spawn 'playerctl play-pause'
|
||||
riverctl map $mode None XF86AudioPrev spawn 'playerctl previous'
|
||||
riverctl map $mode None XF86AudioNext spawn 'playerctl next'
|
||||
#print screen
|
||||
riverctl map $mode None Print spawn 'grim -g "$(slurp)" - | swappy -f -'
|
||||
# Control screen backlight brighness with light (https://github.com/haikarainen/light)
|
||||
riverctl map $mode None XF86MonBrightnessUp spawn 'light -A 5'
|
||||
riverctl map $mode None XF86MonBrightnessDown spawn 'light -U 5'
|
||||
done
|
||||
|
||||
#make a raw mode
|
||||
riverctl declare-mode raw
|
||||
riverctl map normal Mod1 r spawn 'riverctl enter-mode raw'
|
||||
riverctl map raw Mod1 r spawn 'riverctl enter-mode normal'
|
||||
|
||||
|
||||
|
||||
# Set background and border color
|
||||
#riverctl background-color 0x002b36
|
||||
#riverctl border-color-focused 0x8218c4
|
||||
#riverctl border-color-unfocused 0xff282a36
|
||||
#riverctl border-width 3
|
||||
|
||||
#set ssd for apps
|
||||
riverctl rule-add ssd
|
||||
|
||||
# Set keyboard repeat rate
|
||||
riverctl set-repeat 50 300
|
||||
|
||||
# Make certain views start floating
|
||||
riverctl float-filter-add app-id float
|
||||
riverctl float-filter-add title "popup title with spaces"
|
||||
riverctl rule-add -title "Idle Inhibitor" float
|
||||
# Set app-ids and titles of views which should use client side decorations
|
||||
riverctl csd-filter-add app-id "gedit"
|
||||
|
||||
# Set and exec into the default layout generator, rivertile.
|
||||
# River will send the process group of the init executable SIGTERM on exit.
|
||||
riverctl default-layout rivertile
|
||||
exec rivertile -view-padding 3 -outer-padding 3 -main-ratio 0.5
|
||||
|
||||
'';
|
||||
|
||||
};
|
||||
}
|
||||
343
dots/waybar.nix
Executable file
343
dots/waybar.nix
Executable file
@@ -0,0 +1,343 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
inputs,
|
||||
window_manager,
|
||||
...
|
||||
}:
|
||||
{
|
||||
programs.waybar = {
|
||||
enable = true;
|
||||
style = ''
|
||||
#tags button {
|
||||
padding: 0 5px;
|
||||
color: #f8f8f2;
|
||||
}
|
||||
|
||||
#tags button.occupied {
|
||||
color: inherit;
|
||||
background-color: #6a548d
|
||||
}
|
||||
|
||||
|
||||
|
||||
#tags button.focused {
|
||||
color: #f8f8f2;
|
||||
background-color: #aa86e1 ;
|
||||
}
|
||||
|
||||
#tags button.urgent {
|
||||
color: #ea6962;
|
||||
}
|
||||
|
||||
#mode {
|
||||
background: #64727D;
|
||||
border-bottom: 3px solid #f8f8f2;
|
||||
}
|
||||
#backlight-slider slider {
|
||||
min-height: 0px;
|
||||
min-width: 0px;
|
||||
opacity: 0;
|
||||
background-image: none;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
#backlight-slider trough {
|
||||
min-height: 10px;
|
||||
min-width: 10px;
|
||||
border-radius: 5px;
|
||||
background-color: black;
|
||||
}
|
||||
#backlight-slider highlight {
|
||||
min-width: 100px;
|
||||
border-radius: 5px;
|
||||
background-color: red;
|
||||
}
|
||||
/* Add divider styling */
|
||||
#custom-divider {
|
||||
color: #6a548d;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------
|
||||
Workspaces styling
|
||||
-------------------------- */
|
||||
|
||||
|
||||
#workspaces button {
|
||||
padding: 0 6px;
|
||||
font-size: 0.9em;
|
||||
color: #f8f8f2;
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
transition: background 0.2s ease, color 0.2s ease;
|
||||
}
|
||||
|
||||
#workspaces button.empty {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
#workspaces button.persistent {
|
||||
background-color: #44475a;
|
||||
}
|
||||
|
||||
#workspaces button.special {
|
||||
background-color: #8bd49e;
|
||||
color: #282a36;
|
||||
}
|
||||
|
||||
#workspaces button.visible {
|
||||
background-color: #aa86e1;
|
||||
}
|
||||
|
||||
#workspaces button.active {
|
||||
background-color: #6a548d;
|
||||
}
|
||||
|
||||
#workspaces button.urgent {
|
||||
color: #ea6962;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#workspaces button.hosting-monitor {
|
||||
box-shadow: 0 0 0 1px #f8f8f2 inset;
|
||||
}
|
||||
|
||||
#workspaces button:hover {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
'';
|
||||
|
||||
settings = {
|
||||
mainBar = {
|
||||
layer = "top"; # Waybar at top layer
|
||||
# position= "bottom", # Waybar position (top|bottom|left|right)
|
||||
height = 30; # Waybar height (to be removed for auto height)
|
||||
#width = 1280; # Waybar width
|
||||
spacing = 4; # Gaps between modules (4px)
|
||||
# Choose the order of the modules
|
||||
modules-left =
|
||||
if window_manager == "river" then
|
||||
[
|
||||
"river/tags"
|
||||
"custom/media"
|
||||
]
|
||||
else if window_manager == "hyprland" then
|
||||
[
|
||||
"hyprland/workspaces"
|
||||
]
|
||||
else
|
||||
[ ];
|
||||
modules-center = [
|
||||
];
|
||||
|
||||
modules-right = [
|
||||
"pulseaudio"
|
||||
"custom/divider"
|
||||
"network"
|
||||
"custom/divider"
|
||||
"cpu"
|
||||
"custom/divider"
|
||||
"memory"
|
||||
"custom/divider"
|
||||
"power-profiles-daemon"
|
||||
"custom/divider"
|
||||
"battery"
|
||||
"custom/divider"
|
||||
"backlight"
|
||||
"custom/divider"
|
||||
"clock"
|
||||
"custom/divider"
|
||||
"tray"
|
||||
];
|
||||
|
||||
# Modules configuration
|
||||
"hyprland/workspaces" = {
|
||||
format = "{icon}";
|
||||
on_click = "activate";
|
||||
format-icons = {
|
||||
"1" = "一";
|
||||
"2" = "二";
|
||||
"3" = "三";
|
||||
"4" = "四";
|
||||
"5" = "五";
|
||||
"6" = "六";
|
||||
"7" = "七";
|
||||
"8" = "八";
|
||||
"9" = "九";
|
||||
"10" = "일";
|
||||
"11" = "이";
|
||||
"12" = "삼";
|
||||
"13" = "사";
|
||||
"14" = "오";
|
||||
"15" = "육";
|
||||
"16" = "칠";
|
||||
"17" = "팔";
|
||||
"18" = "구";
|
||||
|
||||
};
|
||||
active-only = false;
|
||||
sort-by-name = true;
|
||||
all-outputs = true;
|
||||
};
|
||||
"river/tags" = {
|
||||
num-tags = 9;
|
||||
tag-labels = [
|
||||
"一"
|
||||
"二"
|
||||
"三"
|
||||
"四"
|
||||
"五"
|
||||
"六"
|
||||
"七"
|
||||
"八"
|
||||
"九"
|
||||
];
|
||||
};
|
||||
keyboard-state = {
|
||||
numlock = true;
|
||||
capslock = true;
|
||||
format = "{name} {icon}";
|
||||
format-icons = {
|
||||
locked = "";
|
||||
unlocked = "";
|
||||
};
|
||||
};
|
||||
idle_inhibitor = {
|
||||
format = "{icon}";
|
||||
format-icons = {
|
||||
activated = "";
|
||||
deactivated = "";
|
||||
};
|
||||
};
|
||||
battery = {
|
||||
bat = "BAT0";
|
||||
interval = 60;
|
||||
states = {
|
||||
warning = 30;
|
||||
critical = 15;
|
||||
};
|
||||
format = "{capacity}% {icon}";
|
||||
format-icons = [
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
];
|
||||
max-length = 25;
|
||||
};
|
||||
"backlight/slider" = {
|
||||
min = 0;
|
||||
max = 400;
|
||||
orientation = "horizontal";
|
||||
device = "intel_backlight";
|
||||
};
|
||||
backlight = {
|
||||
device = "intel_backlight";
|
||||
format = "{percent}% {icon}";
|
||||
tooltip-format = "Backlight is {percent}% {icon}";
|
||||
format-icons = [
|
||||
"☽"
|
||||
""
|
||||
""
|
||||
];
|
||||
};
|
||||
tray = {
|
||||
#"icon-size": 21,
|
||||
spacing = 10;
|
||||
};
|
||||
#clock = {
|
||||
# # "timezone": "America/New_York",
|
||||
# tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
|
||||
# format-alt = "{:%Y-%m-%d}";
|
||||
#};
|
||||
"clock" = {
|
||||
format = "{:%r} ";
|
||||
format-alt = "{:%A, %B %d, %Y (%R)} ";
|
||||
tooltip-format = "<tt><small>{calendar}</small></tt>";
|
||||
interval = 1;
|
||||
calendar = {
|
||||
mode = "year";
|
||||
"mode-mon-col" = 3;
|
||||
"weeks-pos" = "right";
|
||||
"on-scroll" = 1;
|
||||
format = {
|
||||
months = "<span color='#ffead3'><b>{}</b></span>";
|
||||
days = "<span color='#ecc6d9'><b>{}</b></span>";
|
||||
weeks = "<span color='#99ffdd'><b>W{}</b></span>";
|
||||
weekdays = "<span color='#ffcc66'><b>{}</b></span>";
|
||||
today = "<span color='#ff6699'><b><u>{}</u></b></span>";
|
||||
};
|
||||
};
|
||||
actions = {
|
||||
"on-click-right" = "mode";
|
||||
#"on-scroll-up" = "tz_up"; # Note: There's a duplicate "on-scroll-up" here
|
||||
#"on-scroll-down" = "tz_down"; # And duplicate "on-scroll-down"
|
||||
"on-scroll-up" = "shift_up";
|
||||
"on-scroll-down" = "shift_down";
|
||||
};
|
||||
};
|
||||
cpu = {
|
||||
format = "{usage}% ";
|
||||
tooltip = false;
|
||||
};
|
||||
memory = {
|
||||
format = "{}% ";
|
||||
};
|
||||
|
||||
network = {
|
||||
interface = "wlo1"; # (Optional) To force the use of this interface
|
||||
format-wifi = "{essid} ({signalStrength}%) ";
|
||||
format-ethernet = "{ipaddr}/{cidr} 囹";
|
||||
tooltip-format = "{ifname} via {gwaddr} 囹";
|
||||
format-linked = "{ifname} (No IP) 囹";
|
||||
format-disconnected = "Disconnected ⚠";
|
||||
format-alt = "{ifname}: {ipaddr}/{cidr}";
|
||||
};
|
||||
pulseaudio = {
|
||||
# "scroll-step": 1, // %, can be a float
|
||||
format = "{volume}% {icon} {format_source}";
|
||||
format-bluetooth = "{volume}% {icon} {format_source}";
|
||||
format-bluetooth-muted = " {icon} {format_source}";
|
||||
format-muted = " {format_source}";
|
||||
format-source = "{volume}% ";
|
||||
format-source-muted = "";
|
||||
format-icons = {
|
||||
headphone = "";
|
||||
hands-free = "";
|
||||
headset = "";
|
||||
phone = "";
|
||||
portable = "";
|
||||
car = "";
|
||||
default = [
|
||||
""
|
||||
""
|
||||
""
|
||||
];
|
||||
};
|
||||
on-click = "pavucontrol";
|
||||
};
|
||||
power-profiles-daemon = {
|
||||
format = "{icon}";
|
||||
tooltip-format = "Power profile: {profile}\nDriver: {driver}";
|
||||
tooltip = true;
|
||||
format-icons = {
|
||||
performance = "";
|
||||
balanced = "";
|
||||
power-saver = "";
|
||||
};
|
||||
};
|
||||
|
||||
# Add this new module definition
|
||||
"custom/divider" = {
|
||||
format = "│";
|
||||
interval = "once";
|
||||
tooltip = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
104
dots/xdg.nix
Executable file
104
dots/xdg.nix
Executable file
@@ -0,0 +1,104 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
window_manager,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
xdg = {
|
||||
enable = true;
|
||||
portal = {
|
||||
enable = true;
|
||||
config.common.default = [
|
||||
"hyprland"
|
||||
"river"
|
||||
"gtk"
|
||||
];
|
||||
xdgOpenUsePortal = true;
|
||||
extraPortals = with pkgs; [
|
||||
xdg-desktop-portal-wlr
|
||||
xdg-desktop-portal-gtk
|
||||
xdg-desktop-portal-hyprland
|
||||
];
|
||||
};
|
||||
mime.enable = true;
|
||||
mimeApps = {
|
||||
enable = true;
|
||||
defaultApplications =
|
||||
let
|
||||
browser = [ "zen-twilight.desktop" ];
|
||||
fileManager = [ "pcmanfm.desktop" ];
|
||||
editor = [ "emacs.desktop" ];
|
||||
player = [ "mpv.desktop" ];
|
||||
viewer = [ "imv-dir.desktop" ];
|
||||
reader = [ "org.pwmt.zathura.desktop" ];
|
||||
in
|
||||
{
|
||||
"application/pdf" = reader;
|
||||
"application/epub" = reader;
|
||||
|
||||
"text/html" = browser;
|
||||
"text/xml" = browser;
|
||||
"text/plain" = editor;
|
||||
"application/x-wine-extension-ini" = editor;
|
||||
|
||||
"application/json" = browser;
|
||||
"application/xml" = browser;
|
||||
"application/xhtml+xml" = browser;
|
||||
"application/xhtml_xml" = browser;
|
||||
"application/rdf+xml" = browser;
|
||||
"application/rss+xml" = browser;
|
||||
"application/x-extension-htm" = browser;
|
||||
"application/x-extension-html" = browser;
|
||||
"application/x-extension-shtml" = browser;
|
||||
"application/x-extension-xht" = browser;
|
||||
"application/x-extension-xhtml" = browser;
|
||||
|
||||
"x-scheme-handler/about" = browser;
|
||||
"x-scheme-handler/ftp" = browser;
|
||||
"x-scheme-handler/http" = browser;
|
||||
"x-scheme-handler/https" = browser;
|
||||
|
||||
"inode/directory" = fileManager;
|
||||
"application/zip" = fileManager;
|
||||
|
||||
"audio/mpeg" = player;
|
||||
"audio/aac" = player;
|
||||
"audio/flac" = player;
|
||||
"audio/wav" = player;
|
||||
"video/mp4" = player;
|
||||
"video/vnd.mpegurl" = player;
|
||||
"video/x-matroska" = player;
|
||||
"application/x-mpegURL" = player;
|
||||
|
||||
"image/gif" = viewer;
|
||||
"image/jpeg" = viewer;
|
||||
"image/png" = viewer;
|
||||
"image/webp" = viewer;
|
||||
};
|
||||
};
|
||||
|
||||
userDirs = {
|
||||
enable = true;
|
||||
createDirectories = true;
|
||||
download = "${config.home.homeDirectory}/Downloads";
|
||||
documents = "${config.home.homeDirectory}/Documents";
|
||||
desktop = "${config.home.homeDirectory}/Desktop";
|
||||
videos = "${config.home.homeDirectory}/Videos";
|
||||
pictures = "${config.home.homeDirectory}/Pictures";
|
||||
music = "${config.home.homeDirectory}/Music";
|
||||
templates = "${config.home.homeDirectory}/.local/share/templates";
|
||||
publicShare = "${config.home.homeDirectory}/.local/share/public";
|
||||
};
|
||||
|
||||
configFile."electron-flags.conf".text = ''
|
||||
--enable-features=WaylandWindowDecorations
|
||||
--enable-features=UseOzonePlatform
|
||||
--ozone-platform-hint=wayland
|
||||
'';
|
||||
#configFile."hypr/hyprland.conf".onChange = "hyprctl reload";
|
||||
|
||||
};
|
||||
}
|
||||
83
dots/zsh.nix
Executable file
83
dots/zsh.nix
Executable file
@@ -0,0 +1,83 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
dotDir = ".config/zsh";
|
||||
plugins = [
|
||||
#pkgs.zsh-autosuggestions
|
||||
#pkgs.spaceship-prompt
|
||||
];
|
||||
autosuggestion = {
|
||||
enable = true;
|
||||
highlight = "fg=#64677a,bold,underline";
|
||||
};
|
||||
history = {
|
||||
path = "$XDG_DATA_HOME/zsh/history";
|
||||
};
|
||||
sessionVariables = {
|
||||
HISTSIZE = 3000;
|
||||
SAVEHIST = 3000;
|
||||
CARGO_HOME = "$XDG_DATA_HOME/cargo";
|
||||
GNUPGHOME = "$XDG_DATA_HOME/gnupg";
|
||||
GOPATH = "$XDG_DATA_HOME/go";
|
||||
GRADLE_USER_HOME = "$XDG_DATA_HOME/gradle";
|
||||
IPYTHONDIR = "$XDG_CONFIG_HOMEipython";
|
||||
JUPYTER_CONFIG_DIR = "$XDG_CONFIG_HOME/jupyter";
|
||||
LESSHISTFILE = "$XDG_CACHE_HOME/less/history";
|
||||
NUGET_PACKAGES = "$XDG_CACHE_HOME/NuGetPackages";
|
||||
PYTHONSTARTUP = "$XDG_CONFIG_HOME/python/pythonrc";
|
||||
KERAS_HOME = "$XDG_STATE_HOME/keras";
|
||||
RUSTUP_HOME = "$XDG_DATA_HOME/rustup";
|
||||
XCOMPOSECACHE = "$XDG_CACHE_HOME/X11/xcompose";
|
||||
SSB_HOME = "$XDG_DATA_HOME/zoom";
|
||||
HISTFILE = "$XDG_STATE_HOME/zsh/history";
|
||||
};
|
||||
shellAliases = {
|
||||
nix-switch = "sudo nixos-rebuild switch";
|
||||
nix-upgrade = "sudo nixos-rebuild switch --upgrade";
|
||||
nix-edit = "sudo vim /etc/nixos/configuration.nix";
|
||||
ls = "exa -lag --icons";
|
||||
upload = "~/.config/script/upload.sh";
|
||||
record = "~/.config/script/record.sh";
|
||||
speak = "~/.config/script/wisper.sh";
|
||||
vim = "nvim";
|
||||
cat = "bat";
|
||||
anime = "~/repos/ani-cli/ani-cli";
|
||||
hentai = "~/repos/and-scripts/fap-cli";
|
||||
manga = "manga-cli";
|
||||
yt = "~/repos/ytfzf/ytfzf --thumb-viewer='kitty' -t";
|
||||
cd = "z";
|
||||
rm = "rip";
|
||||
df = "duf";
|
||||
time = "hyperfine";
|
||||
kami = "~/Documents/Rust/kami/target/release/kami";
|
||||
calc = "cpc";
|
||||
pdf = "mupdf";
|
||||
emacs = "emacs";
|
||||
river = "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=river && river";
|
||||
cp = "xcp";
|
||||
wget = "wget --hsts-file=$XDG_DATA_HOME/wget-hsts";
|
||||
};
|
||||
initContent = ''
|
||||
eval "$(${lib.getExe pkgs.zoxide} init zsh)"
|
||||
eval "$(${lib.getExe pkgs.atuin} init zsh)"
|
||||
source ${pkgs.spaceship-prompt}/lib/spaceship-prompt/spaceship.zsh
|
||||
'';
|
||||
envExtra = ''
|
||||
${lib.getExe pkgs.macchina}
|
||||
nixdev() {
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "Usage: nixdev <language>"
|
||||
return 1
|
||||
fi
|
||||
nix flake init --template "https://flakehub.com/f/the-nix-way/dev-templates/*#$1"
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user