Add Projectile, Magit and Yasnippets

main
Sergio Alvariño 3 years ago
parent 0669c6a396
commit 6792e9fe6e

@ -134,7 +134,8 @@ This file:
(global-set-key [C-tab] 'hippie-expand) ; expand (global-set-key [C-tab] 'hippie-expand) ; expand
(global-set-key [C-kp-subtract] 'undo) ; [Undo] (global-set-key [C-kp-subtract] 'undo) ; [Undo]
(global-set-key [C-kp-multiply] 'goto-line) ; goto line ;; (global-set-key [C-kp-multiply] 'goto-line) ; old goto line
(global-set-key [C-kp-multiply] 'consult-goto-line) ; goto line
(global-set-key [C-kp-add] 'toggle-truncate-lines) ; truncate lines (global-set-key [C-kp-add] 'toggle-truncate-lines) ; truncate lines
(global-set-key [C-kp-divide] 'delete-trailing-whitespace) ; delete trailing whitespace (global-set-key [C-kp-divide] 'delete-trailing-whitespace) ; delete trailing whitespace
(global-set-key [C-kp-decimal] 'completion-at-point) ; complete at point (global-set-key [C-kp-decimal] 'completion-at-point) ; complete at point
@ -371,6 +372,19 @@ This file:
#+end_src #+end_src
* Editor Enhancements * Editor Enhancements
** ace-windows
To jump to different windows easily
#+begin_src emacs-lisp
(use-package ace-window
:ensure t
:init
(global-set-key [remap other-window] 'ace-window)
(custom-set-faces
'(aw-leading-char-face
((t (:inherit ace-jump-face-foreground :height 3.0)))))
)
#+end_src
** ripgrep ** ripgrep
[[https://github.com/dajva/rg.el][rg repo]] [[https://github.com/dajva/rg.el][rg repo]]
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -395,6 +409,7 @@ This file:
** Hydra ** Hydra
[[https://github.com/abo-abo/hydra][Hydra repo]] [[https://github.com/abo-abo/hydra][Hydra repo]]
See [[https://readingworldmagazine.com/emacs/2020-02-27-emacs-hydra-set-up-code/][this]] someday
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package hydra) (use-package hydra)
#+end_src #+end_src
@ -442,6 +457,7 @@ This file:
("p" (lambda () (interactive) (forward-line -1)) "up") ("p" (lambda () (interactive) (forward-line -1)) "up")
("g" goto-line "consult-goto-line") ("g" goto-line "consult-goto-line")
("i" consult-imenu "cons-imenu" :column "Header") ("i" consult-imenu "cons-imenu" :column "Header")
("o" consult-org-heading "cons-org-head")
("q" nil "quit") ("q" nil "quit")
) )
) )
@ -467,6 +483,88 @@ This file:
("C-ç" . iedit-mode)) ("C-ç" . iedit-mode))
#+end_src #+end_src
* Project management with projectile
#+begin_src emacs-lisp
(use-package projectile
:config
(projectile-global-mode)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
)
#+end_src
* Git management
All you need for git
- [[https://github.com/magit/magit][magit]] interface to git from emacs (there are a lot of tutos)
- [[https://github.com/emacsorphanage/git-gutter][git-gutter]] See lines changed in buffer edited
- [[https://github.com/emacsmirror/git-timemachine][git-time-machine]] Visit previous git versions of edited buffer
#+begin_src emacs-lisp
;; dirty hack to avoid problem when pushing
(setenv "SSH_AUTH_SOCK" "/run/user/1000/keyring/ssh")
(use-package magit
:init
(progn
(bind-key "C-x g" 'magit-status)
)
)
(setq magit-status-margin
'(t "%Y-%m-%d %H:%M " magit-log-margin-width t 18))
(use-package git-gutter
:init
(global-git-gutter-mode +1)
)
(defhydra hydra-git-gutter (:body-pre (git-gutter-mode 1)
:hint nil)
"
Git gutter:
_j_: next hunk _s_tage hunk _q_uit
_k_: previous hunk _r_evert hunk _Q_uit and deactivate git-gutter
^ ^ _p_opup hunk
_h_: first hunk
_l_: last hunk set start _R_evision
"
("j" git-gutter:next-hunk)
("k" git-gutter:previous-hunk)
("h" (progn (goto-char (point-min))
(git-gutter:next-hunk 1)))
("l" (progn (goto-char (point-min))
(git-gutter:previous-hunk 1)))
("s" git-gutter:stage-hunk)
("r" git-gutter:revert-hunk)
("p" git-gutter:popup-hunk)
("R" git-gutter:set-start-revision)
("q" nil :color blue)
("Q" (progn (git-gutter-mode -1)
;; git-gutter-fringe doesn't seem to
;; clear the markup right away
(sit-for 0.1)
(git-gutter:clear))
:color blue))
(global-set-key (kbd "M-g M-g") 'hydra-git-gutter/body)
(use-package git-timemachine
)
#+end_src
* yasnippet
- [[https://github.com/joaotavora/yasnippet][yasnippet]] (there are many tutorials)
- [[https://github.com/abo-abo/auto-yasnippet][auto-yasnippet]] (disposable snippets)
- [[https://github.com/AndreaCrotti/yasnippet-snippets][yasnippets-snippets]]
Place your own snippets on =~/.cache/emacs/etc/yasnippet/snippets=
#+begin_src emacs-lisp
(use-package yasnippet
:config
:init
(yas-global-mode 1)
)
(use-package auto-yasnippet
)
(use-package yasnippet-snippets
)
#+end_src
* next * next
#+begin_src emacs-lisp #+begin_src emacs-lisp
#+end_src #+end_src

Loading…
Cancel
Save