Move programming related packages to their own section

This commit is contained in:
Gergely Polonkai 2023-10-20 10:49:26 +02:00
parent b66589eb83
commit d2c81b01f5
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4

View File

@ -2649,6 +2649,22 @@ Intended as a value for `bug-referecne-url-format'."
(python-mode . highlight-indentation-mode)) (python-mode . highlight-indentation-mode))
#+end_src #+end_src
** ~flycheck~
#+begin_src emacs-lisp
(use-package flycheck
:config
(global-flycheck-mode)
:custom
(flycheck-python-pylint-executable "python3"))
#+end_src
** ~flycheck-pkg-config~ to aid FlyCheck using ~pkg-config~
#+begin_src emacs-lisp
(use-package flycheck-pkg-config)
#+end_src
* Utilities * Utilities
** ~kubernetes~, a kubernetes dashboard ** ~kubernetes~, a kubernetes dashboard
@ -2709,6 +2725,307 @@ I dont always use the package menu, but when i do, i want to do it in style
(use-package tidal) (use-package tidal)
#+end_src #+end_src
* Programming-language specific packages
** Python
*** Set up pretty symbols
Because they are fancy.
#+begin_src emacs-lisp
(add-hook 'python-mode-hook
(lambda ()
(add-to-list 'prettify-symbols-alist
'("not in" . ?∉))
(add-to-list 'prettify-symbols-alist
'("in" . ?∈))
(add-to-list 'prettify-symbols-alist
'("def" . ?ƒ))
(add-to-list 'prettify-symbols-alist
'("is not" . ?≭))
(add-to-list 'prettify-symbols-alist
'("is" . ?≍))
))
#+end_src
*** ~poetry~
#+begin_src emacs-lisp
(use-package poetry
:config
(poetry-tracking-mode)
(remove-hook 'post-command-hook 'poetry-track-virtualenv)
:hook
(poetry-tracking-mode . (lambda () (remove-hook 'post-command-hook 'poetry-track-virtualenv)))
(python-mode . poetry-track-virtualenv)
(projectile-after-switch-project-hook . poetry-track-virtualenv)
:bind (:map gpolonkai/pers-map
("pp" . poetry)))
#+end_src
** C
Because thats still my favourite language.
*** Set up my indentation style
#+begin_src emacs-lisp
(defconst my-c-style
'((c-tab-always-indent . t)
(c-comment-only-line-offset . 4)
(c-hanging-braces-alist . ((substatement-open after)
(brace-list-open)))
(c-hanging-colons-alist . ((member-init-intro before)
(inher-intro)
(case-label after)
(label after)
(access-label after)))
(c-cleanup-list . (scope-operator
empty-defun-braces
defun-close-semi))
(c-offsets-alist . ((arglist-close . +)
(arglist-intro . +)
(substatement-open . 0)
(case-label . 4)
(block-open . 0)
(knr-argdecl-intro . -)
(comment-intro . 0)
(member-init-intro . ++)))
(c-echo-syntactic-information-p . t))
"My C Programming Style.")
(c-add-style "PERSONAL" my-c-style)
#+end_src
*** Set indentation levels to the same as the tab width
#+begin_src emacs-lisp :tangle no
(defvaralias 'c-basic-offset 'tab-width)
(defvaralias 'cperl-indent-level 'tab-width)
#+end_src
*** Some common initialisation for C mode
#+begin_src emacs-lisp
(add-hook 'c-mode-common-hook
(lambda ()
(local-set-key (kbd "C-c o") 'ff-find-other-file)
(c-set-style "PERSONAL")
(customize-set-variable 'c-basic-offset 4)
(customize-set-variable 'tab-width 4)
(customize-set-variable 'indent-tabs-mode nil)
(c-toggle-auto-newline 1)))
(add-hook 'c-initialization-hook
(lambda ()
(define-key c-mode-base-map (kbd "C-m") 'c-context-line-break)))
#+end_src
** Web
*** ~web-mode~
#+begin_src emacs-lisp
(use-package web-mode
:mode "\\.html?\\'"
:custom
(web-mode-enable-auto-indentation nil)
(web-mode-enable-engine-detection t))
#+end_src
*** ~emmet-mode~ for easier HTML/CSS writing
#+begin_src emacs-lisp
(use-package emmet-mode
:custom
(emmet-self-closing-tag-style "")
:hook
(web-mode . emmet-mode)
(css-mode . emmet-mode))
#+end_src
*** ~enlive~, to query HTML tags by CSS selectors
#+begin_src emacs-lisp
(use-package enlive)
#+end_src
** ~json-mode~
#+begin_src emacs-lisp
(use-package json-mode
:mode "\\.json\\'")
#+end_src
** ~yaml-mode~
#+begin_src emacs-lisp
(use-package yaml-mode
:mode (("\\.yml\\'" . yaml-mode)
("\\.yaml\\'" . yaml-mode))
:init
(add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode)))
#+end_src
** ~dockerfile-mode~
#+begin_src emacs-lisp
(use-package dockerfile-mode)
#+end_src
** ~systemd~, for editing systemd unit files
#+begin_src emacs-lisp
(use-package systemd)
#+end_src
** ~terraform-mode~
#+begin_src emacs-lisp
(use-package terraform-mode
:mode "\\.tf\\'")
#+end_src
** ~bats-mode~
#+begin_src emacs-lisp
(use-package bats-mode
:mode "\\.bats\\'")
#+end_src
** ~fish-mode~
#+begin_src emacs-lisp
(use-package fish-mode
:hook
(fish-mode . (lambda () (add-hook 'before-save-hook 'fish_indent-before-save))))
#+end_src
** ~gitlab-ci-mode~ and ~gitlab-ci-mode-flycheck~
#+begin_src emacs-lisp
(use-package gitlab-ci-mode
:mode "\\.gitlab-ci.yml\\'")
(use-package gitlab-ci-mode-flycheck
:after flycheck gitlab-ci-mode
:init
(gitlab-ci-mode-flycheck-enable))
#+end_src
** ~csv-mode~
#+begin_src emacs-lisp
(use-package csv-mode
:mode "\\.csv\\'")
#+end_src
** ~rust-mode~
#+begin_src emacs-lisp
(use-package rust-mode
:mode "\\.rs\\'")
(use-package cargo)
(use-package flycheck-rust)
#+end_src
** ~arduino-mode~
#+begin_src emacs-lisp
(use-package arduino-mode
:mode "\\.ino\\'")
#+end_src
** ~nginx-mode~
#+begin_src emacs-lisp
(use-package nginx-mode)
#+end_src
** ~js2-mode~
#+begin_src emacs-lisp
(use-package js2-mode
:pin melpa-stable
:mode "\\.js\\'")
#+end_src
** ~typescript-mode~
#+begin_src emacs-lisp
(use-package typescript-mode
:mode "\\.ts\\'")
#+end_src
** ~less-css-mode~
#+begin_src emacs-lisp
(use-package less-css-mode
:mode "\\.less\\'")
#+end_src
** ~sass-mode~
#+begin_src emacs-lisp
(use-package sass-mode
:mode "\\.sass\\'")
#+end_src
** ~vue-html-mode~
#+begin_src emacs-lisp
(use-package vue-html-mode
:mode "\\.vue\\'")
#+end_src
** ~jinja2-mode~
#+begin_src emacs-lisp
(use-package jinja2-mode
:mode "\\.j2\\'")
#+end_src
** ~markdown-mode~
#+begin_src emacs-lisp
(use-package markdown-mode
:mode (("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode)))
#+end_src
** ~vala-mode~
#+begin_src emacs-lisp
(use-package vala-mode
:mode "\\.vala\\'")
#+end_src
** ~po-mode~
#+begin_src emacs-lisp
(use-package po-mode
:ensure nil
:mode "\\.po\\'")
#+end_src
** ~meson-mode~
#+begin_src emacs-lisp
(use-package meson-mode
:mode "\\.meson\\'")
#+end_src
** ~ggtags~, an interfaco for GNU Globals
#+begin_src emacs-lisp
(defun gpolonkai/cond-enable-ggtags-mode ()
(when (derived-mode-p 'c-mode 'c++-mode 'java-mode)
(ggtags-mode t)))
(use-package ggtags
:hook
(c-mode-common . gpolonkai/cond-enable-ggtags-mode))
#+end_src
* Custom commands and functions * Custom commands and functions
** Frame manipulation ** Frame manipulation
@ -2745,332 +3062,6 @@ To temporarily hide the mode line.
"Use M-x hidden-mode-line-mode to make mode-line appear.")))) "Use M-x hidden-mode-line-mode to make mode-line appear."))))
#+END_SRC #+END_SRC
* ~use-package~ packages
** GNU Globals
#+BEGIN_SRC emacs-lisp
(defun gpolonkai/cond-enable-ggtags-mode ()
(when (derived-mode-p 'c-mode 'c++-mode 'java-mode)
(ggtags-mode t)))
(use-package ggtags
:hook
(c-mode-common . gpolonkai/cond-enable-ggtags-mode))
#+END_SRC
* Python related setup and ~use-package~ calls
Because, well, thats my job now. Of course it gets a dedicated section.
** Set up pretty symbols for Python
Because they are fancy.
- not: ¬
- in: ∈
- def: ƒ
Maybe add ∉ for ~not in~ later, if possible.
#+BEGIN_SRC emacs-lisp
(add-hook 'python-mode-hook
(lambda ()
(add-to-list 'prettify-symbols-alist
'("not in" . ?∉))
(add-to-list 'prettify-symbols-alist
'("in" . ?∈))
(add-to-list 'prettify-symbols-alist
'("def" . ?ƒ))
(add-to-list 'prettify-symbols-alist
'("is not" . ?≭))
(add-to-list 'prettify-symbols-alist
'("is" . ?≍))
))
#+END_SRC
** Poetry
Because its also great.
#+BEGIN_SRC emacs-lisp
(use-package poetry
:config
(poetry-tracking-mode)
(remove-hook 'post-command-hook 'poetry-track-virtualenv)
:hook
(poetry-tracking-mode . (lambda () (remove-hook 'post-command-hook 'poetry-track-virtualenv)))
(python-mode . poetry-track-virtualenv)
(projectile-after-switch-project-hook . poetry-track-virtualenv))
#+END_SRC
* C mode
Because thats still my favourite language.
** Set up my own C style
#+BEGIN_SRC emacs-lisp
(defconst my-c-style
'((c-tab-always-indent . t)
(c-comment-only-line-offset . 4)
(c-hanging-braces-alist . ((substatement-open after)
(brace-list-open)))
(c-hanging-colons-alist . ((member-init-intro before)
(inher-intro)
(case-label after)
(label after)
(access-label after)))
(c-cleanup-list . (scope-operator
empty-defun-braces
defun-close-semi))
(c-offsets-alist . ((arglist-close . +)
(arglist-intro . +)
(substatement-open . 0)
(case-label . 4)
(block-open . 0)
(knr-argdecl-intro . -)
(comment-intro . 0)
(member-init-intro . ++)))
(c-echo-syntactic-information-p . t))
"My C Programming Style.")
(c-add-style "PERSONAL" my-c-style)
#+END_SRC
** Some common initialisation for C mode
#+BEGIN_SRC emacs-lisp
(add-hook 'c-mode-common-hook
(lambda ()
(local-set-key (kbd "C-c o") 'ff-find-other-file)
(c-set-style "PERSONAL")
(customize-set-variable 'c-basic-offset 4)
(customize-set-variable 'tab-width 4)
(customize-set-variable 'indent-tabs-mode nil)
(c-toggle-auto-newline 1)))
(add-hook 'c-initialization-hook
(lambda ()
(define-key c-mode-base-map (kbd "C-m") 'c-context-line-break)))
#+END_SRC
** Set indentation levels to the same as the tab width
#+BEGIN_SRC emacs-lisp :tangle no
(defvaralias 'c-basic-offset 'tab-width)
(defvaralias 'cperl-indent-level 'tab-width)
#+END_SRC
* Web development
** Web mode
#+BEGIN_SRC emacs-lisp
(use-package web-mode
:mode "\\.html?\\'"
:custom
(web-mode-enable-auto-indentation nil)
(web-mode-enable-engine-detection t))
#+END_SRC
** Emmet mode
#+BEGIN_SRC emacs-lisp
(use-package emmet-mode
:custom
(emmet-self-closing-tag-style "")
:hook
(web-mode . emmet-mode)
(css-mode . emmet-mode))
#+END_SRC
** Query HTML tags by CSS selectors
#+BEGIN_SRC emacs-lisp
(use-package enlive)
#+END_SRC
* FlyCheck
#+BEGIN_SRC emacs-lisp
(use-package flycheck
:config
(global-flycheck-mode)
:custom
(flycheck-python-pylint-executable "python3"))
#+END_SRC
** FlyCheck for pkg-config files
#+BEGIN_SRC emacs-lisp
(use-package flycheck-pkg-config)
#+END_SRC
* Mode specific ~use-package~ calls
** JavaScript
#+BEGIN_SRC emacs-lisp
(use-package js2-mode
:pin melpa-stable
:mode "\\.js\\'")
#+END_SRC
** Jinja templates
#+begin_src emacs-lisp
(use-package jinja2-mode
:mode "\\.j2\\'")
#+end_src
** TypeScript
#+BEGIN_SRC emacs-lisp
(use-package typescript-mode
:mode "\\.ts\\'")
#+END_SRC
** JSON
#+BEGIN_SRC emacs-lisp
(use-package json-mode
:mode "\\.json\\'")
#+END_SRC
** YAML
#+BEGIN_SRC emacs-lisp
(use-package yaml-mode
:mode (("\\.yml\\'" . yaml-mode)
("\\.yaml\\'" . yaml-mode))
:init
(add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode)))
#+END_SRC
** Markdown
#+BEGIN_SRC emacs-lisp
(use-package markdown-mode
:mode (("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode)))
#+END_SRC
** Less
#+BEGIN_SRC emacs-lisp
(use-package less-css-mode
:mode "\\.less\\'")
#+END_SRC
** Sass
#+BEGIN_SRC emacs-lisp
(use-package sass-mode
:mode "\\.sass\\'")
#+END_SRC
** Vala
#+BEGIN_SRC emacs-lisp
(use-package vala-mode
:mode "\\.vala\\'")
#+END_SRC
** Dockerfile
#+BEGIN_SRC emacs-lisp
(use-package dockerfile-mode)
#+END_SRC
** ~po-mode~
#+BEGIN_SRC emacs-lisp
(use-package po-mode
:ensure nil
:mode "\\.po\\'")
#+END_SRC
** For editing CSV files
#+BEGIN_SRC emacs-lisp
(use-package csv-mode
:mode "\\.csv\\'")
#+END_SRC
** Meson build system
#+BEGIN_SRC emacs-lisp
(use-package meson-mode
:mode "\\.meson\\'")
#+END_SRC
** Gitlab-CI
#+BEGIN_SRC emacs-lisp
(use-package gitlab-ci-mode
:mode "\\.gitlab-ci.yml\\'")
(use-package gitlab-ci-mode-flycheck
:after flycheck gitlab-ci-mode
:init
(gitlab-ci-mode-flycheck-enable))
#+END_SRC
** Arduino
#+BEGIN_SRC emacs-lisp
(use-package arduino-mode
:mode "\\.ino\\'")
#+END_SRC
** Vue templates
#+BEGIN_SRC emacs-lisp
(use-package vue-html-mode
:mode "\\.vue\\'")
#+END_SRC
** Rust
#+BEGIN_SRC emacs-lisp
(use-package rust-mode
:mode "\\.rs\\'")
(use-package cargo)
(use-package flycheck-rust)
#+END_SRC
** Fish shell
#+BEGIN_SRC emacs-lisp
(use-package fish-mode
:hook
(fish-mode . (lambda () (add-hook 'before-save-hook 'fish_indent-before-save))))
#+END_SRC
** Bats, for testing shell scripts
#+begin_src emacs-lisp
(use-package bats-mode
:mode "\\.bats\\'")
#+end_src
** Terraform
#+begin_src emacs-lisp
(use-package terraform-mode
:mode "\\.tf\\'")
#+end_src
** Systemd editing
#+begin_src emacs-lisp
(use-package systemd)
#+end_src
** NGinX
#+begin_src emacs-lisp
(use-package nginx-mode)
#+end_src
* Last, but not least, key bindings! * Last, but not least, key bindings!
** The actual key bindings ** The actual key bindings