Browse Source

move fragments into /home, add a couple things to cheat

inertia_intel_nuc
Brennen Bearnes 3 years ago
parent
commit
6a312f148d
25 changed files with 185 additions and 0 deletions
  1. +8
    -0
      home/bin/cheat
  2. +177
    -0
      home/cheatsheets/vimcheat.html
  3. +0
    -0
      home/fragments/README.md
  4. +0
    -0
      home/fragments/array_key_test.php
  5. +0
    -0
      home/fragments/bash-regex-match.sh
  6. +0
    -0
      home/fragments/blinka.py
  7. +0
    -0
      home/fragments/circuitpy-setup
  8. +0
    -0
      home/fragments/data-attribute-jquery.html
  9. +0
    -0
      home/fragments/festival-stdin.pl
  10. +0
    -0
      home/fragments/fizzbuzz.pl
  11. +0
    -0
      home/fragments/gender-from-name.pl
  12. +0
    -0
      home/fragments/mogwai.sh
  13. +0
    -0
      home/fragments/perl-utf8-decode/decode.pl
  14. +0
    -0
      home/fragments/perl-utf8-decode/original
  15. +0
    -0
      home/fragments/perl-utf8-decode/re_encoded
  16. +0
    -0
      home/fragments/php-preg-replace.php
  17. +0
    -0
      home/fragments/python-gitignore
  18. +0
    -0
      home/fragments/python-test-returnval.py
  19. +0
    -0
      home/fragments/raspi_circuitpython_blink.py
  20. +0
    -0
      home/fragments/stars.js
  21. +0
    -0
      home/fragments/stars.pl
  22. +0
    -0
      home/fragments/stars.py
  23. +0
    -0
      home/fragments/stars.sh
  24. +0
    -0
      home/fragments/strftime-test.pl
  25. +0
    -0
      home/fragments/uri.pl

+ 8
- 0
home/bin/cheat View File

@ -18,3 +18,11 @@ Custom utils:
DOC
ls ~/bin/
echo
echo "Cheat:"
ls ~/code/bpb-kit/home/cheatsheets
echo
echo "Example code:"
ls ~/code/bpb-kit/home/fragments

+ 177
- 0
home/cheatsheets/vimcheat.html View File

