kopia lustrzana
https://github.com/Foltik/dotfiles
synced 2024-11-10 07:38:24 -05:00
30 May 2022 16:18:51
This commit is contained in:
rodzic
0445dc42ba
commit
51ff4bff50
@ -33,10 +33,11 @@ gpg-connect-agent updatestartuptty /bye >/dev/null
|
||||
# Functions
|
||||
#
|
||||
|
||||
# Abbreviations
|
||||
abbr -a ls exa
|
||||
abbr -a g git
|
||||
abbr -a vim nvim
|
||||
# Shorthand
|
||||
abbr -a g git
|
||||
function ls; exa $argv; end
|
||||
function ll; exa -l $argv; end
|
||||
function vim; nvim $argv; end
|
||||
|
||||
# Dotfiles management
|
||||
function dots
|
||||
|
@ -90,6 +90,9 @@
|
||||
(add-hook 'evil-insert-state-entry-hook #'my/line-numbers-absolute)
|
||||
(add-hook 'evil-insert-state-exit-hook #'my/line-numbers-relative)
|
||||
|
||||
(global-undo-tree-mode)
|
||||
(add-hook 'evil-local-mode-hook 'turn-on-undo-tree-mode)
|
||||
|
||||
(use-package copilot
|
||||
:commands (copilot-complete))
|
||||
|
||||
@ -126,12 +129,31 @@
|
||||
(map!
|
||||
:desc "Copilot" :i "C-," #'my/copilot-complete)
|
||||
|
||||
(map!
|
||||
:desc "Show docs" :ni "C-/" #'my/lsp-ui-doc-open)
|
||||
|
||||
(map! :map lsp-ui-doc-frame-mode-map
|
||||
:n "q" #'my/lsp-ui-doc-close
|
||||
:n "<escape>" #'my/lsp-ui-doc-close)
|
||||
(after! lsp-ui
|
||||
(evil-make-overriding-map lsp-ui-doc-frame-mode-map 'normal))
|
||||
|
||||
(map! :map minibuffer-mode-map
|
||||
:desc "Next history" "C-j" #'next-history-element
|
||||
:desc "Prev history" "C-k" #'previous-history-element)
|
||||
|
||||
(map!
|
||||
:desc "Save file" "C-s" #'save-buffer)
|
||||
|
||||
(map!
|
||||
:desc "Scroll page up" :ni "C-S-k" #'evil-scroll-up
|
||||
:desc "Scroll line up" :ni "C-k" #'evil-scroll-line-up
|
||||
:desc "Scroll page down" :ni "C-S-j" #'evil-scroll-down
|
||||
:desc "Scroll line down" :ni "C-j" #'evil-scroll-line-down)
|
||||
|
||||
(map!
|
||||
:desc "Undo tree visualizer" "U" #'undo-tree-visualize)
|
||||
|
||||
(map! :leader
|
||||
:desc "M-x" "x" #'counsel-M-x
|
||||
:desc "M-:" ";" #'pp-eval-expression)
|
||||
@ -188,6 +210,7 @@
|
||||
:prefix ("f s" . "snippets")
|
||||
:desc "New snippet" "n" #'yas-new-snippet
|
||||
:desc "Edit snippet" "e" #'yas-visit-snippet-file
|
||||
:desc "Reload snippets" "r" #'yas-reload-all
|
||||
:desc "Browse docs" "?" #'my/yas-browse-docs)
|
||||
|
||||
(defun my/yas-browse-docs ()
|
||||
@ -377,10 +400,11 @@
|
||||
|
||||
(defhydra my/hydra-window-resize ()
|
||||
"Resize window"
|
||||
("=" my/window-increase-height "++Height")
|
||||
("-" my/window-decrease-height "--Height")
|
||||
("<" my/window-decrease-width "--Width")
|
||||
(">" my/window-increase-width "++Width"))
|
||||
("k" my/window-increase-height "++Height")
|
||||
("j" my/window-decrease-height "--Height")
|
||||
("h" my/window-decrease-width "--Width")
|
||||
("l" my/window-increase-width "++Width")
|
||||
("ESC" nil "Quit" :color blue))
|
||||
|
||||
(map! :map org-config-mode-map
|
||||
:localleader
|
||||
@ -455,18 +479,27 @@ _Q_: Disconnect _sd_: Down stack frame _bh_: Set hit count
|
||||
|
||||
(add-to-list 'projectile-globally-ignored-files "Cargo.lock")
|
||||
|
||||
(rx-let ((crate (or alphanumeric "_" "*")))
|
||||
(setq my//rust/import-singular-rx
|
||||
;; use foo::bar::baz;
|
||||
(rx line-start "use "
|
||||
(+ (+ crate) "::")
|
||||
(+ crate)
|
||||
(? ";") line-end))
|
||||
(setq my//rust/import-plural-rx
|
||||
;; use foo::bar::baz::{qux::quo, };
|
||||
(rx line-start "use "
|
||||
(+ (+ crate) "::")
|
||||
"{" (* (+ crate) "::") (+ crate) "," (* whitespace) "}"
|
||||
(? ";") line-end)))
|
||||
|
||||
(defun my/rust/import-pluralize ()
|
||||
"Convert a singular import into a brace-wrapped plural import."
|
||||
(interactive)
|
||||
(if (and
|
||||
(not (my/kbd!-p))
|
||||
(my/insert-mode-p)
|
||||
(my/line-match-p
|
||||
;; use foo::bar::baz;
|
||||
(rx line-start "use "
|
||||
(+ (+ word) "::")
|
||||
(+ word)
|
||||
(? ";") line-end)))
|
||||
(my/line-match-p my//rust/import-singular-rx))
|
||||
(kbd! "ESC vb S} f} i,")
|
||||
(insert ",")))
|
||||
|
||||
@ -476,12 +509,7 @@ _Q_: Disconnect _sd_: Down stack frame _bh_: Set hit count
|
||||
(if (and
|
||||
(not (my/kbd!-p))
|
||||
(my/insert-mode-p)
|
||||
(my/line-match-p
|
||||
;; use foo::bar::baz::{qux::quo,};
|
||||
(rx line-start "use "
|
||||
(+ (+ word) "::")
|
||||
"{" (* (+ word) "::") (+ word) ",}"
|
||||
(? ";") line-end)))
|
||||
(my/line-match-p my//rust/import-plural-rx))
|
||||
(kbd! "ESC l dF, ds} $i")
|
||||
(evil-delete-backward-char-and-join 1)))
|
||||
|
||||
@ -491,13 +519,7 @@ _Q_: Disconnect _sd_: Down stack frame _bh_: Set hit count
|
||||
(if (and
|
||||
(not (my/kbd!-p))
|
||||
(my/insert-mode-p)
|
||||
(my/line-match-p
|
||||
;; use foo::bar::baz::{qux::quo, };
|
||||
(rx line-start
|
||||
"use "
|
||||
(+ (+ word) "::")
|
||||
"{" (* (+ word) "::") (+ word) "," (* whitespace) "}"
|
||||
(? ";") line-end)))
|
||||
(my/line-match-p my//rust/import-plural-rx))
|
||||
(kbd! "ESC l dF, ds} $i")
|
||||
(backward-kill-word 1)))
|
||||
|
||||
@ -584,13 +606,27 @@ _Q_: Disconnect _sd_: Down stack frame _bh_: Set hit count
|
||||
(defun my/projectile-switch-project ()
|
||||
(interactive)
|
||||
;; Prune projects which no longer exist
|
||||
(dolist (project projectile-known-projects)
|
||||
(unless (file-directory-p project)
|
||||
(projectile-remove-known-project project)))
|
||||
(when (boundp 'projectile-known-projects)
|
||||
(dolist (project projectile-known-projects)
|
||||
(unless (file-directory-p project)
|
||||
(projectile-remove-known-project project))))
|
||||
(call-interactively #'counsel-projectile-switch-project))
|
||||
|
||||
(setq lsp-ui-doc-show-with-mouse t)
|
||||
|
||||
(setq lsp-headerline-breadcrumb-enable t)
|
||||
(setq lsp-headerline-breadcrumb-segments '(symbols))
|
||||
|
||||
(defun my/lsp-ui-doc-open ()
|
||||
(interactive)
|
||||
(lsp-ui-doc-show)
|
||||
(lsp-ui-doc-focus-frame))
|
||||
|
||||
(defun my/lsp-ui-doc-close ()
|
||||
(interactive)
|
||||
(lsp-ui-doc-unfocus-frame)
|
||||
(lsp-ui-doc-hide))
|
||||
|
||||
(defun my/counsel-search ()
|
||||
(interactive)
|
||||
(unless (boundp 'my/kagi-found)
|
||||
|
@ -130,6 +130,12 @@ mode.
|
||||
(add-hook 'evil-insert-state-entry-hook #'my/line-numbers-absolute)
|
||||
(add-hook 'evil-insert-state-exit-hook #'my/line-numbers-relative)
|
||||
#+END_SRC
|
||||
*** Undo Tree
|
||||
#+BEGIN_SRC elisp
|
||||
(global-undo-tree-mode)
|
||||
(add-hook 'evil-local-mode-hook 'turn-on-undo-tree-mode)
|
||||
#+END_SRC
|
||||
|
||||
** Copilot
|
||||
Add support for GitHub Copilot ([[*Copilot][keybinds]]).
|
||||
|
||||
@ -186,13 +192,43 @@ Unmap a bunch of the default keybindings.
|
||||
#+END_SRC
|
||||
*** LSP
|
||||
#+BEGIN_SRC elisp
|
||||
(map!
|
||||
:desc "Show docs" :ni "C-/" #'my/lsp-ui-doc-open)
|
||||
|
||||
(map! :map lsp-ui-doc-frame-mode-map
|
||||
:n "q" #'my/lsp-ui-doc-close
|
||||
:n "<escape>" #'my/lsp-ui-doc-close)
|
||||
(after! lsp-ui
|
||||
(evil-make-overriding-map lsp-ui-doc-frame-mode-map 'normal))
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
: normal
|
||||
|
||||
*** Minibuffer
|
||||
#+BEGIN_SRC elisp
|
||||
(map! :map minibuffer-mode-map
|
||||
:desc "Next history" "C-j" #'next-history-element
|
||||
:desc "Prev history" "C-k" #'previous-history-element)
|
||||
#+END_SRC
|
||||
*** Files
|
||||
#+BEGIN_SRC elisp
|
||||
(map!
|
||||
:desc "Save file" "C-s" #'save-buffer)
|
||||
#+END_SRC
|
||||
*** Evil
|
||||
#+BEGIN_SRC elisp
|
||||
(map!
|
||||
:desc "Scroll page up" :ni "C-S-k" #'evil-scroll-up
|
||||
:desc "Scroll line up" :ni "C-k" #'evil-scroll-line-up
|
||||
:desc "Scroll page down" :ni "C-S-j" #'evil-scroll-down
|
||||
:desc "Scroll line down" :ni "C-j" #'evil-scroll-line-down)
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC elisp
|
||||
(map!
|
||||
:desc "Undo tree visualizer" "U" #'undo-tree-visualize)
|
||||
#+END_SRC
|
||||
|
||||
** Leader
|
||||
*** Root
|
||||
@ -272,6 +308,7 @@ Unmap a bunch of the default keybindings.
|
||||
:prefix ("f s" . "snippets")
|
||||
:desc "New snippet" "n" #'yas-new-snippet
|
||||
:desc "Edit snippet" "e" #'yas-visit-snippet-file
|
||||
:desc "Reload snippets" "r" #'yas-reload-all
|
||||
:desc "Browse docs" "?" #'my/yas-browse-docs)
|
||||
#+END_SRC
|
||||
|
||||
@ -494,10 +531,11 @@ keybindings specific to =config.org=.
|
||||
|
||||
(defhydra my/hydra-window-resize ()
|
||||
"Resize window"
|
||||
("=" my/window-increase-height "++Height")
|
||||
("-" my/window-decrease-height "--Height")
|
||||
("<" my/window-decrease-width "--Width")
|
||||
(">" my/window-increase-width "++Width"))
|
||||
("k" my/window-increase-height "++Height")
|
||||
("j" my/window-decrease-height "--Height")
|
||||
("h" my/window-decrease-width "--Width")
|
||||
("l" my/window-increase-width "++Width")
|
||||
("ESC" nil "Quit" :color blue))
|
||||
#+END_SRC
|
||||
|
||||
** Local Leader
|
||||
@ -598,18 +636,27 @@ _Q_: Disconnect _sd_: Down stack frame _bh_: Set hit count
|
||||
|
||||
*** Editing
|
||||
#+BEGIN_SRC elisp
|
||||
(rx-let ((crate (or alphanumeric "_" "*")))
|
||||
(setq my//rust/import-singular-rx
|
||||
;; use foo::bar::baz;
|
||||
(rx line-start "use "
|
||||
(+ (+ crate) "::")
|
||||
(+ crate)
|
||||
(? ";") line-end))
|
||||
(setq my//rust/import-plural-rx
|
||||
;; use foo::bar::baz::{qux::quo, };
|
||||
(rx line-start "use "
|
||||
(+ (+ crate) "::")
|
||||
"{" (* (+ crate) "::") (+ crate) "," (* whitespace) "}"
|
||||
(? ";") line-end)))
|
||||
|
||||
(defun my/rust/import-pluralize ()
|
||||
"Convert a singular import into a brace-wrapped plural import."
|
||||
(interactive)
|
||||
(if (and
|
||||
(not (my/kbd!-p))
|
||||
(my/insert-mode-p)
|
||||
(my/line-match-p
|
||||
;; use foo::bar::baz;
|
||||
(rx line-start "use "
|
||||
(+ (+ word) "::")
|
||||
(+ word)
|
||||
(? ";") line-end)))
|
||||
(my/line-match-p my//rust/import-singular-rx))
|
||||
(kbd! "ESC vb S} f} i,")
|
||||
(insert ",")))
|
||||
|
||||
@ -619,12 +666,7 @@ _Q_: Disconnect _sd_: Down stack frame _bh_: Set hit count
|
||||
(if (and
|
||||
(not (my/kbd!-p))
|
||||
(my/insert-mode-p)
|
||||
(my/line-match-p
|
||||
;; use foo::bar::baz::{qux::quo,};
|
||||
(rx line-start "use "
|
||||
(+ (+ word) "::")
|
||||
"{" (* (+ word) "::") (+ word) ",}"
|
||||
(? ";") line-end)))
|
||||
(my/line-match-p my//rust/import-plural-rx))
|
||||
(kbd! "ESC l dF, ds} $i")
|
||||
(evil-delete-backward-char-and-join 1)))
|
||||
|
||||
@ -634,13 +676,7 @@ _Q_: Disconnect _sd_: Down stack frame _bh_: Set hit count
|
||||
(if (and
|
||||
(not (my/kbd!-p))
|
||||
(my/insert-mode-p)
|
||||
(my/line-match-p
|
||||
;; use foo::bar::baz::{qux::quo, };
|
||||
(rx line-start
|
||||
"use "
|
||||
(+ (+ word) "::")
|
||||
"{" (* (+ word) "::") (+ word) "," (* whitespace) "}"
|
||||
(? ";") line-end)))
|
||||
(my/line-match-p my//rust/import-plural-rx))
|
||||
(kbd! "ESC l dF, ds} $i")
|
||||
(backward-kill-word 1)))
|
||||
#+END_SRC
|
||||
@ -736,15 +772,31 @@ Setup: run =M-x dap-go-setup=
|
||||
(defun my/projectile-switch-project ()
|
||||
(interactive)
|
||||
;; Prune projects which no longer exist
|
||||
(dolist (project projectile-known-projects)
|
||||
(unless (file-directory-p project)
|
||||
(projectile-remove-known-project project)))
|
||||
(when (boundp 'projectile-known-projects)
|
||||
(dolist (project projectile-known-projects)
|
||||
(unless (file-directory-p project)
|
||||
(projectile-remove-known-project project))))
|
||||
(call-interactively #'counsel-projectile-switch-project))
|
||||
#+END_SRC
|
||||
|
||||
** LSP
|
||||
#+BEGIN_SRC elisp
|
||||
(setq lsp-ui-doc-show-with-mouse t)
|
||||
|
||||
(setq lsp-headerline-breadcrumb-enable t)
|
||||
(setq lsp-headerline-breadcrumb-segments '(symbols))
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC elisp
|
||||
(defun my/lsp-ui-doc-open ()
|
||||
(interactive)
|
||||
(lsp-ui-doc-show)
|
||||
(lsp-ui-doc-focus-frame))
|
||||
|
||||
(defun my/lsp-ui-doc-close ()
|
||||
(interactive)
|
||||
(lsp-ui-doc-unfocus-frame)
|
||||
(lsp-ui-doc-hide))
|
||||
#+END_SRC
|
||||
|
||||
** Counsel Search
|
||||
|
@ -69,7 +69,7 @@
|
||||
dired ; making dired pretty [functional]
|
||||
electric ; smarter, keyword-based electric-indent
|
||||
;;ibuffer ; interactive buffer management
|
||||
undo ; persistent, smarter undo for your inevitable mistakes
|
||||
(undo +tree) ; persistent, smarter undo for your inevitable mistakes
|
||||
vc ; version-control and Emacs, sitting in a tree
|
||||
|
||||
:term
|
||||
|
Ładowanie…
Reference in New Issue
Block a user