diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/index.html | 60 |
1 files changed, 59 insertions, 1 deletions
diff --git a/docs/index.html b/docs/index.html index 70fd4c8..766219d 100644 --- a/docs/index.html +++ b/docs/index.html | |||
@@ -26,9 +26,67 @@ function showPost(id) { | |||
26 | 26 | ||
27 | 27 | ||
28 | <div class="post"> | 28 | <div class="post"> |
29 | <div class="date">31/07 2019</div> | ||
30 | <a href="#bash_harder_with_vim.md" class="post-link" onClick="showPost('bash_harder_with_vim.md')">Bash Harder With Vim</a> | ||
31 | <div id="bash_harder_with_vim.md" class="post-text" style="display: block"> | ||
32 | <p>Bash is tricky, dont let your editor get in your way. Here’s a couple of neat | ||
33 | addtions you could make to your <code>vimrc</code> for a better shell programming | ||
34 | experience.</p> | ||
35 | |||
36 | <p><strong>Man pages inside vim</strong>. Source this script to get started: </p> | ||
37 | |||
38 | <pre><code>runtime ftplugin/man.vim | ||
39 | </code></pre> | ||
40 | |||
41 | <p>Now, you can open manpages inside vim with <code>:Man</code>! It adds nicer syntax highlighting | ||
42 | and the ability to jump around with <code>Ctrl-]</code> and <code>Ctrl-T</code>.</p> | ||
43 | |||
44 | <p>By default, the manpage is opened in a horizontal split, I prefer using a new tab:</p> | ||
45 | |||
46 | <pre><code>let g:ft_man_open_mode = 'tab' | ||
47 | </code></pre> | ||
48 | |||
49 | <p><strong>Scratchpad to test your commands</strong>. I often test my <code>sed</code> substitutions, here is | ||
50 | a sample from the script used to generate this site: </p> | ||
51 | |||
52 | <pre><code># a substitution to convert snake_case to Title Case With Spaces | ||
53 | echo "$1" | sed -E -e "s/\..+$//g" -e "s/_(.)/ \u\1/g" -e "s/^(.)/\u\1/g" | ||
54 | </code></pre> | ||
55 | |||
56 | <p>Instead of dropping into a new shell, just test it out directly from vim!</p> | ||
57 | |||
58 | <ul> | ||
59 | <li><p>Yank the link into a register:</p> | ||
60 | |||
61 | <pre><code>yy | ||
62 | </code></pre></li> | ||
63 | <li><p>Paste it into the command-line window:</p> | ||
64 | |||
65 | <pre><code>q:p | ||
66 | </code></pre></li> | ||
67 | <li><p>Make edits as required:</p> | ||
68 | |||
69 | <pre><code>syntax off # previously run commands | ||
70 | edit index.html # in a buffer! | ||
71 | w | so % | ||
72 | echo "new_post.md" | sed -E -e "s/\..+$//g" -e "s/_(.)/ \u\1/g" -e "s/^(.)/\u\1/g" | ||
73 | </code></pre></li> | ||
74 | <li><p>Hit enter!</p> | ||
75 | |||
76 | <pre><code>$ vim | ||
77 | New Post # output | ||
78 | Press ENTER or type command to continue | ||
79 | </code></pre></li> | ||
80 | </ul> | ||
81 | <a href="#bash_harder_with_vim.md" class="post-end-link" onClick="showPost('bash_harder_with_vim.md')">↑ Collapse</a> | ||
82 | <div class=separator></div> | ||
83 | </div> | ||
84 | </div> | ||
85 | |||
86 | <div class="post"> | ||
29 | <div class="date">30/07 2019</div> | 87 | <div class="date">30/07 2019</div> |
30 | <a href="#hold_position!.md" class="post-link" onClick="showPost('hold_position!.md')">Hold Position!</a> | 88 | <a href="#hold_position!.md" class="post-link" onClick="showPost('hold_position!.md')">Hold Position!</a> |
31 | <div id="hold_position!.md" class="post-text" style="display: block"> | 89 | <div id="hold_position!.md" class="post-text" style="display: none"> |
32 | <p>Often times, when I run a vim command that makes “big” changes to a file (a | 90 | <p>Often times, when I run a vim command that makes “big” changes to a file (a |
33 | macro or a <code>:vimgrep</code> command) I lose my original position and feel disoriented.</p> | 91 | macro or a <code>:vimgrep</code> command) I lose my original position and feel disoriented.</p> |
34 | 92 | ||