-
Notifications
You must be signed in to change notification settings - Fork 0
/
feed.xml
124 lines (108 loc) · 6.65 KB
/
feed.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="http://blog.larissareis.org/">
<id>http://blog.larissareis.org/</id>
<title>blog feed</title>
<updated>2015-10-31T00:00:00Z</updated>
<link rel="alternate" href="http://blog.larissareis.org/"/>
<link rel="self" href="http://blog.larissareis.org/feed.xml"/>
<author>
<name>Larissa Reis</name>
<uri>http://blog.larissareis.org</uri>
</author>
<entry>
<id>tag:blog.larissareis.org,2015-10-31:/posts/tmux-mouse-scroll/</id>
<title type="html">How to fix tmux mouse scrolling after 2.1 changes</title>
<published>2015-10-31T00:00:00Z</published>
<updated>2015-10-31T00:00:00Z</updated>
<author>
<name>Larissa Reis</name>
<uri>http://blog.larissareis.org</uri>
</author>
<link rel="alternate" href="http://blog.larissareis.org/posts/tmux-mouse-scroll/"/>
<content type="html"><p><span>I updated tmux to the newest 2.1 version</span> and surprise! my mouse configuration
stopped working. According to the
<a href="https://github.com/tmux/tmux/blob/master/CHANGES">changelog</a>, mouse mode was
rewritten and made a lot simpler. All those options for <code>mouse-{resize,select}</code>
and <code>mode-mouse</code> were thrown away and replaced by one <code>mouse</code> that turns on the
support for mouse inside tmux.</p>
<p>From the manual,</p>
<pre><code>mouse [on | off] If on, tmux captures the mouse and
allows mouse events to be bound as
key bindings. See the MOUSE SUPPORT
section for details.
</code></pre>
<p>I didn’t want to do anything fancy, so just turning on mouse and using the
default bindings were enough to make mouse work again. There was only one little
problem: mouse scrolling was not working. Or rather, it worked only when I was
already inside copy-mode. Apparently the old behavior changed because people
couldn’t agree on how it should work, like how many lines should be skipped. So
now tmux guys decided to keep it simple and let people configure themselves.</p>
<p>I’m using the configuration suggested
<a href="https://www.reddit.com/r/tmux/comments/3paqoi/tmux_21_has_been_released/cw552qd">here</a>
to use the mouse scroll to automatically enter copy-mode to scroll back into
history and leave copy-mode when you’re back at the bottom again. It also passes
through the key press instead of entering copy-mode if there is an alternate
screen, like mutt or less, that will handle the key themselves. I thought that
scrolling half a page was too much so in my tmux.conf I used scroll-up to skip
only one line at a time instead:</p>
<pre><code># makes scroll work
bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
bind-key -t vi-copy WheelUpPane scroll-up
bind-key -t vi-copy WheelDownPane scroll-down
</code></pre>
<p>There is actually a lot of interesting new features introduced for version 2.1,
it’s worth taking a look at the changelog.</p>
</content>
</entry>
<entry>
<id>tag:blog.larissareis.org,2015-07-13:/posts/vim-y-behavior/</id>
<title type="html">Vim Y behavior and yankring</title>
<published>2015-07-13T00:00:00Z</published>
<updated>2015-07-13T00:00:00Z</updated>
<author>
<name>Larissa Reis</name>
<uri>http://blog.larissareis.org</uri>
</author>
<link rel="alternate" href="http://blog.larissareis.org/posts/vim-y-behavior/"/>
<content type="html"><p><span>I’m a loyal Vi(m) soldier in the Editors Holy War</span>, but unfortunately there are
some things on Vi(m) that just don’t make sense to me. One of those things is
the <code>Y</code> behavior.</p>
<p>One of the cool things about Vim is that there is a pattern, a logic that
governs those seemingly chaotic commands. It combines simple commands to perform
tasks (like <code>d[elete]i[nner]w[ord]</code> and <code>d[elete]a[round]w[ord]</code>) and keeps a
certain pattern on how those commands are modified (like d/c and D/C). The yank
command, however, deviates from this last rule in a kind of annoying way.</p>
<p>Just to recap, <code>d</code> command deletes text over motion, while <code>c</code> changes text over
motion (or more accurately, deletes and enter insert mode). So <code>y</code>, as expected,
yanks text over motion. Both <code>d</code> and <code>c</code> have a correspondent <code>D</code> and <code>C</code>
command that deletes/changes text from current position until the end of the
line. So, naturally, you would expect <code>Y</code> to do that same, however, instead it
will copy the whole line! Even Vim documentation acknowledges how illogical that
is.</p>
<pre><code> Y
["x]Y yank [count] lines [into register x] (synonym for
yy, linewise). If you like "Y" to work from the
cursor to the end of line (which is more logical,
but not Vi-compatible) use ":map Y y$".
</code></pre>
<p>I’ve used that mapping the documentation suggests on my vimrc for so long that I
even forget that’s not the original behavior. So imagine my surprise when <code>Y</code>
suddenly stops working after I enabled a few new plugins the other day.</p>
<p>It turns out <a href="http://www.vim.org/scripts/script.php?script_id=1234">YankRing</a>
was overriding my map and using the default Vi(m) <code>Y</code> behavior.</p>
<pre><code>nnoremap Y :&lt;C-U&gt;YRYankCount 'Y'&lt;CR&gt;
</code></pre>
<p>Unfortunately yankring doesn’t have a clean way of customizing mappings it uses
for each yankring key, so it created a workaround with a function
<code>YRRunAfterMaps()</code>, which yankring calls after it has created the maps. So to
get my beloved <code>Y</code> mapping back, all I have to do is use this function to set
the correct mapping on my vimrc:</p>
<pre><code>"make Y consistent with C and D on yankring
function! YRRunAfterMaps()
nnoremap &lt;silent&gt; Y :&lt;C-U&gt;YRYankCount 'y$'&lt;CR&gt;
endfunction
</code></pre>
</content>
</entry>
</feed>