vv works now, .project.el for project root, o to open file dirvish

This commit is contained in:
Joseph Ferano 2022-12-25 23:09:12 +07:00
parent d40c28c5fc
commit 85ce390237
3 changed files with 46 additions and 3 deletions

View File

@ -113,7 +113,7 @@ Then bootstrap
This is commented out since it adds ever so slightly to init time, but keep it around in case we
need to benchmark slow init times later.
#+begin_src emacs-lisp :tangle no
#+begin_src emacs-lisp
(straight-use-package 'benchmark-init)
(require 'benchmark-init)
(add-hook 'after-init-hook 'benchmark-init/deactivate)
@ -377,6 +377,15 @@ Emacs is an great operating system, if only it had a good text editor...
(evil-global-set-key 'insert (kbd "C-w") #'evil-delete-backward-word)
(evil-define-key 'normal 'global (kbd "q") 'avy-goto-word-0)
;; vv to expand selection to line
(evil-global-set-key 'visual
(kbd "v")
(lambda ()
(interactive)
(evil-first-non-blank)
(exchange-point-and-mark)
(evil-end-of-line)))
(add-hook 'emacs-startup-hook
(lambda ()
(evil-define-key 'normal 'global
@ -427,6 +436,8 @@ Emacs is an great operating system, if only it had a good text editor...
;; (define-key evil-consult-map "b" 'evil-window-bottom-right)
;; (define-key evil-consult-map "c" 'evil-window-delete)
(evil-global-set-key 'normal (kbd "C-w") 'save-buffer)
;; (define-key evil-normal-state-map "," 'evil-consult-map)
(defun joe/evil-select-line ()
@ -521,8 +532,9 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun
(defun joe/window-split-horizontal () (interactive) (set 'joe/popper-side-toggle 'below) (rotate:main-vertical))
(evil-global-set-key 'normal (kbd "<leader>w") 'evil-window-map)
(evil-global-set-key 'normal (kbd "C-w") 'save-buffer)

(define-key evil-window-map "u" #'winner-undo)
(define-key ctl-x-4-map (kbd "|") #'joe/window-split-vertical)
(define-key ctl-x-4-map (kbd "-") #'joe/window-split-horizontal)
(define-key ctl-x-4-map (kbd "t") #'rotate-window)
@ -548,6 +560,7 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun
"^\\*Flymake.*" flymake-mode
"^\\*Flycheck.*" flycheck-error-list-mode
"^\\*lsp-help\\*" lsp-help-mode
"^\\*ert\\*" ert-results-mode
"^\\*cargo-test\\*" cargo-test-mode
;; "^\\*ansi-term\\*$" term-mode
("^\\*Warnings\\*$" . hide)
@ -637,6 +650,16 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun
(evil-define-key 'normal 'global (kbd "M-8") '(lambda () (interactive) (tab-bar-select-tab 8)))
(evil-define-key 'normal 'global (kbd "M-9") '(lambda () (interactive) (tab-bar-select-tab 9)))
#+end_src
** Projects
#+begin_src emacs-lisp
(defun joe/project-root-override (dir)
(let ((override (locate-dominating-file dir ".project.el")))
(if override
(cons 'transient override)
nil)))
(add-hook 'project-find-functions #'joe/project-root-override)
#+end_src
** VEMCO
Vertico Embark Marginalia Consult Orderless
@ -830,6 +853,7 @@ targets."
(kbd "q") #'dirvish-quit
(kbd "L") #'dirvish-history-go-forward
(kbd "H") #'dirvish-history-go-backward
(kbd "o") #'dired-open-file
(kbd "TAB") #'dirvish-subtree-toggle
(kbd "M-n") #'dirvish-narrow
(kbd "M-l") #'dirvish-ls-switches-menu
@ -843,6 +867,14 @@ targets."
(global-set-key (kbd "C-x d") #'dirvish-dwim)
(global-set-key (kbd "C-x C-d") #'joe/dirvish-find-directory)
(defun dired-open-file ()
"In dired, open the file named on this line."
(interactive)
(let* ((file (dired-get-filename nil t)))
(message "Opening %s..." file)
(call-process "xdg-open" nil 0 nil file)
(message "Opening %s done" file)))
#+end_src
** Org Mode
@ -1192,6 +1224,8 @@ The best git porcelain/client I've ever used. Also kill stray magit buffers left
(magit-restore-window-configuration)
(mapc #'kill-buffer buffers)))
(add-hook 'with-editor-mode-hook 'evil-insert-state)
(setq magit-bury-buffer-function #'joe/magit-kill-buffers)
(setq magit-clone-set-remote.pushDefault t)
(setq magit-clone-default-directory "~/Development/")

View File

@ -0,0 +1,6 @@
#
# These are very common and useful
#
function la --wraps ls --description "List contents of directory, including hidden files in directory using long format"
ls -lAh --group-directories-first $argv
end

View File

@ -0,0 +1,3 @@
function v --wraps=nvim --description 'alias v nvim'
nvim $argv;
end