Fix keybindings module
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
(expand-file-name "lisp" user-emacs-directory))
|
(expand-file-name "lisp" user-emacs-directory))
|
||||||
|
|
||||||
(defun fscotto/load-module (module)
|
(defun fscotto/load-module (module)
|
||||||
"Load a module from symbol"
|
"Load a MODULE from symbol."
|
||||||
(let* ((module-name (symbol-name module))
|
(let* ((module-name (symbol-name module))
|
||||||
(path (expand-file-name
|
(path (expand-file-name
|
||||||
(concat (replace-regexp-in-string "/" "/" module-name)
|
(concat (replace-regexp-in-string "/" "/" module-name)
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
(load path nil 'nomessage)))
|
(load path nil 'nomessage)))
|
||||||
|
|
||||||
(defun fscotto/load-modules (&rest modules)
|
(defun fscotto/load-modules (&rest modules)
|
||||||
|
"Load MODULES."
|
||||||
(mapc #'fscotto/load-module modules))
|
(mapc #'fscotto/load-module modules))
|
||||||
|
|
||||||
;;=====================================================================================
|
;;=====================================================================================
|
||||||
|
|||||||
@@ -21,3 +21,7 @@
|
|||||||
(setq vc-follow-symlinks 't)
|
(setq vc-follow-symlinks 't)
|
||||||
(prefer-coding-system 'utf-8-unix)
|
(prefer-coding-system 'utf-8-unix)
|
||||||
(setq custom-file (null-device))
|
(setq custom-file (null-device))
|
||||||
|
|
||||||
|
(provide 'editor)
|
||||||
|
|
||||||
|
;;; editor.el ends here
|
||||||
|
|||||||
@@ -1,3 +1,160 @@
|
|||||||
;; Legacy alias (keep muscle memory)
|
;;; keybindings.el -*- lexical-binding: t; -*-
|
||||||
(global-set-key (kbd "C-c v g") #'magit-status)
|
|
||||||
(global-set-key (kbd "C-c g") #'fscotto/magit-dispatch)
|
;;;; Global / Core
|
||||||
|
|
||||||
|
(global-set-key (kbd "C-x C-b") #'ibuffer)
|
||||||
|
|
||||||
|
(defvar fscotto/leader-map (make-sparse-keymap)
|
||||||
|
"Keymap per comandi sotto C-c.")
|
||||||
|
|
||||||
|
(define-key global-map (kbd "C-c") fscotto/leader-map)
|
||||||
|
|
||||||
|
;;;; Git / Magit
|
||||||
|
(defun fscotto/enable-magit-keymap ()
|
||||||
|
"Enable Git keybindings if current buffer is inside a Git repository."
|
||||||
|
(when (and (require 'magit nil 'noerror)
|
||||||
|
(magit-toplevel))
|
||||||
|
(local-set-key (kbd "C-c g") fscotto/git-map)))
|
||||||
|
|
||||||
|
(defvar fscotto/git-map (make-sparse-keymap)
|
||||||
|
"Keymap for Git commands under C-c g.")
|
||||||
|
|
||||||
|
(add-hook 'find-file-hook #'fscotto/enable-magit-keymap)
|
||||||
|
(add-hook 'prog-mode-hook #'fscotto/enable-magit-keymap)
|
||||||
|
(add-hook 'conf-mode-hook #'fscotto/enable-magit-keymap)
|
||||||
|
|
||||||
|
;; autoload: il tasto carica magit
|
||||||
|
(autoload 'magit-status "magit" nil t)
|
||||||
|
(autoload 'magit-branch "magit" nil t)
|
||||||
|
(autoload 'magit-commit "magit" nil t)
|
||||||
|
(autoload 'magit-push "magit" nil t)
|
||||||
|
(autoload 'magit-fetch "magit" nil t)
|
||||||
|
|
||||||
|
;; keybinding (sempre definite nella mappa)
|
||||||
|
(define-key fscotto/git-map (kbd "s") #'magit-status)
|
||||||
|
(define-key fscotto/git-map (kbd "b") #'magit-branch)
|
||||||
|
(define-key fscotto/git-map (kbd "c") #'magit-commit)
|
||||||
|
(define-key fscotto/git-map (kbd "p") #'magit-push)
|
||||||
|
(define-key fscotto/git-map (kbd "f") #'magit-fetch)
|
||||||
|
|
||||||
|
;;;; Open / Tools
|
||||||
|
(defvar fscotto/open (make-sparse-keymap))
|
||||||
|
(define-key fscotto/leader-map (kbd "o") fscotto/open)
|
||||||
|
|
||||||
|
;; -------- vterm --------
|
||||||
|
(autoload 'vterm "vterm" nil t)
|
||||||
|
(define-key fscotto/open (kbd "T") #'vterm)
|
||||||
|
|
||||||
|
(with-eval-after-load 'vterm
|
||||||
|
(define-key vterm-mode-map (kbd "C-c C-t") #'vterm-copy-mode))
|
||||||
|
|
||||||
|
;; -------- mu4e --------
|
||||||
|
(autoload 'mu4e "mu4e" nil t)
|
||||||
|
(define-key fscotto/open (kbd "m") #'mu4e)
|
||||||
|
|
||||||
|
;; -------- elfeed --------
|
||||||
|
(autoload 'elfeed "elfeed" nil t)
|
||||||
|
(define-key fscotto/open (kbd "f") #'elfeed)
|
||||||
|
|
||||||
|
;;;; Elfeed mode maps
|
||||||
|
(with-eval-after-load 'elfeed
|
||||||
|
(define-key elfeed-search-mode-map (kbd "w") #'elfeed-search-yank)
|
||||||
|
(define-key elfeed-search-mode-map (kbd "R") #'elfeed-update)
|
||||||
|
(define-key elfeed-search-mode-map (kbd "q") #'elfeed-kill-buffer)
|
||||||
|
|
||||||
|
(define-key elfeed-show-mode-map (kbd "S") #'elfeed-show-new-live-search)
|
||||||
|
(define-key elfeed-show-mode-map (kbd "f") #'elfeed-show-fetch-full-text)
|
||||||
|
(define-key elfeed-show-mode-map (kbd "w") #'elfeed-show-yank))
|
||||||
|
|
||||||
|
;;;; hl-todo
|
||||||
|
(with-eval-after-load 'hl-todo
|
||||||
|
(define-key hl-todo-mode-map (kbd "C-t p") #'hl-todo-previous)
|
||||||
|
(define-key hl-todo-mode-map (kbd "C-t n") #'hl-todo-next)
|
||||||
|
(define-key hl-todo-mode-map (kbd "C-t o") #'hl-todo-occur)
|
||||||
|
(define-key hl-todo-mode-map (kbd "C-t i") #'hl-todo-insert))
|
||||||
|
|
||||||
|
;; Projectile keybindings
|
||||||
|
(define-key fscotto/leader-map (kbd "p") 'projectile-command-map)
|
||||||
|
|
||||||
|
(with-eval-after-load 'projectile
|
||||||
|
(define-key projectile-command-map (kbd "v") #'fscotto/project-vterm)
|
||||||
|
(define-key projectile-command-map (kbd "g") #'fscotto/project-magit-status))
|
||||||
|
|
||||||
|
;;;; LSP
|
||||||
|
(defvar fscotto/lsp-map (make-sparse-keymap))
|
||||||
|
|
||||||
|
(autoload 'lsp-find-definition "lsp-mode" nil t)
|
||||||
|
(autoload 'lsp-find-type-definition "lsp-mode" nil t)
|
||||||
|
(autoload 'lsp-find-implementation "lsp-mode" nil t)
|
||||||
|
(autoload 'lsp-execute-code-action "lsp-mode" nil t)
|
||||||
|
(autoload 'lsp-rename "lsp-mode" nil t)
|
||||||
|
(autoload 'lsp-format-buffer "lsp-mode" nil t)
|
||||||
|
(autoload 'lsp-restart-workspace "lsp-mode" nil t)
|
||||||
|
|
||||||
|
(autoload 'consult-lsp-symbols "consult-lsp" nil t)
|
||||||
|
(autoload 'consult-lsp-diagnostics "consult-lsp" nil t)
|
||||||
|
|
||||||
|
(define-key fscotto/lsp-map (kbd "s") #'consult-lsp-symbols)
|
||||||
|
(define-key fscotto/lsp-map (kbd "e") #'consult-lsp-diagnostics)
|
||||||
|
(define-key fscotto/lsp-map (kbd "d") #'lsp-find-definition)
|
||||||
|
(define-key fscotto/lsp-map (kbd "D") #'lsp-find-type-definition)
|
||||||
|
(define-key fscotto/lsp-map (kbd "i") #'lsp-find-implementation)
|
||||||
|
(define-key fscotto/lsp-map (kbd "a") #'lsp-execute-code-action)
|
||||||
|
(define-key fscotto/lsp-map (kbd "r") #'lsp-rename)
|
||||||
|
(define-key fscotto/lsp-map (kbd "f") #'lsp-format-buffer)
|
||||||
|
(define-key fscotto/lsp-map (kbd "R") #'lsp-restart-workspace)
|
||||||
|
|
||||||
|
(defun fscotto/enable-lsp-keymap ()
|
||||||
|
"Enable LSP keybindings if LSP is active in the current buffer."
|
||||||
|
(when (and (bound-and-true-p lsp-mode)
|
||||||
|
(lsp-workspaces))
|
||||||
|
(local-set-key (kbd "C-c l") fscotto/lsp-map)))
|
||||||
|
|
||||||
|
(add-hook 'lsp-mode-hook #'fscotto/enable-lsp-keymap)
|
||||||
|
(add-hook 'lsp-after-initialize-hook #'fscotto/enable-lsp-keymap)
|
||||||
|
(add-hook 'lsp-after-open-hook #'fscotto/enable-lsp-keymap)
|
||||||
|
|
||||||
|
;;;; DAP
|
||||||
|
(defvar fscotto/dap-map (make-sparse-keymap)
|
||||||
|
"Keymap for DAP commands under C-c d.")
|
||||||
|
|
||||||
|
(autoload 'dap-debug "dap-mode" nil t)
|
||||||
|
(autoload 'dap-breakpoint-toggle "dap-mode" nil t)
|
||||||
|
(autoload 'dap-continue "dap-mode" nil t)
|
||||||
|
(autoload 'dap-next "dap-mode" nil t)
|
||||||
|
(autoload 'dap-step-in "dap-mode" nil t)
|
||||||
|
(autoload 'dap-step-out "dap-mode" nil t)
|
||||||
|
(autoload 'dap-restart-frame "dap-mode" nil t)
|
||||||
|
(autoload 'dap-disconnect "dap-mode" nil t)
|
||||||
|
|
||||||
|
(define-key fscotto/dap-map (kbd "d") #'dap-debug)
|
||||||
|
(define-key fscotto/dap-map (kbd "b") #'dap-breakpoint-toggle)
|
||||||
|
(define-key fscotto/dap-map (kbd "c") #'dap-continue)
|
||||||
|
(define-key fscotto/dap-map (kbd "n") #'dap-next)
|
||||||
|
(define-key fscotto/dap-map (kbd "i") #'dap-step-in)
|
||||||
|
(define-key fscotto/dap-map (kbd "o") #'dap-step-out)
|
||||||
|
(define-key fscotto/dap-map (kbd "r") #'dap-restart-frame)
|
||||||
|
(define-key fscotto/dap-map (kbd "q") #'dap-disconnect)
|
||||||
|
|
||||||
|
(defun fscotto/enable-dap-keymap ()
|
||||||
|
"Enable DAP keybindings if dap-mode is active in the current buffer."
|
||||||
|
(when (bound-and-true-p dap-mode)
|
||||||
|
(local-set-key (kbd "C-c d") fscotto/dap-map)))
|
||||||
|
|
||||||
|
(add-hook 'dap-mode-hook #'fscotto/enable-dap-keymap)
|
||||||
|
(add-hook 'dap-session-created-hook #'fscotto/enable-dap-keymap)
|
||||||
|
(add-hook 'dap-terminated-hook #'fscotto/enable-dap-keymap)
|
||||||
|
|
||||||
|
;;;; Go
|
||||||
|
|
||||||
|
(with-eval-after-load 'go-ts-mode
|
||||||
|
(define-key go-ts-mode-map (kbd "C-c m t") #'fscotto/go-mod-tidy)
|
||||||
|
(define-key go-ts-mode-map (kbd "C-c m d") #'fscotto/go-mod-download)
|
||||||
|
(define-key go-ts-mode-map (kbd "C-c t p") #'fscotto/go-test-package)
|
||||||
|
(define-key go-ts-mode-map (kbd "C-c t a") #'fscotto/go-test-module)
|
||||||
|
(define-key go-ts-mode-map (kbd "C-c t t") #'fscotto/go-test-current-test)
|
||||||
|
(define-key go-ts-mode-map (kbd "C-c d t") #'dap-debug))
|
||||||
|
|
||||||
|
(provide 'core/keybindings)
|
||||||
|
|
||||||
|
;;; keybindings.el ends here
|
||||||
|
|||||||
@@ -63,5 +63,7 @@
|
|||||||
:defer t)
|
:defer t)
|
||||||
|
|
||||||
(use-package ibuffer
|
(use-package ibuffer
|
||||||
:ensure t
|
:ensure t)
|
||||||
:bind (:map global-map ("C-x C-b" . ibuffer)))
|
|
||||||
|
(provide 'ui)
|
||||||
|
;;; ui.el ends here
|
||||||
|
|||||||
@@ -4,9 +4,7 @@
|
|||||||
:ensure nil
|
:ensure nil
|
||||||
;; :load-path "/usr/share/emacs/site-lisp/mu4e/"
|
;; :load-path "/usr/share/emacs/site-lisp/mu4e/"
|
||||||
:defer 20 ; Wait until 20 seconds after startup
|
:defer 20 ; Wait until 20 seconds after startup
|
||||||
:bind (:map global-map ("C-c o m" . mu4e))
|
|
||||||
:config
|
:config
|
||||||
|
|
||||||
;; This is set to 't' to avoid mail syncing issues when using mbsync
|
;; This is set to 't' to avoid mail syncing issues when using mbsync
|
||||||
(setq mu4e-change-filenames-when-moving t)
|
(setq mu4e-change-filenames-when-moving t)
|
||||||
|
|
||||||
|
|||||||
@@ -11,18 +11,6 @@
|
|||||||
(elfeed-show-truncate-long-urls t)
|
(elfeed-show-truncate-long-urls t)
|
||||||
(elfeed-sort-order 'descending)
|
(elfeed-sort-order 'descending)
|
||||||
(elfeed-search-filter "+unread")
|
(elfeed-search-filter "+unread")
|
||||||
:bind
|
|
||||||
("C-c o f" . fscotto/elfeed-load-db-and-open)
|
|
||||||
(:map elfeed-search-mode-map
|
|
||||||
("w" . elfeed-search-yank)
|
|
||||||
("R" . elfeed-update)
|
|
||||||
("q" . elfeed-kill-buffer))
|
|
||||||
(:map elfeed-show-mode-map
|
|
||||||
("S" . elfeed-show-new-live-search) ; moved to free up 's'
|
|
||||||
("c" . (lambda () (interactive) (org-capture nil "capture")))
|
|
||||||
("e" . email-elfeed-entry)
|
|
||||||
("f" . elfeed-show-fetch-full-text)
|
|
||||||
("w" . elfeed-show-yank))
|
|
||||||
:hook
|
:hook
|
||||||
(elfeed-show-mode . visual-line-mode))
|
(elfeed-show-mode . visual-line-mode))
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
;;; terminal.el -*-
|
;;; terminal.el -*-
|
||||||
|
|
||||||
(use-package vterm
|
(use-package vterm
|
||||||
:ensure t
|
:ensure t)
|
||||||
:bind (:map global-map
|
|
||||||
("C-c o T" . vterm)
|
|
||||||
("C-c C-t" . vterm-copy-mode)))
|
|
||||||
|
|||||||
@@ -10,3 +10,7 @@
|
|||||||
(setq magit-repository-directories
|
(setq magit-repository-directories
|
||||||
'(("~/Projects" . 2)
|
'(("~/Projects" . 2)
|
||||||
("~/Work" . 2))))
|
("~/Work" . 2))))
|
||||||
|
|
||||||
|
(provide 'vcs)
|
||||||
|
|
||||||
|
;;; vcs.el ends here
|
||||||
|
|||||||
@@ -11,11 +11,6 @@
|
|||||||
("GOTCHA" . "#eba0ac")
|
("GOTCHA" . "#eba0ac")
|
||||||
("STUB" . "#89b4fa")))
|
("STUB" . "#89b4fa")))
|
||||||
|
|
||||||
(keymap-set hl-todo-mode-map "C-t p" #'hl-todo-previous)
|
|
||||||
(keymap-set hl-todo-mode-map "C-t n" #'hl-todo-next)
|
|
||||||
(keymap-set hl-todo-mode-map "C-t o" #'hl-todo-occur)
|
|
||||||
(keymap-set hl-todo-mode-map "C-t i" #'hl-todo-insert)
|
|
||||||
|
|
||||||
(use-package ibuffer-tramp
|
(use-package ibuffer-tramp
|
||||||
:ensure t)
|
:ensure t)
|
||||||
|
|
||||||
|
|||||||
@@ -24,13 +24,3 @@
|
|||||||
;; For Python
|
;; For Python
|
||||||
(require 'dap-python)
|
(require 'dap-python)
|
||||||
(setq dap-python-debugger 'debugpy))
|
(setq dap-python-debugger 'debugpy))
|
||||||
|
|
||||||
(with-eval-after-load 'dap-mode
|
|
||||||
(global-set-key (kbd "C-c d d") #'dap-debug)
|
|
||||||
(global-set-key (kbd "C-c d b") #'dap-breakpoint-toggle)
|
|
||||||
(global-set-key (kbd "<f9>") #'dap-continue)
|
|
||||||
(global-set-key (kbd "<f6>") #'dap-next)
|
|
||||||
(global-set-key (kbd "<f5>") #'dap-step-in)
|
|
||||||
(global-set-key (kbd "<f7>") #'dap-step-out)
|
|
||||||
(global-set-key (kbd "C-c d r") #'dap-restart-frame)
|
|
||||||
(global-set-key (kbd "C-c d q") #'dap-disconnect))
|
|
||||||
|
|||||||
@@ -21,9 +21,8 @@
|
|||||||
(use-package lsp-mode
|
(use-package lsp-mode
|
||||||
:ensure t
|
:ensure t
|
||||||
:commands (lsp lsp-deferred)
|
:commands (lsp lsp-deferred)
|
||||||
:init
|
;; :init
|
||||||
;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
|
;; (setq lsp-keymap-prefix "C-c l")
|
||||||
(setq lsp-keymap-prefix "C-c l")
|
|
||||||
:hook
|
:hook
|
||||||
((c-mode
|
((c-mode
|
||||||
c-ts-mode
|
c-ts-mode
|
||||||
@@ -78,25 +77,6 @@
|
|||||||
(consult-lsp-symbols
|
(consult-lsp-symbols
|
||||||
consult-lsp-diagnostics))
|
consult-lsp-diagnostics))
|
||||||
|
|
||||||
(with-eval-after-load 'lsp-mode
|
(provide 'lsp)
|
||||||
;; Attach bash-language-server when open a shell scripts
|
|
||||||
(add-hook 'sh-mode-hook #'lsp)
|
|
||||||
|
|
||||||
;; Symbols
|
;;; lsp.el ends here
|
||||||
(global-set-key (kbd "C-c l s") #'consult-lsp-symbols)
|
|
||||||
|
|
||||||
;; Diagnostics
|
|
||||||
(global-set-key (kbd "C-c l e") #'consult-lsp-diagnostics)
|
|
||||||
|
|
||||||
;; Navigation (LSP core)
|
|
||||||
(global-set-key (kbd "C-c l d") #'lsp-find-definition)
|
|
||||||
(global-set-key (kbd "C-c l D") #'lsp-find-type-definition)
|
|
||||||
(global-set-key (kbd "C-c l i") #'lsp-find-implementation)
|
|
||||||
|
|
||||||
;; Actions
|
|
||||||
(global-set-key (kbd "C-c l a") #'lsp-execute-code-action)
|
|
||||||
(global-set-key (kbd "C-c l r") #'lsp-rename)
|
|
||||||
(global-set-key (kbd "C-c l f") #'lsp-format-buffer)
|
|
||||||
|
|
||||||
;; Control
|
|
||||||
(global-set-key (kbd "C-c l R") #'lsp-restart-workspace))
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
;;; project.el - lexical-binding *-*
|
||||||
|
|
||||||
(use-package projectile
|
(use-package projectile
|
||||||
:ensure t
|
:ensure t
|
||||||
:defer 1
|
:defer 1
|
||||||
@@ -18,12 +20,6 @@
|
|||||||
;; Enable globally
|
;; Enable globally
|
||||||
(projectile-mode 1))
|
(projectile-mode 1))
|
||||||
|
|
||||||
;; Projectile keybindings (Doom-style)
|
(provide 'project)
|
||||||
(with-eval-after-load 'projectile
|
|
||||||
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map))
|
|
||||||
|
|
||||||
(with-eval-after-load 'projectile
|
;;; project.el ends here
|
||||||
(define-key projectile-command-map (kbd "v") #'fscotto/project-vterm))
|
|
||||||
|
|
||||||
(with-eval-after-load 'projectile
|
|
||||||
(define-key projectile-command-map (kbd "g") #'fscotto/project-magit-status))
|
|
||||||
|
|||||||
Reference in New Issue
Block a user