diff options
Diffstat (limited to 'docs/posts/hold_position!.html')
-rw-r--r-- | docs/posts/hold_position!.html | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/docs/posts/hold_position!.html b/docs/posts/hold_position!.html deleted file mode 100644 index 8879955..0000000 --- a/docs/posts/hold_position!.html +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <html lang="en"> | ||
3 | <head> | ||
4 | <link rel="stylesheet" href="/style.css"> | ||
5 | <meta charset="UTF-8"> | ||
6 | <meta name="viewport" content="initial-scale=1"> | ||
7 | <meta content="#ffffff" name="theme-color"> | ||
8 | <meta name="HandheldFriendly" content="true"> | ||
9 | <meta property="og:title" content="nerdypepper"> | ||
10 | <meta property="og:type" content="website"> | ||
11 | <meta property="og:description" content="a static site {for, by, about} me "> | ||
12 | <meta property="og:url" content="https://nerdypepper.tech"> | ||
13 | <body> | ||
14 | <div class="posts"> | ||
15 | <div class="post"> | ||
16 | <div class="date">30/07 2019</div> | ||
17 | <span style="font-size: 2rem; font-weight: 600"> | ||
18 | Hold Position! | ||
19 | </span> | ||
20 | <div class="post-text"> | ||
21 | <p>Often times, when I run a vim command that makes “big” changes to a file (a | ||
22 | macro or a <code>:vimgrep</code> command) I lose my original position and feel disoriented.</p> | ||
23 | |||
24 | <p><em>Save position with <code>winsaveview()</code>!</em></p> | ||
25 | |||
26 | <p>The <code>winsaveview()</code> command returns a <code>Dictionary</code> that contains information | ||
27 | about the view of the current window. This includes the cursor line number, | ||
28 | cursor coloumn, the top most line in the window and a couple of other values, | ||
29 | none of which concern us.</p> | ||
30 | |||
31 | <p>Before running our command (one that jumps around the buffer, a lot), we save | ||
32 | our view, and restore it once its done, with <code>winrestview</code>.</p> | ||
33 | |||
34 | <pre><code>let view = winsaveview() | ||
35 | s/\s\+$//gc " find and (confirm) replace trailing blanks | ||
36 | winrestview(view) " restore our original view! | ||
37 | </code></pre> | ||
38 | |||
39 | <p>It might seem a little overkill in the above example, just use “ (double | ||
40 | backticks) instead, but it comes in handy when you run your file through | ||
41 | heavier filtering.</p> | ||
42 | |||
43 | </div> | ||
44 | <a href="/index.html" class="post-end-link">← Back</a> | ||
45 | <div class="separator"></div> | ||
46 | </div> | ||
47 | </div> | ||
48 | </body> | ||
49 | </html> | ||