Compare commits
3
Commits
ffbefa0887
...
9049b130a8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9049b130a8 | ||
|
|
4389dce613 | ||
|
|
28c152ba22 |
+72
-44
@@ -463,6 +463,31 @@ Functions that only use built-in Emacs functionality.
|
||||
(interactive)
|
||||
(org-babel-load-file (concat dot-emacs-dir "/config.org")))
|
||||
|
||||
;; Reference: http://turingmachine.org/bl/2013-05-29-recursively-listing-directories-in-elisp.html
|
||||
(defun dot/directory-files-recursively-depth (dir regexp include-directories maxdepth)
|
||||
"Depth limited variant of the built-in `directory-files-recursively'."
|
||||
(let ((result '())
|
||||
(current-directory-list (directory-files dir t)))
|
||||
(dolist (path current-directory-list)
|
||||
(cond
|
||||
((and (file-regular-p path)
|
||||
(file-readable-p path)
|
||||
(string-match regexp path))
|
||||
(setq result (cons path result)))
|
||||
((and (file-directory-p path)
|
||||
(file-readable-p path)
|
||||
(not (string-equal "/.." (substring path -3)))
|
||||
(not (string-equal "/." (substring path -2))))
|
||||
(when (and include-directories
|
||||
(string-match regexp path))
|
||||
(setq result (cons path result)))
|
||||
(when (> maxdepth 1)
|
||||
(setq result (append (nreverse (dot/directory-files-recursively-depth
|
||||
path regexp include-directories (- maxdepth 1)))
|
||||
result))))
|
||||
(t)))
|
||||
(reverse result)))
|
||||
|
||||
(defun dot/dired-find-file ()
|
||||
"In Dired, visit the file or directory named on this line."
|
||||
(interactive)
|
||||
@@ -482,12 +507,6 @@ Functions that only use built-in Emacs functionality.
|
||||
(directory-files-recursively dot-emacs-dir ""))))
|
||||
(find-file (completing-read "Find file (emacs): " files nil t))))
|
||||
|
||||
(defun dot/find-file-recentf ()
|
||||
"Use `completing-read' to open a recent file."
|
||||
(interactive)
|
||||
(let ((files (mapcar 'abbreviate-file-name recentf-list)))
|
||||
(find-file (completing-read "Find file (recent): " files nil t))))
|
||||
|
||||
(defun dot/indent-buffer ()
|
||||
"Indent each nonblank line in the buffer."
|
||||
(interactive)
|
||||
@@ -928,7 +947,7 @@ General.el ~leader key binds.
|
||||
|
||||
(space-leader
|
||||
"SPC" '(dot/M-x :which-key "Execute command")
|
||||
"RET" '(bookmark-jump :which-key "Jump to bookmark")
|
||||
"RET" '(consult-bookmark :which-key "Go to bookmark")
|
||||
|
||||
;; Apps
|
||||
"a" '(:ignore t :which-key "apps")
|
||||
@@ -938,7 +957,7 @@ General.el ~leader key binds.
|
||||
;; Buffer / bookmark
|
||||
"b" '(:ignore t :which-key "buffer/bookmark")
|
||||
"b a" '(auto-revert-mode :which-key "Auto revert buffer")
|
||||
"b b" '(switch-to-buffer :which-key "Switch buffer")
|
||||
"b b" '(consult-buffer :which-key "Switch buffer")
|
||||
"b d" '(dot/dashboard-goto :which-key "Dashboard")
|
||||
"b k" '(kill-current-buffer :which-key "Kill buffer")
|
||||
"b m" '(bookmark-set :which-key "Make bookmark")
|
||||
@@ -968,44 +987,25 @@ General.el ~leader key binds.
|
||||
|
||||
;; File
|
||||
"f" '(:ignore t :which-key "file")
|
||||
"f e" '(:ignore t :which-key "emacs")
|
||||
"f e c" '(dot/config-visit :which-key "Config visit")
|
||||
"f e f" '(dot/find-file-emacsd :which-key "Find emacs file")
|
||||
"f e r" '(dot/config-reload :which-key "Config reload")
|
||||
"f d" '(dired :which-key "Find directory")
|
||||
"f f" '(dot/find-file-in-project-root :which-key "Find file")
|
||||
"f o" '(ff-find-other-file :which-key "Find header/source file")
|
||||
"f r" '(dot/find-file-recentf :which-key "Find recent file ")
|
||||
"f r" '(consult-recent-file :which-key "Find recent file")
|
||||
"f R" '(rename-file-and-buffer :which-key "Rename file")
|
||||
"f s" '(basic-save-buffer :which-key "Save file")
|
||||
"f S" '(write-file :which-key "Save file as...")
|
||||
"f u" '(dot/sudo-find-file :which-key "Sudo find file")
|
||||
"f U" '(dot/sudo-this-file :which-key "Sudo this file")
|
||||
"f e" '(:ignore t :which-key "emacs")
|
||||
"f e c" '(dot/config-visit :which-key "Config visit")
|
||||
"f e f" '(dot/find-file-emacsd :which-key "Find emacs file")
|
||||
"f e r" '(dot/config-reload :which-key "Config reload")
|
||||
|
||||
;; Git
|
||||
"g" '(:ignore t :which-key "git")
|
||||
"g b" '(magit-branch-checkout :which-key "Magit switch branch")
|
||||
"g B" '(magit-blame-addition :which-key "Magit blame")
|
||||
"g c" '(:ignore t :which-key "create")
|
||||
"g c c" '(magit-commit-create :which-key "Commit")
|
||||
"g c b" '(magit-branch-and-checkout :which-key "Branch")
|
||||
"g c r" '(magit-init :which-key "Initialize repo")
|
||||
"g C" '(magit-clone :which-key "Magit clone")
|
||||
"g f" '(:ignore t :which-key "file")
|
||||
"g f c" '(magit-find-git-config-file :which-key "Find gitconfig file")
|
||||
"g f D" '(magit-file-delete :which-key "Delete file")
|
||||
"g f f" '(magit-find-file :which-key "Find file")
|
||||
"g f R" '(magit-file-rename :which-key "Rename file")
|
||||
"g F" '(magit-fetch :which-key "Magit fetch")
|
||||
"g g" '(magit-status :which-key "Magit status")
|
||||
"g G" '(magit-status-here :which-key "Magit status here")
|
||||
"g l" '(:ignore t :which-key "list")
|
||||
"g l r" '(magit-list-repositories :which-key "List repositories")
|
||||
"g l s" '(magit-list-submodules :which-key "List submodules")
|
||||
"g L" '(magit-log :which-key "Magit log")
|
||||
"g s" '(magit-show-commit :which-key "Magit show commit")
|
||||
"g S" '(magit-stage-file :which-key "Stage file")
|
||||
"g U" '(magit-unstage-file :which-key "Unstage file")
|
||||
;; Go to
|
||||
"g" '(:ignore t :which-key "goto")
|
||||
"g b" '(consult-bookmark :which-key "Go to bookmark")
|
||||
"g f" '(consult-flycheck :which-key "Go to flycheck error")
|
||||
"g m" '(consult-mark :which-key "Go to marker")
|
||||
|
||||
;; Help
|
||||
"h" '(:keymap help-map :which-key "help")
|
||||
@@ -1034,8 +1034,11 @@ General.el ~leader key binds.
|
||||
"n r r" '(org-roam-buffer-toggle :which-key "Toggle buffer")
|
||||
"n r s" '(org-roam-ui-mode :which-key "Toggle server")
|
||||
|
||||
;; Projectile
|
||||
"p" '(:keymap projectile-command-map :package projectile :which-key "projectile")
|
||||
;; Project
|
||||
"p" '(:keymap project-prefix-map :which-key "project")
|
||||
"p b" '(consult-project-buffer :which-key "project-switch-buffer")
|
||||
"p f" '(consult-project-extra-find :which-key "project-find-file")
|
||||
"p g" '(consult-grep :which-key "project-find-regexp")
|
||||
|
||||
;; Quit
|
||||
"q" '(:ignore t :which-key "quit")
|
||||
@@ -1047,7 +1050,6 @@ General.el ~leader key binds.
|
||||
;; Search
|
||||
"s" '(:ignore t :which-key "search")
|
||||
"s a" '(avy-goto-char-timer :which-key "Avy goto char")
|
||||
"s b" '(bookmark-jump :which-key "Jump to bookmark")
|
||||
"s f" '(consult-find :which-key "Search file")
|
||||
"s l" '(avy-goto-line :which-key "Avy goto line")
|
||||
"s p" '(consult-grep :which-key "Search project")
|
||||
@@ -1056,9 +1058,8 @@ General.el ~leader key binds.
|
||||
|
||||
;; Tabs / toggle
|
||||
"t" '(:ignore t :which-key "tabs/toggle")
|
||||
"t b" '(centaur-tabs-group-buffer-groups :which-key "Group tabs by buffer")
|
||||
"t f" '(dot/toggle-fringe :which-key "Toggle fringe")
|
||||
"t p" '(centaur-tabs-group-by-projectile-project :which-key "Group tabs by project")
|
||||
"t g" '(centaur-tabs-switch-group :which-key "Switch tab group")
|
||||
"t h" '(centaur-tabs-backward-group :which-key "Tab backward group")
|
||||
"t j" '(centaur-tabs-select-end-tab :which-key "Tab select first")
|
||||
"t k" '(centaur-tabs-select-beg-tab :which-key "Tab select last")
|
||||
@@ -1069,6 +1070,31 @@ General.el ~leader key binds.
|
||||
;; Update packages
|
||||
"U" '(dot/update-packages :which-key "Update packages")
|
||||
|
||||
;; Version control
|
||||
"v" '(:ignore t :which-key "git")
|
||||
"v b" '(magit-branch-checkout :which-key "Magit switch branch")
|
||||
"v B" '(magit-blame-addition :which-key "Magit blame")
|
||||
"v C" '(magit-clone :which-key "Magit clone")
|
||||
"v F" '(magit-fetch :which-key "Magit fetch")
|
||||
"v L" '(magit-log :which-key "Magit log")
|
||||
"v s" '(magit-show-commit :which-key "Magit show commit")
|
||||
"v S" '(magit-stage-file :which-key "Stage file")
|
||||
"v U" '(magit-unstage-file :which-key "Unstage file")
|
||||
"v v" '(magit-status :which-key "Magit status")
|
||||
"v V" '(magit-status-here :which-key "Magit status here")
|
||||
"v c" '(:ignore t :which-key "create")
|
||||
"v c c" '(magit-commit-create :which-key "Commit")
|
||||
"v c b" '(magit-branch-and-checkout :which-key "Branch")
|
||||
"v c r" '(magit-init :which-key "Initialize repo")
|
||||
"v f" '(:ignore t :which-key "file")
|
||||
"v f c" '(magit-find-git-config-file :which-key "Find gitconfig file")
|
||||
"v f D" '(magit-file-delete :which-key "Delete file")
|
||||
"v f f" '(magit-find-file :which-key "Find file")
|
||||
"v f R" '(magit-file-rename :which-key "Rename file")
|
||||
"v l" '(:ignore t :which-key "list")
|
||||
"v l r" '(magit-list-repositories :which-key "List repositories")
|
||||
"v l s" '(magit-list-submodules :which-key "List submodules")
|
||||
|
||||
;; Window
|
||||
"w" '(:ignore t :which-key "window")
|
||||
"w +" '(evil-window-increase-height :which-key "Increase window height")
|
||||
@@ -1131,6 +1157,10 @@ https://github.com/suyashbire1/emacs.d/blob/master/init.el
|
||||
"'" '(org-edit-special :which-key "Org edit")
|
||||
"e" '(org-export-dispatch :which-key "Org export")
|
||||
"o" '(org-open-at-point :which-key "Org open at point")
|
||||
"q" '(org-set-tags-command :which-key "Org tags")
|
||||
|
||||
"g" '(:ignore t :which-key "goto")
|
||||
"g o" '(consult-outline :which-key "Org go to heading")
|
||||
|
||||
"i" '(:ignore t :which-key "insert")
|
||||
"i c" '(org-table-insert-column :which-key "Insert table column")
|
||||
@@ -1145,8 +1175,6 @@ https://github.com/suyashbire1/emacs.d/blob/master/init.el
|
||||
"l s" '(org-store-link :which-key "Store link")
|
||||
"l S" '(org-insert-last-stored-link :which-key "Insert stored link")
|
||||
|
||||
"q" '(org-set-tags-command :which-key "Org tags")
|
||||
|
||||
"s" '(:ignore t :which-key "tree/subtree")
|
||||
"s h" '(org-promote-subtree :which-key "Org promote subtree")
|
||||
"s j" '(org-metadown :which-key "Org move subtree down")
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
** Table of Contents :toc_4:
|
||||
- [[#company][Company]]
|
||||
- [[#git][Git]]
|
||||
- [[#projectile][Projectile]]
|
||||
- [[#project][Project]]
|
||||
- [[#languages][Languages]]
|
||||
- [[#language-server-support][Language Server Support]]
|
||||
- [[#debug-adapter-support][Debug Adapter Support]]
|
||||
@@ -107,28 +107,29 @@ GLSL integration with company requires the package: ~glslang~.
|
||||
(put 'magit-log-select-pick :advertised-binding [?\M-c])
|
||||
(put 'magit-log-select-quit :advertised-binding [?\M-k]))
|
||||
#+END_SRC
|
||||
** Projectile
|
||||
|
||||
** Project
|
||||
|
||||
Project manager.
|
||||
|
||||
[[https://michael.stapelberg.ch/posts/2021-04-02-emacs-project-override/][Adding to project.el project directory detection]].
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package projectile
|
||||
(use-package project
|
||||
:defer t
|
||||
:init (setq project-list-file (concat dot-cache-dir "/projects"))
|
||||
:config
|
||||
(setq projectile-cache-file (concat dot-cache-dir "/projectile.cache"))
|
||||
(setq projectile-completion-system 'default)
|
||||
(setq projectile-enable-caching t)
|
||||
(setq projectile-indexing-method 'hybrid)
|
||||
(setq projectile-known-projects-file (concat dot-cache-dir "/projectile-bookmarks.eld"))
|
||||
(setq projectile-project-search-path '("~"))
|
||||
(setq projectile-sort-order 'recentf)
|
||||
(defun dot/project-find (dir)
|
||||
(let ((root (locate-dominating-file dir ".project")))
|
||||
(and root (cons 'vc root))))
|
||||
(add-hook 'project-find-functions #'dot/project-find)
|
||||
|
||||
(defun dot/find-project-root ()
|
||||
"Return root of the project, determined by `.git/' and `.projectile',
|
||||
"Return root of the project, determined by `.git/' and `.project',
|
||||
`default-directory' otherwise."
|
||||
(let ((search-directory (projectile-project-root)))
|
||||
(if search-directory
|
||||
search-directory
|
||||
(let ((project (project-current)))
|
||||
(if project
|
||||
(project-root project)
|
||||
default-directory)))
|
||||
|
||||
(defun dot/find-file-in-project-root ()
|
||||
@@ -137,7 +138,31 @@ Project manager.
|
||||
(let ((default-directory (dot/find-project-root)))
|
||||
(call-interactively 'find-file)))
|
||||
|
||||
(projectile-mode))
|
||||
(defun dot/project-remember-projects-under (dir maxdepth)
|
||||
"Index all projects below directory DIR recursively, until MAXDEPTH."
|
||||
(let ((files (mapcar 'file-name-directory
|
||||
(dot/directory-files-recursively-depth
|
||||
dir "\\.git$\\|\\.project$" t maxdepth))))
|
||||
(dolist (path files)
|
||||
(project-remember-projects-under path))))
|
||||
|
||||
(unless (file-exists-p project-list-file)
|
||||
(project-remember-projects-under "~/dotfiles")
|
||||
(dot/project-remember-projects-under "~/code" 4))
|
||||
|
||||
(defun dot/project-project-name ()
|
||||
"Return project name."
|
||||
(let ((project (project-current)))
|
||||
(if project
|
||||
(file-name-nondirectory (directory-file-name (project-root project)))
|
||||
"-")))
|
||||
|
||||
(defun dot/project-save-project-buffers ()
|
||||
"Save all project buffers."
|
||||
(interactive)
|
||||
(let ((buffers (cl-remove-if (lambda (buffer) (not (buffer-file-name buffer)))
|
||||
(project-buffers (project-current)))))
|
||||
(save-some-buffers t (lambda () (member (current-buffer) buffers))))))
|
||||
#+END_SRC
|
||||
|
||||
** Languages
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
(setq tex-indent-basic 4)))
|
||||
:config
|
||||
|
||||
(with-eval-after-load 'projectile
|
||||
(with-eval-after-load 'project
|
||||
(defun compile-latex ()
|
||||
"Compile LaTeX project."
|
||||
(interactive)
|
||||
(let ((default-directory (dot/find-project-root)))
|
||||
(projectile-save-project-buffers)
|
||||
(dot/project-save-project-buffers)
|
||||
(shell-command "make")))))
|
||||
#+END_SRC
|
||||
|
||||
|
||||
@@ -41,6 +41,12 @@
|
||||
|
||||
(use-package consult
|
||||
:after selectrum
|
||||
:config
|
||||
(setq consult-project-root-function #'dot/find-project-root))
|
||||
:config (setq consult-narrow-key (kbd "?")))
|
||||
|
||||
(use-package consult-flycheck
|
||||
:after (consult flycheck))
|
||||
|
||||
(use-package consult-project-extra
|
||||
:after (consult project)
|
||||
:config (setq project-switch-commands 'consult-project-extra-find))
|
||||
#+END_SRC
|
||||
|
||||
+25
-11
@@ -53,17 +53,30 @@ Places buffers as tabs in a bar at the top of the frame.
|
||||
(setq centaur-tabs-set-modified-marker t)
|
||||
(setq centaur-tabs-style "slant")
|
||||
|
||||
(setq centaur-tabs-project-buffer-group-calc nil)
|
||||
(defun centaur-tabs-buffer-groups ()
|
||||
"Organize tabs into groups by buffer."
|
||||
(list
|
||||
(cond
|
||||
((string-equal "*" (substring (buffer-name) 0 1)) "Emacs")
|
||||
((memq major-mode '(org-mode
|
||||
emacs-lisp-mode)) "Org Mode")
|
||||
((derived-mode-p 'dired-mode) "Dired")
|
||||
((derived-mode-p 'prog-mode
|
||||
'text-mode) "Editing")
|
||||
(t "User"))))
|
||||
(unless centaur-tabs-project-buffer-group-calc
|
||||
(set (make-local-variable 'centaur-tabs-project-buffer-group-calc)
|
||||
(list
|
||||
(cond
|
||||
((string-equal "*" (substring (buffer-name) 0 1)) "Emacs")
|
||||
((or (memq major-mode '(magit-process-mode
|
||||
magit-status-mode
|
||||
magit-diff-mode
|
||||
magit-log-mode
|
||||
magit-file-mode
|
||||
magit-blob-mode
|
||||
magit-blame-mode))
|
||||
(string= (buffer-name) "COMMIT_EDITMSG")) "Magit")
|
||||
((project-current) (dot/project-project-name))
|
||||
((memq major-mode '(org-mode
|
||||
emacs-lisp-mode)) "Org Mode")
|
||||
((derived-mode-p 'dired-mode) "Dired")
|
||||
((derived-mode-p 'prog-mode
|
||||
'text-mode) "Editing")
|
||||
(t "Other")))))
|
||||
(symbol-value 'centaur-tabs-project-buffer-group-calc))
|
||||
|
||||
(defun centaur-tabs-hide-tab (buffer)
|
||||
"Hide from the tab bar by BUFFER name."
|
||||
@@ -137,6 +150,7 @@ Places buffers as tabs in a bar at the top of the frame.
|
||||
(setq dashboard-banner-logo-title "GNU Emacs master race!")
|
||||
(setq dashboard-center-content t)
|
||||
(setq dashboard-page-separator "\n\f\n")
|
||||
(setq dashboard-projects-backend 'project-el)
|
||||
(setq dashboard-set-file-icons t)
|
||||
(setq dashboard-set-footer nil)
|
||||
(setq dashboard-set-heading-icons t)
|
||||
@@ -196,7 +210,7 @@ Provides Emacs with a file tree.
|
||||
:init
|
||||
|
||||
;; This needs to be in init to actually start loading the package
|
||||
(with-eval-after-load 'projectile
|
||||
(with-eval-after-load 'project
|
||||
(defun neotree-toggle-in-project-root ()
|
||||
"Toggle Neotree in project root."
|
||||
(interactive)
|
||||
@@ -224,7 +238,7 @@ Emacs mode line replacement.
|
||||
(accent . (telephone-line-erc-modified-channels-segment
|
||||
telephone-line-process-segment
|
||||
telephone-line-buffer-segment))
|
||||
(nil . (telephone-line-projectile-segment))))
|
||||
(nil . (telephone-line-project-segment))))
|
||||
(telephone-line-mode))
|
||||
#+END_SRC
|
||||
|
||||
|
||||
Reference in New Issue
Block a user