Skip to content

Latest commit

 

History

History
123 lines (100 loc) · 3.59 KB

mos-emacs-howto.org

File metadata and controls

123 lines (100 loc) · 3.59 KB

mos emacs howtos

mo-emacs-config

Ok, so this is my emacs config wiki

Keybindings/Prefix keys

I use a us keyboard layout, so C-= is nicely reachable and a suitable prefix key.

On a terminal using putty, sadly, C-= doesn’t work, so I use <f12> instead. <f5> is free, too. <f9> I use for “compiling” or similar stuff. (that was the binding in turbo-c and still seems to be used by some IDEs).

Some of the bindings

(global-set-key (kbd "C-= d") 'find-name-dired)
(global-set-key (kbd "C-= l") 'find-lisp-find-dired)
(global-set-key (kbd "C-= g") 'find-grep-dired)  # or find-grep.

recent-files

;; recent files
(recentf-mode)
(global-set-key (kbd "C-= f") 'recentf-open-files)

emacs server

start a server if there isn’t already one running:

   (require 'server)
	(unless (and (fboundp #'server-running-p) (server-running-p))
		(server-start))

my multiple cursors shortcuts

I think MCs are cool but I don’t use them much. I neither pretend these are the best bindings nor do I claim completeness.

If you’re in a terminal check what key is sent by the key combination. I think it was C-^ instead of C-". Adjust accordingly.

;; multiple cursors
(global-set-key (kbd "C-\" a") 'mc/mark-all-like-this-dwim)
(global-set-key (kbd "C-\" l") 'mc/mark-next-lines)
(global-set-key (kbd "C-\" m") 'mc/mark-next-like-this)
(global-set-key (kbd "C-\" s") 'mc/mark-next-like-this-symbol)
(global-set-key (kbd "C-\" w") 'mc/mark-next-like-this-word)
(global-set-key (kbd "C-\" r") 'mc/mark-all-in-region)
(global-set-key (kbd "C-\" R") 'mc/mark-all-in-region-regexp)

flymake

json (new version)

see: https://github.com/mokrates/json-simple-flymake

toml

(load "~/.emacs.d/tomlcheck.el")
(add-hook 'conf-toml-mode-hook 'flymake-tomlcheck-setup)
(add-hook 'conf-toml-mode-hook 'flymake-mode)
(add-hook 'conf-toml-mode-hook 'trailing-whitespace-mode)

;; if you want to add this automatically to .conf.j2 files
(add-to-list 'auto-mode-alist '("\\.conf\\.j2\\'" . conf-toml-mode))

tomlcheck.el

yaml

(load "~/.emacs.d/flymake-yamllint.el")
(add-hook 'yaml-mode-hook 'flymake-yamllint-setup)
(add-hook 'yaml-mode-hook 'flymake-mode)
(add-hook 'yaml-mode-hook 'trailing-whitespace-mode)

https://github.com/shaohme/flymake-yamllint

python

see https://github.com/mokrates/flymaker

ide stuff, languages

For flymaker, see flymake

python

;;;;;;;; python
(require 'auto-complete)
(require 'jedi)
;; these seem to be neccessary because of GUI/CUI, idk.
(define-key jedi-mode-map (kbd "C-c <tab>") 'jedi:complete)
(define-key jedi-mode-map (kbd "C-c TAB") 'jedi:complete)
(add-hook 'python-mode-hook 'jedi:setup)

;; don't show this when idle. Don't do anything if I don't ask you!
;; M-" to show info. (how it is shown: defined in customize)
;; this is a monkey patch. may break with a new emacs version (currently working: 28.2)
(defun jedi:get-in-function-call-when-idle () ())
(define-key jedi-mode-map (kbd "M-\"") 'jedi:get-in-function-call)

Golang

;; golang
(add-hook 'go-mode-hook #'eglot-ensure)

show git branch in modeline

ement.el (matrix client)

HOWTOs