Dear Timothy,
for all, who are interested in, I finally got it to work (with Your help
and also with chatgpt).
I wrote in okular/settings/configure okular/edior:

> custom editor  gvim --servername GVIM --remote-send "<ESC>:e %f<CR>:call
> SetCursorAdjusted(%l,%c)<CR>"

And I wrote in .vimrc

function! SetCursorAdjusted(line, col)
  " Adjust line number down by 1
  let lnum = a:line - 1
  " Use the cursor function to set the cursor position
  call cursor(lnum, a:col)
endfunction

Now I start gvim with
gvim --servername GVIM
and everything works fine!

Am Mo., 3. Juni 2024 um 10:35 Uhr schrieb Timothy Lanfear <
timo...@lanfear.me>:

> Maybe you could try the call cursor command
>
> vim +"call cursor(%l,%c)" %f
>
> As in David' remarks, you may need to adjust the quoting to get the
> desired result.
>
> vim +"call cursor(5,3)" file.ly
>
> works on the shell command line.
> On 03/06/2024 06:24, Stefan Thomas wrote:
>
> Dear David,
> thanks for Your reply.
> Unfortunately, none of your suggestions have brought the desired result!
> Best,
> Stefan
>
> Am Mo., 3. Juni 2024 um 03:19 Uhr schrieb David Wright <
> lily...@lionunicorn.co.uk>:
>
>> On Sun 02 Jun 2024 at 16:10:56 (+0200), Stefan Thomas wrote:
>> > again, I'm trying to activate point and click in gvim. I made a little
>> > success:
>> > I wrote in the editor options of okular:
>> > gvim --remote-silent +%l %f +normal! %c
>> > When I click on a note, the right document is opened and the cursor is
>> > placed at the correct line, but not at the correct note in the lilypond
>> > file.
>> > What can I do?
>>
>> Perhaps the command you're trying to invoke is, for example:
>>
>>   gvim --remote-silent +:123:norm45l path-to-file
>>
>> using literal constants for line number 123 and column 45.
>>
>> Naively, that would mean okular would have something like:
>>
>>   gvim --remote-silent +:%l:norm%cl %f
>>
>> but, not being familiar with okular, I can't tell how it would
>> handle %cl (where l means move to the right by %c columns) and
>> whether it would need any quoting. For example,
>>
>>   gvim --remote-silent '+:%l:norm%c l' %f
>>
>> might work better.
>>
>> Cheers,
>> David.
>>
> --
> Timothy Lanfear, Bristol, UK.
>
>

Reply via email to