1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
local M = {}
local quotes = {
{
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.",
"",
"- Brian Kernighan",
},
{
"If you don't fail at least 90% of the time, you're not aiming high enough.",
"",
"- Alan Kay",
},
{
"Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live.",
"",
"- John Woods",
},
{
"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.",
},
{
"If you don't make mistakes, you're not working on hard enough problems.",
"",
"- Frank Wilczek",
},
{
"Use tracer bullets to find the target.",
"",
"Tracer bullets let you home in on your target by trying things and seeing how close they land.",
},
{
"Always design for concurrency.",
"",
"Allow for concurrency, and you'll design cleaner interfaces with fewer assumptions.",
},
{
"Test your software, or your users will.",
"",
"Test ruthlessly. Don't make your users find bugs for you.",
},
{
"Don't live with broken windows.",
"",
"Fix bad designs, wrong decisions, and poor code when you see them.",
},
{
"Keep knowledge in plain text.",
"",
"Plain text won't become obsolete. It helps leverage your work and simplifies debugging and testing.",
},
{
"Use a single editor well.",
"",
"The editor should be an extension of your hand; make sure your editor is configurable, extensible, and programmable.",
},
{
"Crash early.",
"",
"A dead program normally does a lot less damage than a crippled one.",
},
{
"Design to test.",
"",
"Start thinking about testing before you write a line of code.",
},
{
"Work with a user to think like a user.",
"",
"It's the best way to gain insight into how the system will really be used.",
},
{
"Test early. Test often. Test automatically.",
"",
"Tests that run with every build are much more effective than test plans that sit on a shelf.",
},
{
"Use saboteurs to test your testing.",
"",
"Introduce bugs on purpose in a separate copy of the source to verify that testing will catch them.",
},
{
"There's an old story about the person who wished his computer were as easy to use as his telephone. That wish has come true, since I no longer know how to use my telephone.",
"",
"- Bjarne Stroustrup",
},
{
'There are only two industries that refer to their customers as "users".',
"",
"- Edward Tufte",
},
{
"Easy things should be easy and hard things should be possible.",
"",
"- Larry Wall",
},
{ "They did not know it was impossible, so they did it!", "", "- Mark Twain" },
{
"If debugging is the process of removing bugs, then programming must be the process of putting them in.",
"",
"- Edsger W. Dijkstra",
},
{
"The average user doesn't give a damn what happens, as long as (1) it works and (2) it's fast.",
"",
"- Daniel J. Bernstein",
},
}
function M.quote()
math.randomseed(os.clock())
local index = math.random() * #quotes
return quotes[math.floor(index) + 1]
end
function M.oldfiles(amount)
local oldfiles = {}
table.insert(oldfiles, "Press 'o' to open the file under the cursor")
local count = 0
for _, file in ipairs(vim.v.oldfiles) do
if count == amount then
break
end
table.insert(oldfiles, file)
count = count + 1
end
return oldfiles
end
function M.packer_plugins()
return {
string.format(
"Total plugins (packer.nvim): %d",
vim.tbl_count(packer_plugins)
),
}
end
return M
|