summaryrefslogtreecommitdiff
path: root/mms-prog.org
blob: 9b45df047ad6e73776a8ade2c9d8fac25df15aa8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#+TITLE: mms Emacs Config - Prog mode
#+AUTHOR: MichaƂ Sapka (https://michal.sapka.me)
#+STARTUP: showall indent logdoneGeneral settings

#+HUGO_BASE_DIR: ~/ghq/vcs.sapka.me/michal-sapka-me/
#+HUGO_WEIGHT: 400 
#+HUGO_SECTION: emacs/config
#+HUGO_CATEGORIES: emacs emacs-config
#+HUGO_MENU :menu "emacs-config" :name "Ruby"
#+HUGO_CUSTOM_FRONT_MATTER: :abstract "My emacs config - Programmming"
#+HUGO_CUSTOM_FRONT_MATTER: :menu-abstract "Programming setup, generic"
#+EXPORT_FILE_NAME: programming

* General 

#+begin_src emacs-lisp
  (global-display-line-numbers-mode) ; By default I want line number everywhere
#+end_src
* Auto-complete

Auto-complete at point is almost all I want from a programmers editor.
Luckily, =corfu= is am /amazing/ package for that

#+begin_src emacs-lisp
  (use-package corfu
    :ensure t
    ;; Optional customizations
    :custom
    ;; (corfu-cycle t)                ;; Enable cycling for `corfu-next/previous'
    (corfu-auto t)                 ;; Enable auto completion
    ;; (corfu-separator ?\s)          ;; Orderless field separator
    ;; (corfu-quit-at-boundary nil)   ;; Never quit at completion boundary
    ;; (corfu-quit-no-match nil)      ;; Never quit, even if there is no match
    ;; (corfu-preview-current nil)    ;; Disable current candidate preview
    ;; (corfu-preselect 'prompt)      ;; Preselect the prompt
    ;; (corfu-on-exact-match nil)     ;; Configure handling of exact matches
    ;; (corfu-scroll-margin 5)        ;; Use scroll margin

    ;; Enable Corfu only for certain modes.
    ;; :hook ((prog-mode . corfu-mode)
    ;;        (shell-mode . corfu-mode)
    ;;        (eshell-mode . corfu-mode))

    ;; Recommended: Enable Corfu globally.  This is recommended since Dabbrev can
    ;; be used globally (M-/).  See also the customization variable
    ;; `global-corfu-modes' to exclude certain modes.
    :init
    (global-corfu-mode))
#+end_src

* Fast navigation

This is not /strictly/ for prog, but quick buffer switch is great.
At a certain point I might move this to general config.
I use =consult= for the as-I-type propositions.

#+begin_src emacs-lisp
  (use-package consult
    :ensure t)
  #+end_src

#+begin_src emacs-lisp
  (with-eval-after-load 'general
  (mms-leader-keys
    "f g" '(lambda () (interactive) (consult-ripgrep)) :wk "Ripgrep"
    "f i" '(lambda () (interactive) (consult-imenu)) :wk "Imenu"
    "f F" '(lambda () (interactive) (consult-recent-file)) :wk "Recent file"
    "f B" '(lambda () (interactive) (consult-bookmark)) :wk "Bookmark"
    "f b" '(lambda () (interactive) (consult-buffer)) :wk "Buffer"
    "f f" '(lambda () (interactive) (consult-find)) :wk "File"
    ))
#+end_src