Wednesday, July 2, 2014

Re: map a chain of commands

On Wed, 2 Jul 2014 13:22:43 -0500
Tim Chase <vim@tim.thechases.com> wrote:

>On 2014-07-02 01:56, Tarlika Elisabeth Schmitz wrote:
>> I would like to map a chain of commands onto a keystroke for use
>> with one specific tab separated file:
>>
>> On the line where the cursor is positioned, I would like to copy
>> field 3, field 18, field 6 to clipboard (separately), but only if
>> they are not empty, so I can paste them one by one in an external
>> application.
>
>[...]

> I *presume* that you mean "{system} clipboard"

yes

>- a clipboard only has one slot for holding things, so pulling in
> multiple things becomes a bit of a non-starter.

I use a clibboard manager and have a history of 50.

>- do you only want to do this if *all* of the fields are non-empty,
> or *any* of the fields are empty?

I want to copy any non-empty field. For example if f18 is empty, I
just want to copy f3 and f6

>It sounds as if something like

Is that the logic you coded below?

> :nnoremap <buffer> <f4> :for idx in [3,18,6]<bar>let
> val=split(getline('.'), '\t')[idx-1]<bar>if strlen(val)<bar>let
> @+=val<bar>call input('Press enter #'.idx)<bar>endif<bar>endfor<cr>

--

Tarlika Elisabeth Schmitz

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment