Leere Seite erstellt
[stratum0-wiki.git] / Random_Vim_tricks.mw
1 Shownotes von [[Benutzer:Drahflow|Drahflow]]s Talk am 14. Juni 2016 mit Timestamps:
2
3 * [https://youtu.be/K0rwI3U9mRE YouTube], [https://stratum0.org/recordings/2016-07-14-drahflow-random-vim-tricks.360p.mp4 MP4 360p], 01h02m15s
4
5 00:00:00 Einführung, Editor-Flamewars
6 00:01:38 vim starten, :help
7 00:02:06 vimtutor
8
9 Searching:
10 00:03:08 /, *, #, n, N (search, search word below cursor forward/backward, next match, previous match)
11 00:04:50 % (search matching brace)
12
13 Registers:
14 00:05:49 :help registers, :registers, P, p
15 00:07:10 (spontanes Nachinstallieren von Software)
16 00:10:15 dd (delete line), u (undo), "add (delete line and save into reg a), "ap (paste from reg a)
17 00:11:14 side note: :set showcmd (die Lösung für Screencasts)
18 00:11:48 Register * und + (X Primary Selection, X Clipboard)
19 00:13:00 Insert Mode: <Ctrl-R>a (insert text from register a), <Ctrl-A> (insert previously inserted text)
20
21 00:14:50 Insert Mode: <Ctrl-Y>, <Ctrl-E> (insert text which is above/below cursor)
22 00:15:45 :set number, :set relativenumber (absolute/relative line numbers on left side)
23
24 Navigation in Normal Mode (besides hjkl):
25 00:17:00 w, W, b, B (jump to next/previous word)
26 00:18:15 fX, tX (jump to next char 'X' / before next char 'X')
27
28 Edit command + motion, Text objects, ranges:
29 00:19:41 dw (delete word)
30 00:20:00 dtX, ctX (delete/change until before next 'X'), ytX (yank into register until before 'X') ...
31 00:21:15 "inner" range: ci" (delete everything inside ""), cit (change inner HTML tag) ...
32 00:22:54 das (delete a sentence), cap (change a paragraph)
33
34 Marks:
35 00:23:50 ma (set mark a to current position), 'a (jump to line with mark a), `a (jump to mark a)
36 00:24:26 uppercase marks are (system-)global
37
38 00:24:27 Escape auf Caps Lock o.ä. mappen
39 00:26:47 {, } (jump to begin/end of current "block")
40 00:27:16 vim mit Input: man bash | vim -
41 00:27:42 :set scrolloff (scroll offset)
42 00:27:55 <Ctrl-E>, <Ctrl-Y> (Normal Mode): scroll up/down without cursor
43
44 Visual Mode:
45 00:28:30 v (Visual Mode), V (Visual Line), <Ctrl-V> (Visual Block) als Range
46 00:29:00 {Visual Block}I, {Visual Block}A (insert/append columns)
47
48 00:30:00 . (repeat last edit command)
49
50 Undo/Redo:
51 00:30:58 u (undo), <Ctrl-R> (redo), g-, g+, :help earlier (time-based undo)
52
53 Special Chars:
54 00:33:36 Insert Mode <Ctrl-K>: "compose key"
55 00:34:30 Insert Mode <Ctrl-V>: "escape" mode (e.g. <Ctrl-V><ESC> => literal ESC char, <Ctrl-V> + hex char, <Ctrl-V><u> + hex char for Unicode)
56 00:35:23 ga (show hex codepoint of current char), vim -b
57
58 Character Case:
59 00:36:28 ~ (switch case), gU<range>, gu<range> (make characters in <range> upper/lowercase)
60 00:36:45 <Ctrl-A>, <Ctrl-X> (increment/decrement current number. Also hex and octal!)
61
62 Indentation:
63 00:37:35 Normal Mode: <<, >>, Insert Mode: <Ctrl-D>, <Ctrl-T> (increase/decrease indentation)
64 00:37:58 ==, ={motion}, {Visual}= (fix indentation}
65
66 00:38:38 0, ^, $ (jump to beginning/first non-space char/end of line)
67
68 Macros:
69 00:39:14 qx (start recording macro to register x), q (stop recording), @x (execute macro x)
70 00:40:24 recorsive macros
71
72 00:41:30 gq{motion}, gq{motion} (rewrap lines), :set textwidth, :set colorcolumn, J (join next line)
73 00:43:38 o, O (insert new line below/above and go to Insert Mode)
74 00:43:48 p, P, "xp, "xP, {Visual}d (paste buffer below/above current line, delete visual block)
75
76 Spell Checking:
77 00:48:33 :set spell (enable spellchecking), :set spelllang, z= (spelling suggestion for word on cursor), ]s (next misspelled word)
78
79 Tag Files (source code browsing):
80 00:50:33 <Ctrl-]> (jump to definition of word on cursor), :help tags
81
82 Autocompletion:
83 00:51:35 Insert Mode: <Ctrl-N>, <Ctrl-P> (next/previous completion), <Ctrl-X><Ctrl-F> (filename completion), :help completion
84
85 00:54:03 :<range>! (filter range through external command, e.g. sort)
86 00:55:50 :grep (you guessed it), quick fix list, :cn, :cp (next/previous match), :make
87
88 00:55:34 gv (last visual selection)
89
90 Windows/Tabs:
91 00:58:50 :new, :vnew, :sp, :vsp (split windows), :tabnew, :tabnext, :tabprev (tabs), <Ctrl-W>o (make this the only window)
92 00:59:45 :buffers (show all open buffers)
93
94 01:00:15 :qa! (quit all without saving)
95
96 01:00:40 {Visual}o (go to other end of visual selection)
97 01:01:05 vimdiff
98 01:01:44 folding, :set foldmethod, zo, zc (open/close fold)
99
100 [[Kategorie:Vorträge]]
This page took 0.055757 seconds and 5 git commands to generate.