Emacs commands
1 2024-02-12 I have decided to put emacs on the shelf for a little while
Here are a few key bindings that I have intensely used back then, not to forget:
C-c c-s - django snippets in html M-g f - all flymake errors M-x q - list variables/func/classes M . - jump to definition M , - jump back from definition M ? - find references M [ ] - jump to previous location C-x r b - jump to bookmark C-x p g - ripgrep project C-h D - devdocs C-M a - start of class C-M e - start of class
C-M u / C-M d / C-M n - jump to beginning/end of a block
2 Emacs commands (from work)
2.1 C-c C-e m M (org-md-export-as-markdown)
2.2 mx truncate lines - wrap long lines
2.3 unfill paragraph - unfill paragraph :)
2.4 Naudok sparse trees su C-c /
2.5 C-x 4 c - clone current buffer
2.6 C-h m - current mode commands n stuff?
2.7 org-change-tag-in-region - batch apply tags
2.8 org-md-export-to/as-markdown - export org to markdown
2.9 ctrl+c+/ in org file for filtering - org sparse tree!!!
2.10 clear sparse tree ctrl+c+/ ctrl+c+'
2.11 in org agenda press / and find ANYHTING you need!!!
not necessarily by tag or todokwd
2.12 Query replace from all files within folder:
worked just fine on
M-x find-name-dired RET it may take some time for all the files to appear in the list, scroll to bottom (M->) until "find finished" appears to make sure they all have loaded Press t to "toggle mark" for all files found Press Q for "Query-Replace in Files…": you will be prompted for query/substitution regexps. Proceed as with query-replace-regexp: SPACE or y to replace and move to next match, n to skip a match, etc. Type ! to replace all occurrences in current file without asking, N to skip all possible replacement for rest of the current file. (N is emacs 23+ only) To do the replacement on all files without further asking, type Y. Call “ibuffer” (C-x C-b if bound to ibuffer, or M-x ibuffer RET) to list all opened files. Type * u to mark all unsaved files, type S to save all marked files
- * RET to unmark all marks, or type D to close all marked files
3 Shortcuts
Key Binding | Function | Mode |
---|---|---|
p | Forward one indentation block | Elpy |
C-up | Backward one indentation block | Elpy |
C-left | Backward one indentation level | Elpy |
C-right | Forward one indentation level | Elpy |
M-down | Move line or region down | |
M-up | Move line or region up | |
M-left | Move line or indentation block left | |
M-right | Move line or indentation block right | |
M-x elpy-set-project-root | Set the root directory of the python project | |
C-c C-f | Find file in project | |
C-c C-s | Regular expression match in project | |
M-TAB | Complete current statement | |
M-. | Goto defition | |
M-* | Return to position from last definition lookup | |
C-c C-z | Switch to python shell | |
C-c C-c | Send python code to shell (active region or complete buffer) | |
C-c RET | Send current line to python shell | |
C-M-x | Sends code of current top level function to python shell | |
C-c C-v | Syntax check with flake8 | |
C-c C-n | Next flake8 error | |
C-c C-p | Previous flake8 error | |
C-c C-t | Start tests | |
C-c C-e | Edit all occurrences of the symbol at point at once | |
C-c C-r f | Format code using the available formatter | |
C-c C-r i | Query for new imports of unresolved symbols, and remove unreferenced imports | |
C-c C-r r | Run the Elpy refactoring interface for Python code | Elpy |
C-u C-c C-x C-i | See all recently clocked in tasks | Org-clock |
M-x Customize group | See ALL the configurable lines of a mode/package - GREAT!!! | |
C-c / | Org sparse tree - filter org file for TODO entries and such, to exit - | Org |
org-sort-entries | sort entries by TODO keyword | Org |
run-python | can not find module named… python error. Run run-python in the buffer | elpy |
dired-git-info-mode | shows the commit history of a directory | dired |
org-agenda-archives-mode | shows all the archived tasks in the agenda. | org agenda |
c-u m-x shell | open another shell instance, give it a name | |
c-c c-d | Helpful at point | Docs |
C-h b | all shortcuts in of current buffer modes | Docs |
M-x where is | which key shortcut is bound to | Docs |
C-h r | docs | Docs |
C-h i | info | Docs |
C-h ? | Other + other choose! |
3.1 Shortcuts
3.1.1 network
- traceroute delfi.lt
- ipconfig
- gpupdate /force
- gpresult /r
n- ping
3.1.2 emacs
- M-g j = Dumb jump
- M-% = Query replace
- C-M i = FLYSPELL step on a word and correct it's spelling. multiple presses for different words
- C-; = flyspell auto correct previous word
- F5 = turn on flyspell mode
- C-c C-p I = open buffers OF THE CURRENT PROJECT
- M-, = Go back one step
- C-h i = info about your whole linux system and programs installed
- C-h r = info manual emacs
- C-h m = describe mode
- C-h k = describe key
- C-x n s = narrow down to one headline in org mode
- C-x n w = widden back to all headings
- C-x n w = widen back to normal
- C-c u = undo tree visualize
- M-x highlight-regexp = highlights word occurences in the buffer
- C-x h = mark buffer
- C-x SPC = rectangle mode
- C-u c-u c-u . = enter current date timestamp - this puts to agenda
- C-u C-c . = inactive timestamp with hour and minutes
- C-c . = enter current date timestamp same
- C-c ! = enter current date timestamp BUT no agenda entry
- C-x ( OR F3 = define macro - do a sequence
- C-x ) OR F4 = stop defining
- C-x e OR f4 = executes macro
- C-x C-k n = give name to last macro
- M-x insert-kbd-macro = extract contents of a macro (useful when want to put in init file)
- M-x apply-macro-to-region-lines = does exactly that
- C-SCP x2 = makes a mark
- C-x C-SCP = jumps to that mark
- C-x r SCP <any> = resgister a key(position)
- C-x r j <any> = jump to the key(to that position)
- C-c C-w = refile to enother point in the org document or another file
- C-c C-s = schedule org item
- C-c C-d = set a deadine to org item
- C-x C-x = Move cursor to the other end of selection.
- C-a a = org agenda
- C-c c = capture something (write note and put it somewhere in the template)
- C-c C-z = make a note under sme org heading
- C-c a a F = follow up mode. expands the task in agenda view
- M-u = capitalize all letters of a word
- m-l = lowercase all letters of a word
- C-x left = previous buffer. Faster than C-x b? maybe. Cia gi winner mode.
- C-c C-l = after selecting text - add link shortcut
- C-c C-x e = set effort estimate on an org headline
- C-c C-x C-c = see the effort estimate table
- C-c C-x C-j = go to clock entry
- C-c C-e = ELPY Edit all occurrences of the symbol at point at once
- C-c C-c = ELPY send REGION to python interactive interpreter,(atsidarys atskiras buffer, arba gali ji isjungti, tai graziai apacioje rodys for a short time) ARBA Gali ctrl+enter po viena eilute
- C-c C-d = ELPY show documentation,
- C-c C-z = ELPY Switch between your script and the interactive shell
- M-. = ELPY go to definition.(or use dumb-jump shortcut M-g g)
- C-c n/p = ELPY move to next, previous error
- C-c C-v = ELPY Syntax check with flake8
- C-c C-n = ELPY Next flake8 error
- C-c C-t = ELPY Start tests
- C-c RET = ELPY (new shortcut) evaluate line
- M-x comint-clear-buffer = clears elpy terminal (C-c M-o)
- M-x elpy-config = ELPY config
- C-h v kill-ring = Watch your kill ring
- C-x o m = AVY swap windows
- M-i = indent, cool
- M-x emacs-lisp-byte -compile = after modifying emacs package file, run this (while in the opened buffer) to save the changes. Helped with iedit.
- M-x eww = EWW browser
- C-c C-o = ORG open linka
- A = ORG agenda append agenda view to buffer
- o = ORG agenda delete other windows
- f1 v = DESCRIBE VARIABLE - super useful. can look for all kind of information. Like directories of plugins and so on… try it out.
- C-v = scroll buffer down
- M-v = scroll buffer up
- M-! nautilus . = open current dir in nautilus. oh yeah
- M-x clone-indirect-buffer = multiple views of same file
- M-o = see council option
- M-x flyckeck-list-errors = a list of errors in the buffer
- C-c C-p p/d = TREEMACS add/remove project to a workspace
- M-x lsp-treemacs-symbols = show the structure of the file
- m-x lsp-find-references = show where the function is being used
- C-c C-d = when in python doc = gives documentation of chosen topic
- C-c / = sparse tree (org mode look up for things)
- M-x erc-tls = irc.libera.chat IRC chat!
- /join #emacs or #systemcrafters = IRC join channel
- /part = IRC leave channel
- /quit bye all! = quit server
- /reconnect = reconnect to the server?
- /list = IRC list channels
- /whois nick = IRC find out whoe the user is!!
- / query nick = IRC write someone a private message!! (new buffer opens up)
- /msg nick Hello there = IRC sends a one time message
- /nick newname = IRC change nickname
- C-c ' = edit code block in a separate window (proper indentation and all)
- C-c C-x ; = TIMER start
- C-c C-x , = TIMER pause/continue
- C-c C-x _ = TIMER stop
- C-> = multiple cursors - mark next line like this
- C-< = multiple cursors - mark previous line like this
- C-c C-< = multiple cursors - mark all like this
- M-x customize group - customize some stuff
- M-x ielm RET package-archives RET = gives some values out
- C-c ' = edit source code buffer (useful when need code completion when editint a src code in ORG file)
- g-o = DIRED view buffer(or view in another window)
- a = DIRED - cycle through directories and open files (leaves no traces(open buffers))
- R = DIRED rename file
- + = DIRED create directory
- m = DIRED mark file
- u/U = DIRED un mark file/s
- ( = DIRED close/open information
- t = DIRED invert marked file selection
- % m = DIRED mark all files according to your needs fx. .org \.org$
- * = DIRED more options
- c = DIRED copy marked files
- D = DIRED delete marked files
- d = DIRED mark files for deletion
- x = DIRED execute the deletion
- M-[ = goto last change(previous)
- M-] = goto last change reverse(next)
- C-a C = configure org agenda (the simple way)
- C-' = cycle through agenda files
- F11 = full screen mode
- emacs -q test.el foo.org = debug lisp code this way
- C-D = PYTHON mode - PY DOCS
- buffer name = creates a buffer
- M-x highlight-regexp = highlight search results
- M-x clone indirect buffer = duplicate same buffer, edit in two places
- M-y = browse kill ring
- RET: = ELFEED view selected entry in a buffer
- b: = ELFEED open selected entries in your browser (browse-url)
- y: = ELFEED copy selected entries URL to the clipboard
- r: = ELFEED mark selected entries as read
- u: = ELFEED mark selected entries as unread
- +: = ELFEED add a specific tag to selected entries
- -: = ELFEED remove a specific tag from selected entries
- g: = ELFEED refresh view of the feed listing
- G: = ELFEED fetch feed updates from the servers
- s: = ELFEED update the search filter (see tags)
- c: = ELFEED clear the search filter
- s-F10 = show minimap
- C-c n l = ORG-ROAM-buffer-toggle
- C-c n f = ORG-ROAM-node-find
- C-c n i = ORG-ROAM-node-insert
- C-M-i = ORG-ROAM completion at point
- org-id-get-create = ORG-ROAM create an IF for a heading
- org-roam-alias-add = ORG-ROAM add another name for a node
- C-c n d n = ORG-ROAM-dailies-capture-today
- C-c n d d = ORG-ROAM-dailies-goto-today
- C-c n d Y = ORG-ROAM-dailies-capture-yesterday
- C-c n d T = ORG-ROAM-dailies-capture-tomorrow
- C-c n d y = ORG-ROAM-dailies-goto-yesterday
- C-c n d t = ORG-ROAM-dailies-goto-tomorrow
- C-c n d d = ORG-ROAM-dailies-goto-today
- C-c n d v = ORG-ROAM-dailies-capture-date
- C-c n d c = ORG-ROAM-dailies-goto-date
- C-c n d b = ORG-ROAM-dailies-goto-next-note
- C-c n d f = ORG-ROAM-dailies-goto-previous-note
- Batch rename files - open dired-toggle-read-only
- - git rm –cached <path to file> = removes git file from repo, keeps it in folder
- C-M o when in 'find file' = drop-down of suggestions of what to do with files, list.
- C-c C-x C-v = show/hide images in org files instead of links
- Mu4e - shortcuts here
- Ctrl+shift+alt+R - start/end gnome recording
- settings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length X - specify the length of the gnome video. 0 instead of X - no duration. 300 instead of X = 300sec
- C-u C-C C-x C-i = list of all clocked-in tasks. Primeti? Wow.
- C-u thingie on different commands - projectile f.x also - COMMANDER
- M-x customize-group RET org-pomodoro = configurations of ANY package listed here
- M-x use-package-report = shows packages that got loaded and their load times!!
- C-u M-x eshell = open two eshells at the same time!
- org-customize = customize EVERYTHING about org-mode
- C-c C-, = lists the possible <s completetions. discovered at work.
- screenfetch = linux info with logo
- passwd - change password for linux user
- du -hs = how big is a folder in terminal
- C-h m = list all the minor modes
- C-c C-d = helpful-at-point
- C-x C-0 = text-scale-adjust
- C-x z = repeat last command
- C-c M- o or M-x commit clear buffer - clears eshell or shell buffer
Shift + "
= wraps text in parentheses- C-w = whitespace mode, rodo taskiukus vietoj whitespace
- C-c - c-e f = fold all children elements of the current father
- tern commands - javascript jump to definition, documentation and other cool stuff
- org-export-dispacher or C-c C-e(might be conflicitng with pop eshell)
- c-x n s/w - org narrow/expand
C-o
in dired to preview/view/visit files- C-x C-p - mark whole page
- org-change-tag-in-region - apply tag to all headings
- C-h i - INFO MODE!!!!! shows all the manuals of packages
- c-c c-x p - assign property(category etc) to org note
- C-a - add attachement!!
- c+h r - open emacs docs, press m to pick topic (f.x bookmarks), RET -
you are reading the docs. NIIICE.
3.1.3 Bindings
- Emacs pasidaryk bindings patogesnius
Last change Bottom top of the file Definition Multiple cursors Jump between paragraphs M-s query replace
Gal kaip revit??
- go to next paragraph su M-n M-p maybe
- go to last change emacs M={ }
- go to last change emacs M={ }
- go to next paragraph su M-n M-p maybe
- kaip suzinoti visas commands? pvz agenda… shift + r clocktable, shift + L follow mode
gal su hydrom galima matyti?
- Vim bindings
https://bbbscarter.wordpress.com/2012/09/13/emacs-bits-and-bobs/
why NOT tu use evil in 2022? zinai ka, gal pabusiu su emacs for now.. it is going great with it. I like it.
Evil collection plugin in the future - "evil bindings in every package"
- C-G from INSERT to NORMAL mode
- C-U go half page up
- C-D go half page down
- Shift-A - append to the end of the line
- C-z - emacs mode(get yourself out of trouble with it. STOP evil)
- C-w - evil window management
- C-o - evil JUMP backwards
- M-x customize group RET org-pomodoro RET
3.2 commands emacs
3.2.1 ansi-term copy/paste
:CAPTURED:
C-c C-j
will run term-line-mode, which treats the terminal buffer more
like a normal text-buffer in which you can move the cursor and yank
text. You can switch back to character mode by running term-char-mode
with C-c C-k
.
https://stackoverflow.com/questions/2886184/copy-paste-in-emacs-ansi-term-shell
3.3 Bookmarks emacs
C+h i - info mode
C+x r b - jump to bookmark C+x r m - make a bookmark here C+x r l - see all bookmarks