Friday, January 27, 2023

Re: change Vim search key , to .

On Fri, Jan 27, Igor Lerinc wrote:
>I want to change the Vim search key , (semicolon) to . (dot)
>
>When i need to go backward in search results, i use , (semicolon)

I assume that you are talking about , command that is used to repeat
latest f, t, F or T in opposite direction (:help ,).

>but , (semicolon) is <Leader> key in my config, so it wont work, I instead
>want it to make a key . (dot)

It's possible by providing non-recursive mappings for Normal,
Operator-pending and Visual modes

nnoremap . ,
onoremap . ,
xnoremap . ,

However, you may not want to shadow . command. It's used in normal mode
to repeat last change (:help .). For example, you can use double-tap
comma instead

nnoremap <Leader>, ,
onoremap <Leader>, ,
xnoremap <Leader>, ,

-Dmitri

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/Y9RE7qBp4PUW3Lsr%40angmar.

change Vim search key , to .

I want to change the Vim search key , (semicolon) to . (dot)

When i need to go backward in search results, i use , (semicolon)

but ,  (semicolon) is <Leader> key in my config, so it wont work, I instead want it to make a key  .  (dot)





--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CADZsa2oqXB-vYcg6RZbea2eSYOz6n%3DPtWmQCt0iYEAeAjC6DJw%40mail.gmail.com.

Wednesday, January 25, 2023

vim in onenote, and cherrytree

  i use extensively onenote for work, classes, everything, and cherrytree, but, i find Vim way of doing things much better. 

is there some way, to make it Vim compatible ?

as i dont write my notes in plain txt, i need organisation it provides. 

does notion support Vim mode? should i use notion?

but i also depent on my .vimrc, as that's how i find it intuitive and useful, can something provide me that ?

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CADZsa2pwdbfQSK96xUDm0fdEhQE2bLGEQ8jXmsP2z9xp8i0MzA%40mail.gmail.com.

Monday, January 23, 2023

How to prevent vim asking to reload /dev/fd?

Hi,

After I run the following command (in MacVim),

vimdiff <(seq 3) <(seq 4)

then switch to another window and switch it back, vim will ask me something like this.

W11: Warning: File "/dev/fd/63" has changed since editing started
See ":help W11" for more info.
[O]K, (L)oad File, Load File (a)nd Options:

My ~/.vimrc has this line.

