Vim is a highly customizable text editor with several modes including Normal, Insert, Visual, and Ex modes. It originated from the ed text editor. Normal mode is the default and most used mode. Vim has many powerful text objects and motions that can be combined with operators like yank, delete, and change to manipulate text. It also supports useful features like undo/redo, macros, registers, plugins, and a powerful ex command mode.
In computer science, functional programming is a programming paradigm—a style of building the structure and elements of computer programs—that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data.
In computer science, functional programming is a programming paradigm—a style of building the structure and elements of computer programs—that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data.
Symmetry in the interrelation of flatMap/foldMap/traverse and flatten/fold/se...Philip Schwarz
(download for perfect quality) A simple but nice example of the symmetries that help us reason about functional programs.
Errata: in "foldMapping is mapping and then folding – folding is just flatMapping identity", flatMapping should of course be foldMapping - spotted by Vasco Figueira
Symmetry in the interrelation of flatMap/foldMap/traverse and flatten/fold/se...Philip Schwarz
(download for perfect quality) A simple but nice example of the symmetries that help us reason about functional programs.
Errata: in "foldMapping is mapping and then folding – folding is just flatMapping identity", flatMapping should of course be foldMapping - spotted by Vasco Figueira
Presentationen från träffen "Hur funkar deltagarkultur online?" hos Social Media Club Göteborg den 12/6 2015. Eventet var en del av Shareleksveckan. Press av Emma Öhrwall, Kollaborativ Ekonomi Göteborg
2. History of Vim
"In the beginning, there was ed. And ed begat
ex; and ex begat vi; and vi begat vim."
3. What is Vim?
● Vim is a highly customizable, highly efficient
text editor
● Vim has several modes
○ Normal
○ Insert
○ Visual
○ Ex mode
4. Normal Mode
Normal Mode is the default mode in Vim.
You should spend most of your time in normal
mode.
5. Text Objects
a = a/an
i = inside
aw -> a word
aW -> a WORD
as -> a sentence
ap -> a paragraph
6. More Text Objects
a( -> a pair of parenthesis
a{ -> a pair of {braces}
a[ -> a pair of [brackets]
a< -> a pair of <angle brackets>
at -> a pair of XML tags
7. More Text Objects
a" -> a pair of "quotes"
a' -> a pair of 'quotes'
Examples:
da" -> delete a pair of quotes
ci" -> change everything between the quotes
yap -> yank a paragraph
8. Motions
words vs WORDS
def foo(a,b)
word: [def][foo][(][a][,][b][)]
WORD: [def][foo(a,b)]
w -> next word e -> end of word
W -> next WORD E -> end of WORD
b-> beginning of current word
B -> beginning of current WORD
9. More Motions
f -> find a character
F -> find a character (reverse)
t -> go to just before a character
T -> go to just after a character
(reverse)
; -> next match (for f/F/t/T)
, -> previous match (for f/F/t/T)
10. More Motions
/ -> search forward
? -> search backwards
n -> next match (current direction)
N -> previous match (current direction)
* -> search for word under the cursor
# -> search backwards for word under the
cursor
11. Operator
y -> yank
d -> delete
c -> change
p -> paste (after)
P -> paste (before)
Operator + motion = action
dw -> delete to the next word
12. Line-wise operations
dd -> delete a line
cc -> change a line
yy -> yank a line (copy)
>> -> shift right
<< -> shift left
== -> auto indent
13. Counts
Most motions take a count
3w -> move ahead 3 words
5s -> move ahead 3 sentences
These can be combined with actions
3dw -> delete a word 3 times (or d3w)
5dd -> delete 5 lines
2yy -> yank 2 lines
14. Undo/Redo
Act, Repeat, Reverse
. -> repeat a change
u -> undo a change
- Chunk your Undos
- Compose repeatable changes
- Don't count if you can repeat
15. Insert Mode
Entering Insert Mode
i -> insert to the left of the cursor
a -> insert to the right of the cursor (append)
c -> change (usually combined with a motion)
I -> Insert at the beginning of the current line
A -> Append to the end of the current line
cc -> change the current line
16. Visual Mode
v -> character-wise Visual mode
V -> line-wise Visual mode
<C-v> -> block-wise Visual mode
gv -> re-selects last visual selection
You can switch between these without going
into normal mode
17. Ex mode
: -> enter Ex command
Q -> enter Ex mode (:visual to get out)
:[range]d[elete] ->
deletes specified lines
:[range]y[ank] ->
yanks specified lines
:[line]put ->
puts the yanked lines under the current line
18. Ex Mode Examples
:5 -> go to line 5
:5p -> print line 5
:$ -> go to last line
:2,5p -> print lines 2-5
:% -> the whole document
:. -> the current line
19. Registers
Use registers with yanks and deletes
Increase your clipboard size to 27!
"[register][count]action text object
example:
"ayiw => Yank current word into register a
"ap => Paste from register a
20. Macros
Record a sequence of changes and then play
them back
q{register} -> record a macro into a register
qa -> start recording a macro into register a
Press q again to stop the recording
@{register} -> playback the macro in {register}
21. Linewise Motions
0 -> go to beginning of a line
^ -> first non-whitespace character of a line
$ -> end of line
22. Macro Tips
Macros can be done in series
Macros can also be done in parallel
Macros are useful with counts (Dot command
doesn't accept counts)
24. More Plugins
NERDTree -> File tree explorer
github.com/scrooloose/nerdtree
Fugitive -> Git from within Vim
github.com/tpope/vim-fugitive
Greplace -> Project search and replace
github.com/skwp/greplace.vim