aboutsummaryrefslogtreecommitdiff
path: root/docs/posts/hold_position!.html
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-01-25 17:44:36 +0000
committerAkshay <[email protected]>2020-01-25 17:44:36 +0000
commit5924e263893ac8c47a22a78c88b46c585fc9e82b (patch)
tree2455e8aab84e053d424eeb05f06dbcf079f7c7a6 /docs/posts/hold_position!.html
parent313fb789bbc0bf1dcbdff4b258818ec6d895b5a6 (diff)
update styles, minify links
Diffstat (limited to 'docs/posts/hold_position!.html')
-rw-r--r--docs/posts/hold_position!.html49
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 &#8220;big&#8221; changes to a file (a
22macro 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
27about the view of the current window. This includes the cursor line number,
28cursor coloumn, the top most line in the window and a couple of other values,
29none of which concern us.</p>
30
31<p>Before running our command (one that jumps around the buffer, a lot), we save
32our view, and restore it once its done, with <code>winrestview</code>.</p>
33
34<pre><code>let view = winsaveview()
35s/\s\+$//gc &quot; find and (confirm) replace trailing blanks
36winrestview(view) &quot; restore our original view!
37</code></pre>
38
39<p>It might seem a little overkill in the above example, just use &#8220; (double
40backticks) instead, but it comes in handy when you run your file through
41heavier 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>