autocmd BufRead /dev/fd/* setlocal noautoread

If I remove it, vimdiff will automatically update the screen corresponding to /dev/fd/*, so the screen then will contain empty content.

How to completely disable vim from reload /dev/fd/* (not even asking anything)?

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/d2f8e188-3a64-454c-8f24-a330f63fe664n%40googlegroups.com.

Saturday, January 21, 2023

Re: would my config be used?

Ich changed this in my_config.vim there is the set relativenumber option. 

Am Sa., 21. Jan. 2023 um 16:16 Uhr schrieb Owajigbanam Ogbuluijah <xigbanam@gmail.com>:
Can you try adding set relativenumber to your configuration in ~/.vim_runtime? Does this work?

There's no place in amix/vimrc which explicitly sets or unsets relativenumber. But my guess is you can customize anything you want in your my_config.vim

On Sat, Jan 21, 2023 at 12:11 PM 'Sebastian Gödecke' via vim_use <vim_use@googlegroups.com> wrote:
Hi there, 
i want to use a vim-configuration, that should be on every maschine, i connect with. 
I use this here:
By creating a my_config.vim in main folder ~/.vim_runtime/ and configured a "real nice" config. There is an option be set with "set relativenumber" but this would be used, because i don't see it. I even don't see "set number". When i'm adding this in a running vim it worked perfect. 
So someone has an idea, why my config with this option wouldn't be set? I check the dependencies and all were setup right. 

Does someone of u has an idea?
Thanks and regards Sebastian

--
Mit freundlichen Grüßen
Sebastian Gödecke

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJRNCbZ10pxYsuEDoDre%3DDuiyf3yNctFVhbYa94xPvnw6G%2BhHg%40mail.gmail.com.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAOmRJrejX_F_7hH0UuQ-wc%2BOjyveRQS%3DLds6K3j26UzP0H-f8w%40mail.gmail.com.


--
Mit freundlichen Grüßen
Sebastian Gödecke

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJRNCbaJ5pbVuTAsboiYYRcbvtqy0czn6c_BwxnG4%2BBPoW-9Uw%40mail.gmail.com.

Re: Why does (my) Vim leave the cursor to the last mark even if I don't save the file?

* Marvin Renich <mrvn@renich.org> [230121 10:53]:
> * Bram Moolenaar <Bram@moolenaar.net> [230120 11:01]:
> >
> > > I think what he is asking is for the " mark to only be written to the
> > > viminfo file for buffers that have been modified. I'm not sure how to
> > > do this or if it is even possible, but it seems like a perfectly
> > > reasonable behavior to want.
> > >
> > > Perhaps a VimLeavePre autocommand that wipes unmodified buffers? What
> > > other settings for those buffers would not be saved to .viminfo?
> >
> > How about:
> > - When writing the buffer set some flag, e.g. b:did_write_this_buf
> > - When exiting, go through all buffers and those that don't have the
> > b:did_write_this_buf flag move the cursor to the " mark.
> >
> > Something like that.
>
> I don't think we need another flag; just use the 'modified' option. I
> think this is what the OP wants, and is simpler.
>
> I also think Salman Halim's suggestion of using the . mark instead of the
> " mark is more useful.

Note that what the OP wants (don't update " mark for non-modified
buffers) requires changing the code that writes .viminfo, which I think
is in the source, not the runtime.

If you change defaults.vim to use the . mark instead, the OP is going to
get very close to the behavior he wants (he may even like it better than
what he asked for), and no change to the Vim source is needed.

I suspect that most Vim users will prefer the . mark behavior over the
current behavior, but if not, they can easily get the old behavior back;
just leave the old BufReadPost as a comment in defaults.vim, and they
can copy it to their own vimrc.

I think this is the best solution all around.

...Marvin

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/Y8wOqZXZuVPFSJg1%40basil.wdw.

Re: Why does (my) Vim leave the cursor to the last mark even if I don't save the file?

* Bram Moolenaar <Bram@moolenaar.net> [230120 11:01]:
>
> > I think what he is asking is for the " mark to only be written to the
> > viminfo file for buffers that have been modified. I'm not sure how to
> > do this or if it is even possible, but it seems like a perfectly
> > reasonable behavior to want.
> >
> > Perhaps a VimLeavePre autocommand that wipes unmodified buffers? What
> > other settings for those buffers would not be saved to .viminfo?
>
> How about:
> - When writing the buffer set some flag, e.g. b:did_write_this_buf
> - When exiting, go through all buffers and those that don't have the
> b:did_write_this_buf flag move the cursor to the " mark.
>
> Something like that.

I don't think we need another flag; just use the 'modified' option. I
think this is what the OP wants, and is simpler.

I also think Salman Halim's suggestion of using the . mark instead of the
" mark is more useful.

...Marvin

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/Y8wKilsT9IqIj56h%40basil.wdw.

Re: would my config be used?

Can you try adding set relativenumber to your configuration in ~/.vim_runtime? Does this work?

There's no place in amix/vimrc which explicitly sets or unsets relativenumber. But my guess is you can customize anything you want in your my_config.vim

On Sat, Jan 21, 2023 at 12:11 PM 'Sebastian Gödecke' via vim_use <vim_use@googlegroups.com> wrote:
Hi there, 
i want to use a vim-configuration, that should be on every maschine, i connect with. 
I use this here:
By creating a my_config.vim in main folder ~/.vim_runtime/ and configured a "real nice" config. There is an option be set with "set relativenumber" but this would be used, because i don't see it. I even don't see "set number". When i'm adding this in a running vim it worked perfect. 
So someone has an idea, why my config with this option wouldn't be set? I check the dependencies and all were setup right. 

Does someone of u has an idea?
Thanks and regards Sebastian

--
Mit freundlichen Grüßen
Sebastian Gödecke

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJRNCbZ10pxYsuEDoDre%3DDuiyf3yNctFVhbYa94xPvnw6G%2BhHg%40mail.gmail.com.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAOmRJrejX_F_7hH0UuQ-wc%2BOjyveRQS%3DLds6K3j26UzP0H-f8w%40mail.gmail.com.

would my config be used?

Hi there, 
i want to use a vim-configuration, that should be on every maschine, i connect with. 
I use this here:
By creating a my_config.vim in main folder ~/.vim_runtime/ and configured a "real nice" config. There is an option be set with "set relativenumber" but this would be used, because i don't see it. I even don't see "set number". When i'm adding this in a running vim it worked perfect. 
So someone has an idea, why my config with this option wouldn't be set? I check the dependencies and all were setup right. 

Does someone of u has an idea?
Thanks and regards Sebastian

--
Mit freundlichen Grüßen
Sebastian Gödecke

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJRNCbZ10pxYsuEDoDre%3DDuiyf3yNctFVhbYa94xPvnw6G%2BhHg%40mail.gmail.com.

Friday, January 20, 2023

Re: Using Vim9 for a function

> On Fri, Jan 20, 2023 at 1:48 AM andalou <cesar.romani@gmail.com> wrote:
> >
> >
> > I'm using vim 9.1221 on Windows 10. I tried to create a function using
> > Vim9, as in:
> >
> > def! Foo(a: float, b: float): float
> > return a + b
> > enddef
> >
> > If I call Foo(1.2, 5.0) I get the answer 6.2
> >
> > but if I call Foo(1.2, 5) I get:
> >
> > E1013: Argument 2:type mismatch, expected float but got number
> >
> > How can I modify the function to make it possible to call Foo(1.2, 5)
> > and get a result.
> >
> > Many thanks in advance,
> >
> > --
> > Cesar
>
> IIUC, allowing a Number to be used where a Float is expected is
> permitted in Vim pre-9 but forbidden in Vim 9.
>
> Solution 1: Use "function" instead of "def". This will make your
> function a "legacy function" and it won't need strict-typed arguments:
>
> :function Foo(a, b)
> :return a + b
> :endfunction
>
> Solution 2: call Foo(1.2, 5.0) instead.

I believe most users expect an integer number to work where a float is
expected. We encountered this before, then it was causing an invalid
result and it was solved by giving an error message. I'll make another
change that actually converts the number to a float, that should better
match expectations.


--
If you put seven of the most talented OSS developers in a room
and ask them to fix a bug in a spreadsheet program, in one week
you'd have 2 new mail readers and a text-based web browser.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230120182246.D70281C09EE%40moolenaar.net.

Re: Why does (my) Vim leave the cursor to the last mark even if I don't save the file?



On Fri, Jan 20, 2023 at 11:01 AM Bram Moolenaar <Bram@moolenaar.net> wrote:

> I think what he is asking is for the " mark to only be written to the
> viminfo file for buffers that have been modified.  I'm not sure how to
> do this or if it is even possible, but it seems like a perfectly
> reasonable behavior to want.
>
> Perhaps a VimLeavePre autocommand that wipes unmodified buffers?  What
> other settings for those buffers would not be saved to .viminfo?

How about:
- When writing the buffer set some flag, e.g. b:did_write_this_buf
- When exiting, go through all buffers and those that don't have the
  b:did_write_this_buf flag move the cursor to the " mark.

Something like that.

It might also be better to go to the '. mark instead of leaving it where it ends up, if you DID make a change, so you're going back to the last place where a change was actually made rather than just where the cursor was when you closed the file, in case you moved around a bit after making a change.

This isn't what was asked, but I like to ignore the mark when opening certain files and go to a specific place in the file rather than where the cursor was, so I use this (legacy Vim script because I wrote it over a many years ago):

let g:noRestorePositionList = {}

let g:noRestorePositionList[ 'COMMIT_EDITMSG' ] = 'top'
let g:noRestorePositionList[ 'bugs\.vim' ]      = 'bottom'
let g:noRestorePositionList[ '.*\.money' ]      = 'ignore'

function! GoToLastEditedPosition()
  let filename = expand( "%:t" )

  let matchFound = 0
  let position   = ''

  for key in keys( g:noRestorePositionList )
    if ( filename =~? key )
      let matchFound = 1
      let position   = g:noRestorePositionList[ key ]
    endif
  endfor

  if ( matchFound )
    " Can't just execute 1 or $ because we don't just want to go to the line, but rather the beginning of the line
    if ( position == 'top' )
      normal! gg0
    elseif ( position == 'bottom' )
      normal! G0
    endif

    " Ignore empty value or if the value is 'ignore'.

    return
  endif

  let lastLine = line( "'\"" )

  if ( lastLine > 0 && lastLine <= line( '$' ) )
    " Go to the last cursor location and center it on the screen
    normal! g`"zz
  endif
endfunction

augroup lastedit
  " Go to the last edited position if it's valid and move it to the middle of the screen
  au BufReadPost * call GoToLastEditedPosition()
augroup END

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CANuxnEdf1D99VT95tmiV377G%2BsdJ-_1VfLFjCybP1A8taNA7TQ%40mail.gmail.com.

Re: Using Vim9 for a function

On Fri, Jan 20, 2023 at 1:48 AM andalou <cesar.romani@gmail.com> wrote:
>
>
> I'm using vim 9.1221 on Windows 10. I tried to create a function using
> Vim9, as in:
>
> def! Foo(a: float, b: float): float
> return a + b
> enddef
>
> If I call Foo(1.2, 5.0) I get the answer 6.2
>
> but if I call Foo(1.2, 5) I get:
>
> E1013: Argument 2:type mismatch, expected float but got number
>
> How can I modify the function to make it possible to call Foo(1.2, 5)
> and get a result.
>
> Many thanks in advance,
>
> --
> Cesar

IIUC, allowing a Number to be used where a Float is expected is
permitted in Vim pre-9 but forbidden in Vim 9.

Solution 1: Use "function" instead of "def". This will make your
function a "legacy function" and it won't need strict-typed arguments:

:function Foo(a, b)
:return a + b
:endfunction

Solution 2: call Foo(1.2, 5.0) instead.

Best regards,
Tony.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXvFR7fTBp%2BvKKsKt4c9HDJP0H04OJ5kvBJe_C7S9mh0KA%40mail.gmail.com.

Re: Why does (my) Vim leave the cursor to the last mark even if I don't save the file?

Ah, thanks Manfred.
Tony.

On Fri, Jan 20, 2023 at 10:30 AM Manfred Lotz <ml_news@posteo.de> wrote:
>
>
>
> On 1/20/23 08:38, Christian Brabandt wrote:
> >
> > On Do, 19 Jan 2023, Tony Mechelynck wrote:
> >
> >>> Es mag zu meinem Vorteil oder Nachteil ausfallen, ich fürchte nicht,
> >>> so gesehen zu werden, wie ich bin.
> >>> -- Jean Jacques Rousseau (an Malesherbes, 1762)
> >>>
> >> @Christian: weißt Du wie Jean-Jacques Rousseau dies auf Französisch schreibte?
> >
> > Unfortunately Not. And my French is very bad, had it in school for 5
> > years and I do not remember anything, just enough for:
> > Je ne parle pas francais :)
> >
>
> I asked ChatGPT and it gave
>
> "Ce qu'on pense de moi, et qui puisse tourner à mon avantage ou à mon
> désavantage, ne me fait point d'appréhension; je suis ce que je suis." –
>
> Jean-Jacques Rousseau, à Malesherbes, 1762.
>
>
> As link it had:
>
> https://www.goodreads.com/quotes/933781-ce-qu-on-pense-de-moi-et-qui-puissetourner-à-mon
>
> but the link doesn't work and ChatGPT wasn't able to provide a working link.
>
>
> --
> Manfred
>
> --
> --
> 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.
> To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/95769a3f-415d-b5c2-1f2d-1e925b02d4e4%40posteo.de.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXuRuBitpozSR%2BcsQBuQ1HmKpepW8EuJHXZECqcQ%2Bm%3D9Lg%40mail.gmail.com.

Re: Why does (my) Vim leave the cursor to the last mark even if I don't save the file?

> I think what he is asking is for the " mark to only be written to the
> viminfo file for buffers that have been modified. I'm not sure how to
> do this or if it is even possible, but it seems like a perfectly
> reasonable behavior to want.
>
> Perhaps a VimLeavePre autocommand that wipes unmodified buffers? What
> other settings for those buffers would not be saved to .viminfo?

How about:
- When writing the buffer set some flag, e.g. b:did_write_this_buf
- When exiting, go through all buffers and those that don't have the
b:did_write_this_buf flag move the cursor to the " mark.

Something like that.

--
What a wonderfully exciting cough! Do you mind if I join you?
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230120160124.1A0801C09EE%40moolenaar.net.

Re: [remove horizontal and vertical guidelines]

Hello Chris et al.,

How are you? Thank you very much for your suggestions! I checked the value of the 'term' variable. It was set to 'xterm-256color' in both Konsole and Yakuake. Once I set it to 'builtin_xterm' the artefact lines disappeared! Thank you very much for your help! I don't know what the 'term' variable does yet. I need to read up on it. I wasn't using 'tmux' or any other multiplexer. Have a wonderful weekend everyone!

Best wishes,
Maxim

Maxim Abalenkov \\ maxim.abalenkov@gmail.com
+44 7 486 486 505 \\ www.maxim.abalenkov.uk

On 19 Jan 2023, at 12:04, Christian Brabandt <cblists@256bit.org> wrote:


On Do, 19 Jan 2023, Maxim Abalenkov wrote:

I'm still struggling with these artefacts. I can confirm, I'm using the same terminal font as before. I tried to use another font, but these artefacts remained. I fiddled with the linespace and redraw commands. Changing their values didn't help. I tried to downgrade Vim to a few versions down, but not below 9.x.y.z. I
tried to downgrade Yakuake and Konsole terminal emulators to a few versions down. But that didn't resolve my issue either. The only thing that worked was using another terminal emulator—Alacritty. There I see no artefacts. Hurrah! But I would still like to fix it and make it work in Yakuake and Konsole. Please let me
know, if you have any more suggestions. Thank you and have a wonderful day ahead!

This might be causes by setting $TERM wrongly. What is it set to? What
does :set term? show for both Yakuake and Konsole?

Can you try :set term=builtin_xterm

Also, are you using tmux or anything related? Have you tried without it?

Best,
Chris
--
Es gibt Menschen, die nur lesen, um nicht denken zu müssen.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230119120405.GB1041827%40256bit.org.

Re: Why does (my) Vim leave the cursor to the last mark even if I don't save the file?

* Christian Brabandt <cblists@256bit.org> [230120 05:39]:
>
> On Fr, 20 Jan 2023, 'Ottavio Caruso' via vim_use wrote:
>
> > Am 19/01/2023 um 16:40 schrieb Christian Brabandt:
> > > On Do, 19 Jan 2023, 'Ottavio Caruso' via vim_use wrote:
> > > > $ cat .vim/vimrc
> > > > source $VIMRUNTIME/defaults.vim
> > > This is where the auto command is defined. If you do not want it, you
> > > can delete this after sourcing the defauls.vim file:
> > >
> > > :augroup vimStartup | au! | augroup END
> >
> > Thanks, but if do that, I'd then remove this feature from all files, whether
> > edited or not, wouldn't I?. Is it possible to have this implemented only on
> > files that are saved?
>
> I would find it inconsistent for somtimes jumping to a different spot in
> a file and sometimes not. I might not even remember if I last time saved
> that particular file or not (e.g. I just need to check something but did
> not save the file). That might be confusing.
>
> It might be possible to change that behaviour using a custom function
> (e.g. set a flag on BufWritePost, check that flag on a BufLeave
> autocomamnd and set the '" mark accordingly). Not sure if this will work
> or not.
>
> Mit freundlichen Grüßen
> Christian

I think what he is asking is for the " mark to only be written to the
viminfo file for buffers that have been modified. I'm not sure how to
do this or if it is even possible, but it seems like a perfectly
reasonable behavior to want.

Perhaps a VimLeavePre autocommand that wipes unmodified buffers? What
other settings for those buffers would not be saved to .viminfo?

...Marvin

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/Y8qX%2B2Ilouc3PmUq%40basil.wdw.

Re: Why does (my) Vim leave the cursor to the last mark even if I don't save the file?

On Fr, 20 Jan 2023, 'Ottavio Caruso' via vim_use wrote:

> Am 19/01/2023 um 16:40 schrieb Christian Brabandt:
> > On Do, 19 Jan 2023, 'Ottavio Caruso' via vim_use wrote:
> > > $ cat .vim/vimrc
> > > source $VIMRUNTIME/defaults.vim
> > This is where the auto command is defined. If you do not want it, you
> > can delete this after sourcing the defauls.vim file:
> >
> > :augroup vimStartup | au! | augroup END
>
> Thanks, but if do that, I'd then remove this feature from all files, whether
> edited or not, wouldn't I?. Is it possible to have this implemented only on
> files that are saved?

I would find it inconsistent for somtimes jumping to a different spot in
a file and sometimes not. I might not even remember if I last time saved
that particular file or not (e.g. I just need to check something but did
not save the file). That might be confusing.

It might be possible to change that behaviour using a custom function
(e.g. set a flag on BufWritePost, check that flag on a BufLeave
autocomamnd and set the '" mark accordingly). Not sure if this will work
or not.

Mit freundlichen Grüßen
Christian
--
Herr, du hast mir das Können genommen, so nimm mir auch noch das Wollen.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230120103943.GE1041827%40256bit.org.

Re: Why does (my) Vim leave the cursor to the last mark even if I don't save the file?

Am 19/01/2023 um 16:40 schrieb Christian Brabandt:
> On Do, 19 Jan 2023, 'Ottavio Caruso' via vim_use wrote:
>
>> Ok, the title is probably not accurate, so I'll try to explain.
>>
>>
>> Let's say I have a file with 5 lines
>>
>> --------------------------
>>
>> This is line 1
>> Another line
>> More lines
>> Even more lines
>> This is the last line
>>
>> -------------------------
>>
>> I save the file (Esc w q). When I reopen it, the cursor is at the end of
>> line 5.
>>
>> Then I move the cursor up two lines. I quit without saving (Esc q!).
>>
>> When I reopen the file, the cursor is now at the 3rd line.
>>
>> Is this intended behaviour? If so, how can I tell Vim to ignore movements
>> but just this time?
>>
> The behaviour you are seeing, comes from a BufReadPost autocommand, that
> restores the last cursor position. It's defined in the help below
> :h last-position-jump
>
>> $ cat .vim/vimrc
>> source $VIMRUNTIME/defaults.vim
> This is where the auto command is defined. If you do not want it, you
> can delete this after sourcing the defauls.vim file:
>
> :augroup vimStartup | au! | augroup END

Thanks, but if do that, I'd then remove this feature from all files,
whether edited or not, wouldn't I?. Is it possible to have this
implemented only on files that are saved?

--
Ottavio Caruso

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/0b4a48c8-e18c-e563-08e4-30f8a44f0d13%40yahoo.com.

Re: Why does (my) Vim leave the cursor to the last mark even if I don't save the file?

On 1/20/23 08:38, Christian Brabandt wrote:
>
> On Do, 19 Jan 2023, Tony Mechelynck wrote:
>
>>> Es mag zu meinem Vorteil oder Nachteil ausfallen, ich fürchte nicht,
>>> so gesehen zu werden, wie ich bin.
>>> -- Jean Jacques Rousseau (an Malesherbes, 1762)
>>>
>> @Christian: weißt Du wie Jean-Jacques Rousseau dies auf Französisch schreibte?
>
> Unfortunately Not. And my French is very bad, had it in school for 5
> years and I do not remember anything, just enough for:
> Je ne parle pas francais :)
>

I asked ChatGPT and it gave

"Ce qu'on pense de moi, et qui puisse tourner à mon avantage ou à mon
désavantage, ne me fait point d'appréhension; je suis ce que je suis." –

Jean-Jacques Rousseau, à Malesherbes, 1762.


As link it had:

https://www.goodreads.com/quotes/933781-ce-qu-on-pense-de-moi-et-qui-puissetourner-à-mon

but the link doesn't work and ChatGPT wasn't able to provide a working link.


--
Manfred

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/95769a3f-415d-b5c2-1f2d-1e925b02d4e4%40posteo.de.

Thursday, January 19, 2023

Re: Why does (my) Vim leave the cursor to the last mark even if I don't save the file?

On Do, 19 Jan 2023, Tony Mechelynck wrote:

> > Es mag zu meinem Vorteil oder Nachteil ausfallen, ich fürchte nicht,
> > so gesehen zu werden, wie ich bin.
> > -- Jean Jacques Rousseau (an Malesherbes, 1762)
> >
> @Christian: weißt Du wie Jean-Jacques Rousseau dies auf Französisch schreibte?

Unfortunately Not. And my French is very bad, had it in school for 5
years and I do not remember anything, just enough for:
Je ne parle pas francais :)

Best,
Chris

--
Am Abend wird man klug
Für den vergangenen Tag,
Doch niemals klug genug
Für den, der kommen mag.
-- Friedrich Rückert (Gedichte, Pseudonym: Freimund Raimar)

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230120073827.GD1041827%40256bit.org.

Using Vim9 for a function


I'm using vim 9.1221 on Windows 10. I tried to create a function using
Vim9, as in:

def! Foo(a: float, b: float): float
  return a + b
enddef

If I call Foo(1.2, 5.0) I get the answer 6.2

but if I call Foo(1.2, 5) I get:

E1013: Argument 2:type mismatch, expected float but got number

How can I modify the function to make it possible to call Foo(1.2, 5)
and get a result.

Many thanks in advance,

--
Cesar

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/84364d7b-916a-4e85-ab3c-b7009efb7176n%40googlegroups.com.

Re: Why does (my) Vim leave the cursor to the last mark even if I don't save the file?

On Thu, Jan 19, 2023 at 5:40 PM Christian Brabandt <cblists@256bit.org> wrote:
>
>
> On Do, 19 Jan 2023, 'Ottavio Caruso' via vim_use wrote:
>
> > Ok, the title is probably not accurate, so I'll try to explain.
> >
> >
> > Let's say I have a file with 5 lines
> >
> > --------------------------
> >
> > This is line 1
> > Another line
> > More lines
> > Even more lines
> > This is the last line
> >
> > -------------------------
> >
> > I save the file (Esc w q). When I reopen it, the cursor is at the end of
> > line 5.
> >
> > Then I move the cursor up two lines. I quit without saving (Esc q!).
> >
> > When I reopen the file, the cursor is now at the 3rd line.
> >
> > Is this intended behaviour? If so, how can I tell Vim to ignore movements
> > but just this time?
> >
>
> The behaviour you are seeing, comes from a BufReadPost autocommand, that
> restores the last cursor position. It's defined in the help below
> :h last-position-jump
>
> > $ cat .vim/vimrc
> > source $VIMRUNTIME/defaults.vim
>
> This is where the auto command is defined. If you do not want it, you
> can delete this after sourcing the defauls.vim file:
>
> :augroup vimStartup | au! | augroup END

Yes, indeed, you can suppress it if you want: everything (or almost)
is configurable in Vim (and I just checked: it is the only autocommand
in group vimStartup so no side-effects). Or else, you can decide that
it is a feature, not a bug, and enjoy having all your editfiles
reopened just where you were the last time you used them and not
always at the very top.

Best regards,
Tony.
>
>
> Best
> Christian
> --
> Es mag zu meinem Vorteil oder Nachteil ausfallen, ich fürchte nicht,
> so gesehen zu werden, wie ich bin.
> -- Jean Jacques Rousseau (an Malesherbes, 1762)
>
@Christian: weißt Du wie Jean-Jacques Rousseau dies auf Französisch schreibte?

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXvbK0JuCdb9CBiGhPWWjsGW83K3nY8OjuC3t9%2BP8-JJcQ%40mail.gmail.com.

Re: Why does (my) Vim leave the cursor to the last mark even if I don't save the file?

On Do, 19 Jan 2023, 'Ottavio Caruso' via vim_use wrote:

> Ok, the title is probably not accurate, so I'll try to explain.
>
>
> Let's say I have a file with 5 lines
>
> --------------------------
>
> This is line 1
> Another line
> More lines
> Even more lines
> This is the last line
>
> -------------------------
>
> I save the file (Esc w q). When I reopen it, the cursor is at the end of
> line 5.
>
> Then I move the cursor up two lines. I quit without saving (Esc q!).
>
> When I reopen the file, the cursor is now at the 3rd line.
>
> Is this intended behaviour? If so, how can I tell Vim to ignore movements
> but just this time?
>

The behaviour you are seeing, comes from a BufReadPost autocommand, that
restores the last cursor position. It's defined in the help below
:h last-position-jump

> $ cat .vim/vimrc
> source $VIMRUNTIME/defaults.vim

This is where the auto command is defined. If you do not want it, you
can delete this after sourcing the defauls.vim file:

:augroup vimStartup | au! | augroup END


Best
Christian
--
Es mag zu meinem Vorteil oder Nachteil ausfallen, ich fürchte nicht,
so gesehen zu werden, wie ich bin.
-- Jean Jacques Rousseau (an Malesherbes, 1762)

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230119164045.GC1041827%40256bit.org.

Why does (my) Vim leave the cursor to the last mark even if I don't save the file?

Ok, the title is probably not accurate, so I'll try to explain.


Let's say I have a file with 5 lines

--------------------------

This is line 1
Another line
More lines
Even more lines
This is the last line

-------------------------

I save the file (Esc w q). When I reopen it, the cursor is at the end of
line 5.

Then I move the cursor up two lines. I quit without saving (Esc q!).

When I reopen the file, the cursor is now at the 3rd line.

Is this intended behaviour? If so, how can I tell Vim to ignore
movements but just this time?

$ cat .vim/vimrc
source $VIMRUNTIME/defaults.vim

"set shellcmdflag=-ic
set dir=~/.vim/tmp
set expandtab
set autoindent
set mouse=r

digraph bl 8226 " Insert Bullet with <CTRL>+k bl


iabbrev cwd <C-R>=strftime("%a %d/%m %H:%M")
iabbrev mydate <C-R>=strftime("%a %d/%m/%Y")
iabbrev mydate2 <C-R>=strftime("%Y%m%d")

map <f5> :1m$<cr>








--
Ottavio Caruso

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/66b03b8d-a530-b179-ed9b-f7fc6f8975e7%40yahoo.com.

Re: [remove horizontal and vertical guidelines]

On Do, 19 Jan 2023, Maxim Abalenkov wrote:

> I'm still struggling with these artefacts. I can confirm, I'm using the same terminal font as before. I tried to use another font, but these artefacts remained. I fiddled with the linespace and redraw commands. Changing their values didn't help. I tried to downgrade Vim to a few versions down, but not below 9.x.y.z. I
> tried to downgrade Yakuake and Konsole terminal emulators to a few versions down. But that didn't resolve my issue either. The only thing that worked was using another terminal emulator—Alacritty. There I see no artefacts. Hurrah! But I would still like to fix it and make it work in Yakuake and Konsole. Please let me
> know, if you have any more suggestions. Thank you and have a wonderful day ahead!

This might be causes by setting $TERM wrongly. What is it set to? What
does :set term? show for both Yakuake and Konsole?

Can you try :set term=builtin_xterm

Also, are you using tmux or anything related? Have you tried without it?

Best,
Chris
--
Es gibt Menschen, die nur lesen, um nicht denken zu müssen.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230119120405.GB1041827%40256bit.org.

Re: [remove horizontal and vertical guidelines]

Dear all,

I'm still struggling with these artefacts. I can confirm, I'm using the same terminal font as before. I tried to use another font, but these artefacts remained. I fiddled with the linespace and redraw commands. Changing their values didn't help. I tried to downgrade Vim to a few versions down, but not below 9.x.y.z. I tried to downgrade Yakuake and Konsole terminal emulators to a few versions down. But that didn't resolve my issue either. The only thing that worked was using another terminal emulator—Alacritty. There I see no artefacts. Hurrah! But I would still like to fix it and make it work in Yakuake and Konsole. Please let me know, if you have any more suggestions. Thank you and have a wonderful day ahead!

Best wishes,
Maxim

Maxim Abalenkov \\ maxim.abalenkov@gmail.com
+44 7 486 486 505 \\ www.maxim.abalenkov.uk

On 12 Jan 2023, at 17:19, BPJ <bpj@melroch.se> wrote:



Den tors 12 jan. 2023 12:02Maxim Abalenkov <maxim.abalenkov@gmail.com> skrev:
Dear all,

Thank you for your replies. Please see a PNG image attached. It has an example of these guide lines. These are not cursor lines. I tried enabling and disabling cursor lines. But those are something else. The cursor lines are disabled, but I still see the guide lines.

I tried to use another colour scheme in Vim and surprisingly it removed all the guide lines. It must be the colour scheme that introduces them. I just need to figure out what option enables them. The scheme in question is 'solarized8_dark'. There is a clash with the new version of Vim and the scheme setting. Thank you for your help!

Those are no "guide lines", its a renderer artifact, whether (only) from the colorscheme or (also) from the terminal. I get something like that sometimes after a filter operation or when turning on a sleeping screen in both Gnome terminal and Termux. A :redraw usually takes care of that. Have you tried to change the value of 'linespace'? Are you sure that your terminal uses the same font as before? Those are the things I would check if I got something like that.


Best wishes,
Maxim


Maxim Abalenkov \\ maxim.abalenkov@gmail.com
+44 7 486 486 505 \\ www.maxim.abalenkov.uk

On 12 Jan 2023, at 08:52, BPJ <bpj@melroch.se> wrote:



Den tors 12 jan. 2023 08:51Maxim Abalenkov <maxim.abalenkov@gmail.com> skrev:
Dear all,

I need help please. Yesterday I updated Vim to 9.0 including patches 1-1046. I'm using ArchLinux. I updated using a package manager called 'pacman'. Since then I have horizontal and vertical guide lines when I edit files in Vim. I find it distracting. Would you please advise me, on how to disable them? Thank you and have a wonderful day ahead!

Maybe :h 'cursorcolumn' and :h 'cursorline' ? (I.e. :set nocursorcolumn and :set nocursorline)

/bpj



Best wishes,
Maxim

Maxim Abalenkov \\ maxim.abalenkov@gmail.com
+44 7 486 486 505 \\ www.maxim.abalenkov.uk

-- 
-- 
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/52F393BE-B970-4D6F-AB78-CDBF3A369CDC%40gmail.com.

-- 
-- 
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CADAJKhCfXxXpf2jvJXNanezH_1W7-kj-r%2BQ_iz1hMb0_PBikNg%40mail.gmail.com.


-- 
-- 
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/638C4429-0471-4F60-BB7F-252B82CE98BD%40gmail.com.

-- 
-- 
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CADAJKhCSjkmD6hoVMeQE64rB-7%2BcezpbzR7cziwgeVoEx8RU_w%40mail.gmail.com.
<guide_lines.png>

Sunday, January 15, 2023

Re: Searching across a range of lines



On Sat, Jan 14, 2023 at 1:55 PM Stan Brown <the_stan_brown@fastmail.fm> wrote:
>     While possibly not quite what you're looking for, if I want such, I use
> ...>       :50,100g/cat/#
>
> Tim, this doesn't do what I'm trying to do, but the bigger problem is
> that :g absolutely moves the cursor, putting it on the last found match.

I use :g as Tim does. I don't particularly want the cursor moved, but
after looking at the results I simply type `` and the cursor is back
where it was.

I'm not questioning the utility of this at all; I use various versions of this myself. However, I was trying to build something that could be used in a script, not something I'm using to examine the results from the command-line.

Since you and Tim took time out to respond, here's a version I use for the word under the cursor, in case you find a use for it. It prints all lines that have the word under the cursor with a number before them and then prompts you for the number, jumping to the specified result:

nmap <F4> [I:let nr = input("Which one?  ")<Bar>if nr > 0<bar>execute "normal " . nr ."[\t"<bar>endif<CR>

If you prefix the last [ with a \<c-w> (inside the quotes), it'll jump to that line in a new split, instead, retaining your current cursor location.

All the best,

Salman

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CANuxnEery5bbsQhRHGePgt7%2Ba5Yt%2BK%2ByMT4zU9f0bgyu2K%2BYAw%40mail.gmail.com.

Re: Searching across a range of lines

On Sat, Jan 14, 2023 at 12:53 PM Owajigbanam Ogbuluijah <xigbanam@gmail.com> wrote:
I don't know if you're into completion engines, but coc-java has an "Organize Imports" which does exactly what you're trying to do.

- Igbanam.


Igbanam, I haven't really used completion engines much, to be honest. I had already written an optimize imports script a while ago and was more or less happy with it, but wanted to port it to Vim 9 as an exercise, so thought I would improve it a bit. The original did a lot of in-place manipulation, adding lines, changing import lines in the buffer, moving the cursor around (all with &lazyredraw on, of course), etc. I wanted the new one to read all the import lines into a list, manipulate that list and throw the changed lines down in one single operation. Ideally, also without moving the cursor.

I did get it working with winsaveview() and winrestview(), of course, and I take any added or removed lines into consideration and move the cursor up or down so it remains on the same line in the file as before. I did also come up with a and idea of a wrapper around search() that takes both a start line and (like search() already does, a stop line) and does the search without moving the cursor, but it's cumbersome and I'm not sure it'll be faster than just moving the cursor to the desired start line with winsaveview() and winrestview().

I just figured that if there is a stop line option, there should be a start line option that's not the current cursor position.

Thanks for all your help with this,

Salman

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CANuxnEe8F0spPQ7DpCea%2Bi57U5w3dCQRK9XudTezxLY9KkWfRA%40mail.gmail.com.

Re: [Vim 9 script] Is there a way to get the actual type of an object?

On 2023-01-15, Bram Moolenaar <Bram@moolenaar.net> wrote:
>> Is there a way to distinguish the class of the value returned by
>> [a function]?
>
> Currently not. I have been wondering what would be the best way to
> cover this. We already have type(), but this only returns the basic
> type. For example for list<number> and list<string> it returns the same
> value. It can tell the difference between a list and an object, but not
> between two objects from a different class.
>
> You can use typename(), it will include the name of the class. However,
> it is possible to have the same class name in two separate scripts,
> since they are script-local by default. Thus this may make you think
> it's the same class while it is not.

Ah, that would probably be enough for my use case, as the test in my
case is for script-local objects only.

> Using "instanceof" would work in many places, but you would need to
> import the class to be able to use it. If you only want to know if two
> objects are from the same class, that is extra overhead.
>
> Perhaps we need a variant of type() that is specific about the exact
> type. Then it can also be used to tell the difference between
> list<number> and list<string>. This will be some work to implement,
> because this will mean a new variable type.

To me this falls into the "nice to have" category: I think that most use
cases can be rewritten (possibly verbosely and not elegantly) in a way
that the need for this is avoided. I have a possibly related use case,
but I will post about it in another thread.

Thanks for the comprehensive reply!
Life.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/tq1ob1%24llr%242%40ciao.gmane.io.