Saturday, June 27, 2015

Re: Execute a command from cursor position to the end of the line

On 2015-06-27 05:53, Philip Rhoades wrote:
>>>>> nnoremap <F8> :Execute<CR>
>>>>
>>>>Could you provide the content of your Execute() function? It
>>>>would help to replicate the behavior you want on an extract of
>>>>the line.
[snip stuff that isn't the definition of Execute]
>> I think Tim wanted the definition of the Execute command.
>
> ? I don't know what you mean - as far as I know using
> ":Execute . ." as I showed above in my .vimrc file is a built-in
> Vim thing?

As you write it, it's a function/command brought in by some external
plugin as demonstrated by starting vim without any startup files:

vim -u NONE
:Execute
E492: Not an editor command: Execute

With your regular (started up without the "-u NONE") vim, you can
execute

:verbose function
:verbose command

to see where various items were defined. You want to see where the
"Execute" function/command was created. Based on your invocation
description, it *sounds* like it's a custom command rather than a
function, so you can minimize the noise by issuing

:verbose command Execute

which should give you just the info needed to track down where
"Execute" is defined.

>> Anyway, you can get the content of a line from the cursor to its
>> end with:
>>
>> getline(".")[col(".")-1:]
>>
>> You can pass that to whatever does you execution in you original
>> command.
>
> I still don't get what you are saying - how can I use the F8 key
> (that executes the command on the line in the text file - like I
> described above) with that getline command?

Without the definition of the Execute function it's hard to tell how
to integrate Paul's "remainder of the line" snippet with the Execute
function.

-tim



--
--
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: