Re: Mime-Version: 1.0

13 views
Skip to first unread message

Eli the Bearded

unread,
Apr 18, 2025, 2:28:44 PMApr 18
to dvalin via vim_use

On Fri, 18 Apr 2025, dvalin via vim_use <vim...@googlegroups.com> wrote:
> On 18.04.25 09:43, Marc Chantreux wrote:
>> On Fri, Apr 18, 2025 at 12:08:56AM -0400, Eli the Bearded wrote:
>>> :map * "yyy@y
>> this is an old vi trick, vim can just source a range:

I have been using it a long, long time. I should have included my once
standard explaination (used in many posts in comp.editors over the years
and now below).

>> then you lose the awesome "next occurence of the current word" (see :h *, :h #
>> and :h g*)
> Marc, I took '*' for a placeholder, not a literal, given Eli's evident Vim Fu,

Actually, I use it with * now. I have since before * did that search in
vim. To get back the next occurence of the current word, I have in my
vimrc:

:noremap _ *

Here's how I used to post it in comp.editors:

" yank current line into buffer y and execute;
" mnemonic * is executable in ls -F output
map * "yyy@y

I have two other "must have" macros that my fingers reach for and I will
find myself hand adding in enviroments[*] that lack them:

" split line on previous space character
" mnemonic "S" for split
map S F r<cr>
" double character under cursor
" mnemonic fix = in C: eg if(a=0) to if(a==0)
map = y p

The ironic thing about the = macro is I use it to fix unbalanced
parenthesis much more often than incorrect assignment versus
comparison.

[*] My work life involves opening things in vi/vim/nvi on plenty of
"machines" where I have never previously to that day logged in.
For example short lived virtual machines within network that
I need to write and run a script on to leverage ssh allowed to
that VM, but not others in the network, and firewalls blocking
access to APIs on other VMs in that network from outside the
network.

Elijah
Reply all
Reply to author
Forward
0 new messages