m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--date.md7
-rw-r--r--ruby.md15
-rw-r--r--vim.md36
3 files changed, 58 insertions, 0 deletions
diff --git a/date.md b/date.md
new file mode 100644
index 0000000..f0b7dd7
--- /dev/null
+++ b/date.md
@@ -0,0 +1,7 @@
+# The date utility
+
+ date +FORMAT
+
+## UNIX timestamp
+
+ date +%s
diff --git a/ruby.md b/ruby.md
new file mode 100644
index 0000000..2b205ce
--- /dev/null
+++ b/ruby.md
@@ -0,0 +1,15 @@
+# Ruby stuff
+
+## Bundler
+
+### Install packages locally
+
+ bundle install --path vendor/bundle
+
+## Gemfile
+
+### Basic
+
+ source 'https://rubygems.org'
+
+ gem 'gemname'
diff --git a/vim.md b/vim.md
index c69b9c4..f652188 100644
--- a/vim.md
+++ b/vim.md
@@ -13,6 +13,42 @@
| `'` | `:h 'ro'` | option |
| `-` | `:h -r` | Vim argument (starting Vim) |
+## Registers
+
+: is the "last command" register. @: reruns the last command.
+
+## Marks
+
+mA - capital letters are global, will jump to file
+`a - jumps to line and column of mark, not just line
+
+## v/V/<c-v> as operators
+
+Most commands act line-wise (d2j deletes two lines). v makes things
+character-wise, <c-v> makes them block-wise.
+
+## Ranges
+
+ g/regex/command # executes command on each line matching regex
+ v/regex/command # executes command on each line not matching regex
+
+## Ex commands
+
+ :norm abc # runs the keys abc on each line in range
+ :g/abc/norm dt; # deletes until semicolon on each line with "abc"
+
+ :co <location> # copies range to location (can be ., +n, 'a)
+ :mv <location> # same but moves
+
+## Visual mode
+
+gv - selects the previous visual
+g<c-a/x> - increment/decrement by 1 more on each selected line
+
+ 0 1 1
+ 0 <c-a> -> 1 g<c-a> -> 2
+ 0 1 3
+
## Using vim as a hex editor?
:%!xxd