@ -0,0 +1,177 @@
<html>
<head>
<title>vim cheatsheet</title>
<style>
body {
font-family: Georgia, Serif;
margin-left: 2em;
}
th {
font-size: normal;
text-align: right;
}
td {
padding-right: .5em;
padding-left: .5em;
padding-bottom: .5em;
vertical-align: top;
}
td.keymap {
text-align: center;
}
kbd {
/* border-bottom: 1px solid #EAEEF2;
border-right: 1px solid #EAEEF2; */
padding: 1px;
}
kbd, pre, td.keymap {
font-family: monospace;
font-weight: bold;
font-size: larger;
color: green;
}
.change kbd, kbd.change { color: orange; }
.insert kbd, kbd.insert { color: blue; }
.delete kbd, kbd.delete { color: red; }
i { color: gray; }
</style>
</head>
<body>
<table>
<tr>
<th>edit</th>
<td>
<span class="insert">
<kbd>i</kbd>nsert at cursor<br>
<kbd>I</kbd>nsert at start<br>
<kbd>a</kbd>ppend after cursor<br>
<kbd>A</kbd>ppend to line<br>
</span>
</td>
<td>
<span class="delete">
<kbd>x</kbd> kill char<br>
<kbd>X</kbd> kill back<br>
<kbd>d</kbd>elete/cut text<br>
<kbd>d<i>obj</i></kbd> - <kbd>dw</kbd>, <kbd>d$</kbd>, etc.<br>
<kbd>dd</kbd> clears whole line<br>
<kbd>D</kbd> to end of line
</span><br>
<span class="change"><kbd>c</kbd>hange - <kbd>c<i>obj</i></kbd>, <kbd>ci<i>obj</i></kbd>, <kbd>cc</kbd>, <kbd>C</kbd></span><br>
</td>
<td>
<kbd class="change">r</kbd>eplace one char<br>
<kbd class="change">R</kbd>eplace text<br>
<span class="change"><kbd>s</kbd>ubstitute char</span><br>
<kbd>y</kbd>ank/copy - <kbd>y<i>obj</i></kbd>, <kbd>yy</kbd><br>
<kbd>p</kbd>ut (paste)<br>
<kbd>u</kbd>ndo, <kbd>ctrl-r</kbd>edo<br>
<kbd>v</kbd>isual select<br>
<kbd>.</kbd> repeat edit
</td>
</tr>
<tr>
<th>move</th>
<td>
<kbd>e</kbd>nd, <kbd>b</kbd>egin <kbd>w</kbd>ord<br>
<kbd>$</kbd>,<kbd>0</kbd> end, begin line<br>
<kbd>(</kbd>,<kbd>)</kbd> sentence &larr;, &rarr;<br>
<kbd>{</kbd>,<kbd>}</kbd> paragraph &larr;, &rarr;<br>
<kbd>ctrl-b</kbd>ack, <kbd>ctrl-f</kbd>wd page<br>
<kbd>fA</kbd> goes to next "A"<br>
<kbd>tA</kbd> before next "A"
</td>
<td class="keymap">
<small>gg</small><br>
<small>&lt;C-b&gt;</small><br>
H<br>
k<br>
{ ( B b h l w W ) }<br>
j<br>
L<br>
<small>&lt;C-f&gt;</small><br>
<small>G</small>
</td>
<td>
<kbd>/<i>pattern</i></kbd> &rarr;<br>
<kbd>?<i>pattern</i></kbd> &larr;<br>
<kbd>n</kbd>ext <i>pattern</i><br>
<kbd>*</kbd> word under cursor<br>
<kbd>%</kbd> matching bracket<br>
<kbd>m<i>x</i></kbd> set mark <i>x</i><br>
<kbd>``</kbd> go back, <kbd>`<i>x</i></kbd> to mark
</td>
</tr>
<tr>
<th>files<br><small>&amp; windows</small></th>
<td>
<kbd>:e <i>file</i></kbd> edit<br>
<kbd>:w <i>file</i></kbd> write<br>
<kbd>:wq</kbd> write &amp; quit<br>
<kbd>:r <i>file</i></kbd> read into buffer<br>
<kbd>:r !<i>command</i></kbd> - get output<br>
<kbd>:sp <i>file</i></kbd> - in new window<br>
<kbd>:q</kbd> - quit buffer/window
</td>
<td colspan=2><kbd>ctrl-w</kbd> then...<br>
<kbd>n</kbd>ew<br>
<kbd>s</kbd>plit current<br>
<kbd>v</kbd>ertical split<br>
<kbd>h</kbd>, <kbd>j</kbd>, <kbd>k</kbd>, <kbd>l</kbd> jump &larr; &darr; &uarr; &rarr;<br>
<kbd>+</kbd>, <kbd>-</kbd>, <kbd>=</kbd> size current<br>
<kbd>f</kbd>ile under cursor in new window<br>
</td>
</tr>
</table>
<p>- - - cut or fold here - - -</p>
<table>
<tr>
<th>style</th>
<td>
<kbd>:set expandtab</kbd> - use spaces<br>
<kbd>:set shiftwidth=2</kbd><br>
<kbd>:set textwidth=70</kbd><br>
<kbd>:set nowrap</kbd>
</td>
<th>tweak</th>
<td>
<kbd class="change">J</kbd>oin<br>
<kbd class="change">gq<i>obj</i></kbd> - autoformat<br>
<kbd>~</kbd> change case of char<br>
<kbd>&gt;&gt;</kbd>,<kbd>&lt;&lt;</kbd> indent, unindent<br>
<kbd>=</kbd> autoindent<br>
<kbd>:rangesort</kbd><br>
</td>
</tr>
</table>
<p><kbd><i>n</i>ctrl-a</kbd>, <kbd><i>n</i>ctrl-x</kbd> - inc or dec number by <i>n</i></p>
<p><kbd class="change">:s/pattern/replacement/g</kbd> - on this line (g for multiple)<br>
<kbd class="change">:%s/pattern/replacement/gc</kbd> - on every line but confirm<br>
<kbd class="change">:perldo s/foo/bar/g</kbd> - do Perl on every line<br>
<kbd class="change">:.perldo s/bar/baz/g</kbd> - do Perl on this line</p>
</body>
</html>

fragments/README.md → home/fragments/README.md View File


fragments/array_key_test.php → home/fragments/array_key_test.php View File


fragments/bash-regex-match.sh → home/fragments/bash-regex-match.sh View File


fragments/blinka.py → home/fragments/blinka.py View File


fragments/circuitpy-setup → home/fragments/circuitpy-setup View File


fragments/data-attribute-jquery.html → home/fragments/data-attribute-jquery.html View File


fragments/festival-stdin.pl → home/fragments/festival-stdin.pl View File


fragments/fizzbuzz.pl → home/fragments/fizzbuzz.pl View File


fragments/gender-from-name.pl → home/fragments/gender-from-name.pl View File


fragments/mogwai.sh → home/fragments/mogwai.sh View File


fragments/perl-utf8-decode/decode.pl → home/fragments/perl-utf8-decode/decode.pl View File


fragments/perl-utf8-decode/original → home/fragments/perl-utf8-decode/original View File


fragments/perl-utf8-decode/re_encoded → home/fragments/perl-utf8-decode/re_encoded View File


fragments/php-preg-replace.php → home/fragments/php-preg-replace.php View File


fragments/python-gitignore → home/fragments/python-gitignore View File


fragments/python-test-returnval.py → home/fragments/python-test-returnval.py View File


fragments/raspi_circuitpython_blink.py → home/fragments/raspi_circuitpython_blink.py View File


fragments/stars.js → home/fragments/stars.js View File


fragments/stars.pl → home/fragments/stars.pl View File


fragments/stars.py → home/fragments/stars.py View File


fragments/stars.sh → home/fragments/stars.sh View File


fragments/strftime-test.pl → home/fragments/strftime-test.pl View File


fragments/uri.pl → home/fragments/uri.pl View File


Loading…
Cancel
Save