6.0 KiB
- Intersting learnings
- Elisp
- to research
- backup file location configurable?
- highlight line
- git gutter needed
- what the hell is that footer thing you cannot edit?
C-odoes not open last file, not sure why yet- persistant undo possible?
- helm/ivy - dash?
- gruvbox-theme
- which-key
- magit
- language server protocol
- vim-unimpaired ?
- vim-abolish ?
- ranger/dired-ranger
- devdocs
- installed packages
- considering packages
To get a list of packages type M-x list-packages
Intersting learnings
Help systems
SPC h RET emacs manual
C-h a appropos
C-h l list 300 last keystrokes with description
C-h m docs to major and minor modes activg
C-h k what does a keybinding X do
C-h w which keybinding is active for X
Elisp
Following this Practical Emacs Lisp
Basics
Eval code block with C-c C-c
(+ 547 1)
Result 548
Eval last expression with C-x C-e
Printing with (message …)
(message "Result %S" (+ 547 1))
Result 548
Arithmetic
Singel digit numbers as 2. are integers. Use 2.0 for floats.
(+ 4 5 1) ; 10
(- 9 2) ; 7
(- 9 2 3) ; 4
(* 2 3) ; 6
(* 2 3 2) ; 12
;; integer part of quotient
(/ 7 2) ; 3
;; division
(/ 7 2.0) ; 3.5
;; mod, remainder
(% 7 4) ; 3
;; power; exponential
(expt 2 3) ; 8
;; int to float
(float 3) ; 3.0
(truncate 3.3) ; 3
(floor 3.3) ; 3
(ceiling 3.3) ; 4
(round 3.4) ; 3
Convert string and numbers
(string-to-number "547")
(number-to-string 547)
True and False
nil is false
anything else is true,
nil is equivalent to a empty list (), so also false
t is by convention true
and/or/not
(and t nil)
(or t nil () t)
(not (and t t))
comparing
; numbers
(< 3 4)
(>=_ 3 4)
(= 3 3.0000000000000000000000001)
(/= 3 4) ; not equal
;strings
(equal "abc" "abc") ; checks
(string-equal "string" "strings")
(string-equal "symbol" 'symbol) ; can be used to compare string with symbol
; generic equal - checks datatype and value
(equal 3 3) ; t
(equal 3 3.0) ; nil
(not (equal 3 4)) ; t. general way to test inequality
variables
global
(setq x 1)
(setq x 2 y 3 z -1)
local
(let name "value")
(let (name1 name2)
(setq name1 "Gustav")
(setq name2 "Gustl")
(+ 40 2) ; return value, optional
)
; or even shorter
(let ((name1 "Gustav") (name2 "Gustl"))
"Gustav+Gustl" ; return value, optional
)
if then else
(if (< 3 2) "yay" "nay")
(if (< 1 2) "yay") ; no else, nil
; no else, clearer to use ~when~. All args executed.
(when (< 1 2) (setq a 1) (setq b 2)) ; a=1 and b=2
2
block of expressions
Same as a code block in C-like languages {...}
(progn (message "a") (message "b"))
Often used inside if
(if something
(progn ; true
(message "something is t")
(message "yay")
)
(progn ; else
(message "something is nil")
(message 'nai')
)
)
loops
;; inserts Unicode chars 32 to 126
(let ((x 32)))
(let ((r "")))
(while (< x 127)
(setq r (concatenate 'string r (char-to-string x)))
(setq x (+ x 1)))
(message "%s" r)
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
to research
backup file location configurable?
highlight line
git gutter needed
what the hell is that footer thing you cannot edit?
C-o does not open last file, not sure why yet
persistant undo possible?
helm/ivy - dash?
Still trying to figure what use-case each of these tries to solve. I'm primarily looking for something that offers me an nice interface to deal with all kind of lists of elements, like files, buffers, commits, tags, grepper etc.
I used to cover that all with vim.fzf and would again like to have something like that.
Though it seems, that I just need some inteface for lists of any kind that I can easily fuzzy search.
And other plugins to actually provide the content.
gruvbox-theme
which-key
Seems great for learning the editor commands. But could also be distracting
magit
language server protocol
Mainly for my JS work, but probably worth to look at something generic if there is something out there.
vim-unimpaired ?
Couln't find something replicating unimpaired until now.
Maybe I just need to roll most of these on my own
vim-abolish ?
ranger/dired-ranger
devdocs
installed packages
general
editorconfig
helm
projectile
magit
evil related
evil
evil uses "state" for the "modes" in vi. The term "mode" is already used in emacs for a set of key bindings for a cetrain sort of text. A "mode" may include custom bindings for evil states.
The state is shown in the status bar.
There is also an emacs state <E>, basically turn off evil, which you can toggle with 'C-z'.
I've heard numerous times that people claim evil covers 99% of what they use in vim. [[evil-maps.el][~/.emacs.d/elpa/evil-20190729.704/evil-maps.el] is a good place to start looking if something does not work for you.
evil-escape
evil-leader
I was first not sure if I should even start using the leader key as I did in my vim config, as it would again not bring me further in learning the standard key bindings vim offers.
This is still a valid point, but I also feel it will slow me down quite a bit, now that I'm considering to switch to Emacs.
So I'll start with using it, but keep it very high in my priorities to finally getting rid of it.
This is pretty important, as I'm pretty sure that I'll still be using Vim in quite some remote systems.
evil-surround
evil-magit
evil-org
org-mode related
org-bullets
UTF-8 bullets
considering packages
general
"So now " it makes really fun to work like this
(print "blup")
evil related
evil-args
evil-matchit
evil-collection
This seems to use vim like keybindings in most common emacs places. Not sure yet if this is a good idea.
org-mode related
org-download
image d"n'd