Re: Why vimscript instead of another language? A philosophical or a technical question?

2024-04-28 Thread Tim Chase
On 2024-04-28 22:59, Igbanam Ogbuluijah wrote: > Do I want a setup like this? > > read results back into > +-+ > v | > +-+ write lines out to +--+ (1) > | vim | > | tool | > +-+

Re: Function to find all matches in a string?

2023-12-24 Thread Tim Chase
On 2023-12-24 08:44, aroc...@vex.net wrote: >> I was looking for something similar to Python's re.findall()/finditer() >> function to answer a question on Reddit[1] but was surprised I >> couldn't find anything in > > Are you using Linux, MacOS ,or Windows? In this case, it was FreeBSD (and I'm

Function to find all matches in a string?

2023-12-23 Thread Tim Chase
I was looking for something similar to Python's re.findall()/finditer() function to answer a question on Reddit[1] but was surprised I couldn't find anything in :help function-list The general intent would be to take an input string and return a List containing all the sub-strings matching a

Re: How do you set options in the _vimrc file?

2023-11-22 Thread Tim Chase
On 2023-11-22 19:53, Christian Castro wrote: > Weird thing, Windows doesn???t show that it's write protected > and there is no Windows service for VIM nor is there a VIM > program running as per Task Manager, so I have no idea why > Windows is saying it's not editable, unless VIM has done >

Re: How do you set options in the _vimrc file?

2023-11-20 Thread Tim Chase
On 2023-11-21 00:37, Christian Castro wrote: > How do you change the options in the _vimrc file? It's just a text-file, so you can put in the settings you want. So you can just put these commands in that file: set nohlo set ts=4 set sw=4 > Please let me know if the _vimrc file is editable

Regular expression tokens to identify *screen* lines?

2023-10-30 Thread Tim Chase
I was playing around with tokens like :help /\%l and was curious if there was a way to identify *screen* lines rather than *file* lines. So imagining something like "\%5H" or "\%3L" would match the fifth-from-top line or the third-from-bottom line of the screen. The initial idea was some

Re: Prevent copying of pasted-over text to register.

2023-08-10 Thread Tim Chase
On 2023-08-10 03:37, DwigtArmyOfChampions wrote: > I have some text in my register and I want to overwrite some > existing text with the contents of the register. So I go into > visual mode and highlight the text I want to replace, then I > type P and the contents of the register get replaced. OK,

Re: How to disable and replace Vim's standard formatting of Pascal

2023-06-14 Thread Tim Chase
On 2023-06-14 16:44, Steve Litt wrote: > >??? $VIMRUNTIME/ and its subdirectories contain scripts coming from the [snip > Oh oh. See following command line session: > > == > [slitt@mydesk .vim]$ echo $VIMRUNTIME > > [slitt@mydesk .vim]$ echo $VIM >

Re: How to disable and replace Vim's standard formatting of Pascal

2023-06-13 Thread Tim Chase
On 2023-06-13 21:18, Steve Litt wrote: > Using grep, I found there are no files whose names contain the string > "pascal" in any case in the ~/.vim directory (I'm using Void Linux). I suspect your frustration is being caused by something in $VIMRUNTIME/indent/pascal.vim As such, you should be

Re: Small documentation tweak for :g delimiters

2023-05-01 Thread Tim Chase
On 2023-05-01 21:37, Owajigbanam Ogbuluijah wrote: > If you check the documentation for *help :v*, you'd see it's > marked as the same Yes, `:g!` and `:v` are the same. However, both can take alternate delimiters (other than "/"). The documentation states that the alternate delimter cannot be a

Small documentation tweak for :g delimiters

2023-05-01 Thread Tim Chase
Shortly after the help for :v it reads Instead of the '/' which surrounds the {pattern}, you can use any other single byte character, but not an alphabetic character, '\', '"' or '|'. This is useful if you want to include a '/' in the search pattern or replacement string. This makes it

Re: Search multiple windows

2023-04-24 Thread Tim Chase
On 2023-04-24 12:38, Ben Mehmet wrote: > My question, however, is is there a way/plugin/mapping that I > could enable to have vim highlight and move to next occurrence > of my search pattern in all the rest of windows highlighted I usually do this semi-manually with something like :windo

Re: What to use for....

2023-04-24 Thread Tim Chase
On 2023-04-24 12:07, 'Sebastian G??decke' via vim_use wrote: > Actually it's 1779 counts long and for this, i don't see the missing > "=".Ā > So how could i improve vim to "show" me that in my config-file is > something missing. I've done one-off things like :match Error /^[^=]\=$/ which

Re: What are some alternatives of vim-surround

2023-04-19 Thread Tim Chase
On 2023-04-19 14:35, Christian Brabandt wrote: > On Di, 18 Apr 2023, Tim Chase wrote: > >c'"' [snip] > > It's not repeatable with "." (well, it is, but it repeats the > > original replacement, not with the second text). > > If you use the small delet

Re: What are some alternatives of vim-surround

2023-04-18 Thread Tim Chase
On 2023-04-18 07:29, 'Devin Weaver' via vim_use wrote: > leads me to wonder what are the "vim --clean" ways to perform the > same actions that vim-surround offers. vim-surround offers a number of features, some easier to replicate, others more challenging. I commonly use c'"' to wrap in

Re: Displaying the British pound key using the compose key

2023-03-19 Thread Tim Chase
On 2023-03-18 21:02, cjsmall wrote: > However, I've been using the Compose key on my Sun Type 6 keyboard to > enter most of the Unicode characters, simply replacing Ctrl-K > with Compose. So far this has worked with every digraph > combination except the British Pound symbol. "Compose $ $" just

Re: Can I copy/yank into and out of vim?

2023-03-03 Thread Tim Chase
On 2023-03-03 16:08, K otgc wrote: > Hello, I would like to copy/yank text from vim out to other programs > like dpaste or Google Docs. How you go about this depends on a couple factors that you omit: - which OS are you using? - do you mean via the clipboard (in which case, if your build was

Re: Vimdiff editing text

2023-03-03 Thread Tim Chase
On 2023-02-24 22:50, K otgc wrote: > I'm having trouble moving text from file2 line1 to file1 line8. If it's just one line as part of a larger change, you can yank it and either paste it normally or visually-highlight the line with "V" and paste to replace it (or paste it and then delete then

Small doc omission: :tabdo in :help :bar

2023-02-08 Thread Tim Chase
The help for :bar > These commands see the '|' as their argument, and can therefore > not be followed by another Vim command: > ... has list of commands that can't be followed by a "|" but it appears to be missing :tabdo from the list of commands. -tim -- -- You received this message

Re: Searching across a range of lines

2023-01-13 Thread Tim Chase
On 2023-01-13 16:41, Salman Halim wrote: > For example, I want to find a match for 'cat', but only in lines 50 to > 100. If my cursor is before line 50 when I start, I can prefix my > expression with \%>49 and pass 100 as the stopline, but that doesn't > work if my cursor is AFTER line 50 as it

Re: Yanking doesn't yank

2023-01-12 Thread Tim Chase
On 2023-01-12 14:57, 'Ottavio Caruso' via vim_use wrote: > Then I press 'y'. If then I move the cursor down, it will still > continue to highlight the following text [snip] > I wonder why it will keep on selecting text after pressing 'y'. [snip] > source $VIMRUNTIME/defaults.vim If you take out

Re: How to quickly move to a specific buffer?

2022-12-13 Thread Tim Chase
On 2022-12-13 20:29, John Passaro wrote: > and ^6 is not only good for going between two, not if you have > three and can remember their buffer numbers via :ls, ^6 takes > you to buffer number n. You've pointed out the critical failure here...my inability to remember more than one (alternate)

Re: How to quickly move to a specific buffer?

2022-12-13 Thread Tim Chase
On 2022-12-13 20:09, Steve Litt wrote: > I typically use :bn and :bp to move between buffers, but I have five > buffers open on my current project, which requires a heck of a lot of > keystrokes to move to a specific buffer. So I'd like a command to bring > up a list of buffers so I can chose a

Re: Lowest number of keystrokes to modify part of a line

2022-11-01 Thread Tim Chase
On 2022-11-01 10:50, 'Ottavio Caruso' via vim_use wrote: > morse Sun 30/10 22:07[x] > qrq Mon 31/10 10:19 > Groups Mon 31/10 19:42 > > See that [x]? That's where the cursor is. > > I want to modify the line just below that (starting with qrq), > remove that timestamp and put a new one.

Re: Gvim taking a minute or more to start

2022-09-08 Thread Tim Chase
On 2022-09-08 11:30, Gary Johnson wrote: > I suspect that whatever is causing that 5-second startup time is > contributing to the read times of every file that gvim opens. > So, while 5 seconds is better than 30, solving that 5-second issue > may solve the rest. > > Unfortunately, I don't

Re: Print the first field of a table in one line separated by commas

2022-09-07 Thread Tim Chase
On 2022-09-07 08:14, andalou wrote: > If I use vim, how can I put the output after the data? as in: > -- > 1001 John Sena 4 > 1002 Jafar Iqbal 6 > 1003 Meher Nigar 3 > 1004 Jonny Liver 7 > xx1001yyy, xx1002yyy, xx1003yyy, xx1004yyy With the vim suggestions I gave,

Re: Print the first field of a table in one line separated by commas

2022-09-06 Thread Tim Chase
On 2022-09-06 14:45, andalou wrote: > I have the table: > 1001 John Sena 4 > 1002 Jafar Iqbal 6 > 1003 Meher Nigar 3 > 1004 Jonny Liver 7 > I'd like to print the first field, preceded by xx, and followed by yyy, > separated by commas, as in: > xx1001yyy, xx1002yyy, xx1003yyy,

Re: List of Vim features to vote on

2022-08-15 Thread Tim Chase
It feels like some of these are measurable while others are...less so. Speed ones--is the new iteration faster than the previous version? New features--feature wasn't there, now it is But other ones like "improve X" feel a lot more nebulous. Sure, documentation improvements are always welcome

Re: New version of vim unsolicitedly sourcing defaults.vim?

2022-08-11 Thread Tim Chase
On Fri, Aug 12, 2022 at 12:29:24AM +0200, Tony Mechelynck wrote: > I believe that Vim has a good set of defaults, including (in recent > versions) sourcing defaults.vim when no user vimrc was found (if you > have a vimrc, and still want the settings of the defaults.vim, or most > of them like I

Re: New version of vim unsolicitedly sourcing defaults.vim?

2022-08-11 Thread Tim Chase
On Thu, Aug 11, 2022 at 11:31:22AM +0200, Tony Mechelynck wrote: >On Tue, Aug 9, 2022 at 7:54 PM Tim Chase wrote: >> >> I upgraded packages on my FreeBSD box yesterday and noticed that >> vimrc behavior had changed. [snip] >> :scriptnames > > Yes, it's y

Re: New version of vim unsolicitedly sourcing defaults.vim?

2022-08-10 Thread Tim Chase
On Wed, Aug 10, 2022 at 11:07:55AM +0100, Bram Moolenaar wrote: >Tim Chase wrote: >> Yep, as Yegappan found, this bug is tracking the issue at hand: >> >> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=251420 >> >> I've got a FreeBSD Bugzilla accoun

Re: New version of vim unsolicitedly sourcing defaults.vim?

2022-08-09 Thread Tim Chase
On Tue, Aug 09, 2022 at 10:06:37PM +0100, Bram Moolenaar wrote: > Vim does not include a system-wide vimrc file that would go in > /usr/local/etc/vim. Does this file source defaults.vim? Yes, this file sources defaults.vim I was unsure of its provenance, but with your confirmation that it's not

New version of vim unsolicitedly sourcing defaults.vim?

2022-08-09 Thread Tim Chase
I upgraded packages on my FreeBSD box yesterday and noticed that vimrc behavior had changed. Prior to the upgrade, if I had a ~/.vimrc it wouldn't source the defaults.vim file. :help VIMINIT > The first that exists is used, the others are ignored. and it proceeds to list .vimrc (which I have)

Re: How to limit amount of memory used by vim?

2022-07-06 Thread Tim Chase
On 2022-07-06 11:00, Bram Moolenaar wrote: > because of the way Linux manages memory it will happily give more > memory to Vim than it actually has. There is a system setting to > change that behavior. I recall a lively discussion between Linux > and BSD users about this stragety (BSD works just

Re: Inserting on alternate lines?

2022-06-02 Thread Tim Chase
On 2022-06-02 11:58, Lifepillar wrote: > This morning I made a vertical selection with CTRL-V and typed (too) > quickly to prepend a quote to the selected lines. I got something > like this: > > "... > ... > "... > ... > "... > ... > > For the life of me (pun intended), I

Re: Large file - Opening n head lines

2022-03-17 Thread Tim Chase
On 2022-03-17 01:41, Ni Va wrote: > Is it possible to open a Large File Vim but just only few beginning > lines of it, edit one of these 50 first lines and then save and > quit ? I don't think it's readily doable inside vim, but if I had such a situation, I'd split it into the two portions like

Re: Disable Help

2022-01-21 Thread Tim Chase
On 2022-01-21 04:04, Joseph Wulf wrote: > And the answer is: "set paste" prevents the mapping of out of > existence. > Cannot set paste before or after the "map! "; just cannot > set it at all. > > Which is a problem in my/our world as we use vim and paste a > lot. You might want to read

Re: Disable Help

2022-01-19 Thread Tim Chase
On 2022-01-19 07:23, Joseph Wulf wrote: > When using vim I wish to disable the from popping up the help. [snip] > :nmap [snip] > I place the SAME string without the quotes or leading colon in > .vimrc, close/open a new vim session, and immediately brings > up the help menu. You're on the

Re: Pasting some yank line is slow

2022-01-14 Thread Tim Chase
On 2022-01-14 01:04, Ni Va wrote: > I encounter a recent problem pasting some yank things (lines or > sentences' part). > > don't see why because my updatetime is et to 300 and redrawtime is > set to 500. A couple candidates occur to me: 1) if the paste itself is slow to activate, do you have

Re: Control-V :w : how to write single character?

2021-11-03 Thread Tim Chase
On 2021-11-03 12:36, L A Walsh wrote: > I wanted to write out an unclear character that my > cursor was over, so I tried to go into character VISUAL > selection mode by pressing Ctl-v, then ':w! /tmp/ch'. > Instead of the single character at the cursor, I got > the whole line. I also tried with a

Re: Matching a non-match

2021-10-14 Thread Tim Chase
On 2021-10-14 17:34, A. Wik wrote: > Yes, I think so. Is it because \@! is zero-width that it must be > paired with something (eg. ".") that does have width? > > And it matches an empty line because of the \%( ... \)*? Exactly, on both fronts.  -tim -- -- You received this message from

Re: Matching a non-match

2021-10-13 Thread Tim Chase
On 2021-10-11 23:45, A. Wik wrote: > > or if you want to match the entire line, you can use: > > > > /^\%(\%(exim.input\)\@!.\)*$/ > > > > That breaks down to > > > > ^ from the start of the line > > \%(…\)*zero or more of these things > >\%(exim.match\)\@! at each of

Re: How to replace pattern with shell command's output using matched pattern

2021-09-04 Thread Tim Chase
On 2021-09-04 18:43, Lifepillar wrote: >> > :%s_^\[\(\d\+\)_\="[" . strftime("%c", submatch(1))_ > ⋮ > >> :%s/\[\zs\d\+\ze\]/\=strftime("%c", submatch(0)) > > Learning Vim is a never-ending experience: I didn't know (or > remember) about submatch()! > > Can you explain why \zs... \ze is to

Re: How to replace pattern with shell command's output using matched pattern

2021-09-04 Thread Tim Chase
On 2021-09-04 14:07, Andreas Perstinger wrote: > Alternatively, without using an external command: > > :%s_^\[\(\d\+\)_\="[" . strftime("%c", submatch(1))_ This is much better than the suggestion I gave, keeping it all internal to vim. To clean it up, I'd tweak it to

Re: How to replace pattern with shell command's output using matched pattern

2021-09-04 Thread Tim Chase
On 2021-09-04 09:15, Lifepillar wrote: > Use case at hand: replace Unix timestamps with date/time in a log > file: > > [1630720618] unbound[63495:0] info: 127.0.0.1 foo.bar.com IN > [1630720618] unbound[63495:1] info: 127.0.0.1 foo.bar.com A IN > ... > > The shell command I'd apply is `date

Re: How do I search and replace based on a list?

2021-08-30 Thread Tim Chase
On 2021-08-28 03:05, Luciano ES wrote: > So I would like to create a list of string pairs, ideally in a > separate file and with some kind of separator such as '|' between > the strings. Then I would highlight the line or paragraph and run > the macro or script and have all pair replacements

Re: Pre-fold output of :r! command

2021-07-06 Thread Tim Chase
On 2021-07-06 17:59, Julius Hamilton wrote: > If I unfold that fold, I think the fold disappears. I then have to > respecify the content to be folded. Or if not, I still have to put > my cursor on the top line of the fold, to re-fold it. Unless you delete the fold, it should remain even after you

Re: Where are vim macros stored

2021-05-28 Thread Tim Chase
On 2021-05-28 11:47, 'Grant Taylor' via vim_use wrote: > My understanding is that, by default, macros only exist in memory, > are volatile, and not stored persistently. The only live in vim's > memory while vim is running. > > There are some non-default options that you can use to change some >

Re: Where are vim macros stored

2021-05-28 Thread Tim Chase
On 2021-05-28 11:10, Ruben Safir wrote: > I just want to open the file and edit it. Unless you have changed settings, it's stored in ~/.viminfo but it can get overwritten upon quitting if you edit it while vim is configured to (over)write it upon quitting. So if you plan to edit it, you might

Re: Where are vim macros stored

2021-05-28 Thread Tim Chase
On 2021-05-28 10:05, Ruben Safir wrote: > On 5/28/21 10:02 AM, Christian Brabandt wrote: > >> Where are the vim macros stored. I want to edit them by hand > > in the register you specified. > > that is not the answer to the question I asked. > > Where are they STORED. Not how do I access

Re: Bug/inconsistency in /\%'/ in linewise-vs-characterwise?

2021-05-22 Thread Tim Chase
On 2021-05-23 00:25, Bram Moolenaar wrote: > Tim Chase wrote: >> /\%'<\_.\{-}\%'>/ >> >> So then I highlighted some text in *linewise* visual mode ("V") >> and hit and the highlight was removed. Using "n" to search >> for

Bug/inconsistency in /\%'/ in linewise-vs-characterwise?

2021-05-22 Thread Tim Chase
Coming up in this thread[1] on Reddit, I highlighted some text in *characterwise* visual mode ("v") and hit to end visual mode. With 'hls' set, issuing /\%'<\_.\{-}\%'>/ properly highlighted the range as expected. So then I highlighted some text in *linewise* visual mode ("V") and hit and

Re: using a variable in a substitute command

2021-05-20 Thread Tim Chase
On 2021-05-19 19:16, Chris Jones wrote: > Now I tried to replace the "echom g:counter" command by a > :s(ubstitute) command, e.g. > > | :s/^# \(.*$\)/# \\textit{\=g:counter: \0} > > Unfortunately this is what I got: > > | # \textit{=g:counter: } > | ... i.e. > | # \textit{=g:counter: title of

Re: See the contents of an included file

2021-05-12 Thread Tim Chase
On 2021-05-12 10:51, Stan Brown wrote: > I have this mapping in my _vimrc, as suggested by the help: > :map gf :sp > Then when I type gf Vim splits the window, opens the file in the new > window, and jumps to it. (The cursor can be anywhere on the file > name; see ":h gf" for more.) In

Search bug/inconsistency with forward vs. backward search?

2021-04-22 Thread Tim Chase
To reproduce, create an empty document with a couple of blank lines at the top, and a non-space character (optionally indented): $ vim -u NONE :set wrapscan " should be the default, but just to confirm :$put=['', 'x'] Now, search for that "first non-space character in the file" (

Re: How to remove paragraphs with specific text from my text file?

2021-04-14 Thread Tim Chase
On 2021-04-14 05:13, Igor wrote: > I have 130 thousand lines of output file. > - Each output is in separate paragraph. > - Each paragraph has at least two or more rows. > I would like to remove all paragraphs that ends with (this text is > alway last line in paragraph): > DB2I The SQL command

Re: regex that matches a modeline line

2021-04-12 Thread Tim Chase
On 2021-04-12 09:30, Peng Yu wrote: > It seems that modeline is quite flexible. Could anybody let me know > the regex used by vim to determine what is a modeline and what is > not a modeline? Thanks. How loose is acceptable? Do you want to accept the most common forms, or do you want the

Re: "Upgrading" is not an option

2021-04-09 Thread Tim Chase
On 2021-04-10 01:54, 'J S' via vim_use wrote: > I recently started a thread here about syntax highlighting and > mentioned that I am using VIM 7.4 Someone "helpfully" suggested > "upgrading" my VIM version. > > Anyway, upgrading is not an option. Please do not mention this > again. Thank you.

Re: How to use search string in search replace?

2021-02-09 Thread Tim Chase
On 2021-02-10 00:56, Kennedy, Marcus A. wrote: > So I was searching through some ugly build commands when I realized > that I needed to go from search mode to command mode to delete part > of the output text I was looking at. Going from command mode with a > :%s// to search mode will allow you to

Re: Bug somewhere in :put/map/range/lambda functions?

2021-01-09 Thread Tim Chase
On 2021-01-09 11:39, Yegappan Lakshmanan wrote: > The lambda function is called with two arguments (the index of the > current item in the list and the value of the item). > > :put=map(range(1, 10), {i, v -> v}) Ah, that makes sense. I missed that part in the docs: If {expr2} is a

Bug somewhere in :put/map/range/lambda functions?

2021-01-09 Thread Tim Chase
Tried this: :put=range(1,10) and it worked as expected, appending the numbers 1..10 to my file. Same with: :put=map(range(1,10), 'v:val') which worked as expected. However using a no-op lambda function: :put=map(range(1,10), {v -> v}) somehow gets the numbers 0..9 in the file instead

Re: why doesn't min take more than 1 parameter?

2021-01-04 Thread Tim Chase
On 2021-01-04 14:14, L A Walsh wrote: > On 2021/01/02 08:01, Tim Chase wrote: > > though a lot of vim stuff takes inspiration from > > Python ... > > > I think vim was around before python. Both were originally released in 1991. However, some of the vim-script lan

Re: why doesn't min take more than 1 parameter?

2021-01-02 Thread Tim Chase
On 2021-01-02 16:48, Tony Mechelynck wrote: > Using a single list-like argument is more general: it allows > determining the minimum of any number of values. If it accepted only > two Float arguments, then to determine the minimum of 8 values you > would have to do for instance > > :let result =

Re: why doesn't min take more than 1 parameter?

2021-01-02 Thread Tim Chase
On 2021-01-02 06:47, L A Walsh wrote: > trunc(min(3,1+log(1+line('$'))/log(10))) > > but I get E118: Too many arguments for function: min. min() expects a single list-like argument so try trunc(min([3,1+log(1+line('$'))/log(10)])) which creates a list-literal with "3" as the first item and

Re: complex-repeat Behavior Changed Recently

2020-12-25 Thread Tim Chase
On 2020-12-22 19:43, 'JB' via vim_use wrote: > Typing 'qa0xxj' and executing macro 'a' used to go to the beginning > of the line, delete the first two chars, then jump down one line. > Now, the cursor goes to the beginning of the line and execution of > the macro stops -- no deletions or jumping

Re: Substitute pattern over multiple lines

2020-12-24 Thread Tim Chase
On 2020-12-24 14:43, Steve Litt wrote: > On Wed, 23 Dec 2020 17:08:32 -0600 > Tim Chase wrote: >> 2 NOTE \zs >> >> This does join *all* the lines and doesn't re-wrap them, so you'd >> then want a second pass to do the wrapping >> >> :set tw=70

Re: Substitute pattern over multiple lines

2020-12-23 Thread Tim Chase
On 2020-12-23 23:18, John Cordes wrote: >> :g/^2 TYPE tngnote//2 NOTE /s/^2 NOTE \zs\(.*\n\(\%(\D\|3 CONC >> \).*\n\)\+\)/\='> class="xxx">'.substitute(substitute(submatch(1), '\n3 CONC ', '', >> 'g'), '\n', '', 'g')."<\/div>\n" > > The last ":g..." command I listed above is working correctly >

Re: Substitute pattern over multiple lines

2020-12-23 Thread Tim Chase
On 2020-12-23 20:39, John Cordes wrote: >> I'd start with this ugly monstrosity: >> >> :%s/^2 \u\{3,} \zs\(.*\n\(\%(\D\|3 CONC \).*\n\)\+\)/\='> class="xxx">'.substitute(substitute(submatch(1), '\n3 CONC ', '', >> 'g'), '\n', '', 'g')."<\/div>\n" > > I will attempt to deconstruct your

Re: Substitute pattern over multiple lines

2020-12-23 Thread Tim Chase
On 2020-12-23 17:48, John Cordes wrote: > I'm seeking help with editing a GEDCOM (genealogy) file. For > this I'm using Vim 8.2 in Windows. Here is a segment of text from > the file (the language doesn't make sense since I've deleted > some internal lines in the NOTEs which aren't relevant to the

Re: Matching a non-match

2020-12-20 Thread Tim Chase
On 2020-12-20 11:09, A. Wik wrote: > Browsing a directory listing, sometimes I hit lines like these: > ./spool/exim/input/1FM8sl-4n-Ix-H > ./spool/exim/input/1FM8sn-4u-OF-D > ./spool/exim/input/1E9dsQ-4f-MO-D > [... thousands of similar lines ...] > > How can I use "/" to find the

Re: Matching a non-match - workaround: less

2020-12-20 Thread Tim Chase
On 2020-12-20 14:53, Sven Guckes wrote: > workaround: > open the file with "less" and right after initiating search with '/' > type '!' and the prompt will switch to "Non-match /". now enter > eg "spool.exim.input" and less will skip all those lines. :-) > that's one of the features i dearly miss

Re: Matching words within X lines [PS]

2020-12-06 Thread Tim Chase
On 2020-12-06 20:23, Tim Chase wrote: > They're ugly, but vim will at least let you do them. Oh, one other caveat: it only finds the bookends and starts the next search after the closing bookend. So if there is the possiblity that the matches overlap, such as searching for "A...B"

Re: Matching words within X lines

2020-12-06 Thread Tim Chase
On 2020-12-06 18:11, A. Wik wrote: > I'm trying to match a couple (maybe more later) of words occurring > within 3 lines of each other in any order. Is there a way to do > this with a Vim regex? The short answer is "yes", but the specifics depend on what you mean. Can the words come in any

Re: How to combine windo/tabdo with a shortcutted command?

2020-11-27 Thread Tim Chase
On 2020-11-27 07:44, tu...@posteo.de wrote: > suppose I want to delete a line in each window or tab I currently > have in my vim...how can I do a > > windo > or > > tabdo > > combined with 'dd' (and I am too lazy to lookup the command name > in the help for each shortcut I want to use

Re: regex to find where 'sample text' is not followed by 'sample text' a couple of lines down

2020-11-14 Thread Tim Chase
On 2020-11-14 16:18, Chris Jones wrote: > On Thu, Nov 12, 2020 at 07:15:07PM EST, Tim Chase wrote: > > As best I can tell, this should highlight \index{} entries that > > don't match text in the following N lines (3ish here, though I > > might have a fenceposting error) &g

Re: regex to find where 'sample text' is not followed by 'sample text' a couple of lines down

2020-11-12 Thread Tim Chase
On 2020-11-12 18:42, Chris Jones wrote: > I am proofreading a document where a few words occur on one line > and the same exact words are replicated two lines down. > > Here's a sample: > > | ```{=latex} > | \index{Text that must occur twice} > | ``` > | **2507. Text that must occur twice.** ...

Re: Inconsistent overkill behavior on various motions

2020-10-18 Thread Tim Chase
On 2020-10-18 01:12, Brennan Vincent wrote: > "2$" (with cursor on first column) does nothing (presumably an > error). For the record, "$" does take a count, going to the end of the line count-1 lines down. With only the single line, there's no count+1 line to go to, so both (n)vi and vim

Re: how to extend search-for-word-under-cursor

2020-09-29 Thread Tim Chase
On 2020-09-29 13:05, Richard Mitchell wrote: > Can a search-for-word-under-cursor be extended to search > for both that word and the same word with a specific leading > character? > > For example, when sitting on "foo", I want to find both "foo" > and "_foo", but not anything else. I don't do it

Re: How to replace string in specific paragraph only?

2020-09-19 Thread Tim Chase
On 2020-09-19 16:43, 'Grant Taylor' via vim_use wrote: > > - the thing looked for in the s// command > > This is actually where I was wanting to use the contents of > g/first/. ;-) > >> Using the :norm method, you don't have the two boundary regexen >> to change the most-recently-used-search,

Re: How to replace string in specific paragraph only?

2020-09-19 Thread Tim Chase
On 2020-09-19 14:06, 'Grant Taylor' via vim_use wrote: > >:g/aaa/norm vip:s//bbb^V^M > > > > where ^V^M is a control-V followed by a control-M (which makes > > this nasty to put in a mapping or vimrc). This works because vim > > knows that a "paragraph" is bounded by empty lines *or* BOF/EOF

Re: How to replace string in specific paragraph only?

2020-09-19 Thread Tim Chase
On 2020-09-19 12:02, Igor wrote: > I specially like bellow solution, that I have tested > and it works fine. > > :g/^XXX/.,/^$/s:aaa:bbb:g > > Just one question, why is there a "." character in command? > If I understand it correctly, a "." character means the line where > cursor is, > and with

Re: How to replace string in specific paragraph only?

2020-09-19 Thread Tim Chase
On 2020-09-19 14:08, Sven Guckes wrote: >> I need to replace string "aaa" with "bbb" >> only in paragraphs that starts with "XXX". > > :g/^XXX/?^$?,/^$/s:aaa:bbb:g The only gotcha with this is that a paragraph must have a blank line before & after it. I've gotten stung doing this exact

Re: Broken Q key... how can I leave vim without saving?

2020-09-07 Thread Tim Chase
On 2020-09-02 17:28, Paolo Bolzoni wrote: > It is not a joke, my laptop keyboard is broken and seldom the keys > Q, 4, Ins, and few others stop working. > Is there a way to leave vim without saving without using the Q key? Depends on how desperately you need a "q". You can use :help :x which

Re: Using vimgrep to find files NOT containing a string

2020-09-03 Thread Tim Chase
On 2020-09-02 19:14, russurquhart1 via vim_use wrote: > Hi All, > I generally use: > :vim `beta: ` **/*.md | copen > To traverse my Markdown files to find those containing 'beta: '. > I need to do the opposite but can get the pattern right. I tried > :vim -v `beta: ` **/*.md | copen > > thinking

Re: Applying macros to all files, macro stops processing files

2020-09-02 Thread Tim Chase
On 2020-09-02 23:23, russurquhart1 via vim_use wrote: > Yesterday, with the groups help, I was able to apply a macro to a > group of Markdown files in my site directory, using: :args > ~/site/**/inde*.md :argdo :normal @b > :argdo :write > (@b is a macro that searches for '---', moves up two

Re: Trying to apply macro to all files under a folder

2020-08-31 Thread Tim Chase
On 2020-08-31 23:36, russurquha...@verizon.net wrote: > I *think* you need to apply the :normal to the whole file unless the > macro itself does everything in one invocation. > > The @b macro only adds a single line of text. If it's a whole line, you might have better luck with the :put command

Re: Trying to apply macro to all files under a folder

2020-08-31 Thread Tim Chase
On 2020-08-31 22:57, russurquhart1 via vim_use wrote: > My next step would have been: :argdo :normal @b I *think* you need to apply the :normal to the whole file unless the macro itself does everything in one invocation. If it only does one line and you need it to do the whole file, you might

Re: Opening files in a certain pattern [follow-up]

2020-07-27 Thread Tim Chase
On 2020-07-27 18:32, Tim Chase wrote: > You might try something like this: > > $ vim -p -c 'set tabpagemax=50' -c 'tabdo exec "vsp > ".substitute(substitute(expand("%"),"dir1", "dir2", ""), "/L", > "/A", "&

Re: Opening files in a certain pattern

2020-07-27 Thread Tim Chase
On 2020-07-28 02:56, Manas wrote: > Hi, I have 2 directories, supposedly dir1 and dir2. And both of them > contains equal number of files (say n each) which are named in the > following fashion: > - In dir1: All files are named as L1.md, L2.md, , Ln.md > - In dir2: All files are named as

Re: How can I find where one word is close to another word?

2020-07-25 Thread Tim Chase
On 2020-07-25 17:54, Adrian Keister wrote: > There's an answer on the Stack Exchange site. Does that method work > also? That method finds only the case in which you have "aid" *followed by* "country", so if you have "This country needs all good men to come to her aid." it won't find that

Re: How can I find where one word is close to another word?

2020-07-25 Thread Tim Chase
On 2020-07-25 15:59, Adrian Keister wrote: > Now is the time for all good men to come to the aid of their > country. > > In this test, I want to find all occurrences where the word 'aid' > is within ten words of the word 'country'. How can I do that in Vim? It's way ugly and requires using the

Re: Visual selection via :global

2020-07-23 Thread Tim Chase
On 2020-07-24 05:36, Manas wrote: > On Thu, Jul 23, 2020 at 06:40:17PM -0500, Tim Chase wrote: > > :let @a='' | g/^-/y A > > > It worked like a charm. Apparently, the right command was `:g/^-/y > A` instead of `:g/^-/normal yy`. Although I am not able understand >

Re: Visual selection via :global

2020-07-23 Thread Tim Chase
On 2020-07-24 04:43, Manas wrote: > On Thu, Jul 23, 2020 at 05:57:51PM -0500, Tim Chase wrote: >> On 2020-07-24 03:48, Manas wrote: >>> Hi folks, I have a markdown file containing a couple of >>> headings and some pointers as shown below. >>> >

Re: Visual selection via :global

2020-07-23 Thread Tim Chase
On 2020-07-24 03:48, Manas wrote: > Hi folks, I have a markdown file containing a couple of headings and > some pointers as shown below. > > ``` > # Heading 1 > - pointer 1 > - pointer 2 > - pointer 3 > > ## Heading 2 > - pointer 4 > - pointer 5 > ``` > > I wanted to visual select all pointers

Re: gv bug?

2020-07-19 Thread Tim Chase
On 2020-07-19 17:18, Bram Moolenaar wrote: > Tim Chase wrote: > > To replicate > > > > $ vi -u NONE > > :r !jot 15 > > > > (or use `seq 15` to get the numbers 1-15 in your file) > > > > 3GVG:g/5/d > > > > This should delete l

gv bug?

2020-07-19 Thread Tim Chase
To replicate $ vi -u NONE :r !jot 15 (or use `seq 15` to get the numbers 1-15 in your file) 3GVG:g/5/d This should delete lines 5 and 15 because they contain a "5". However, issueing gv does not reselect the text. If instead you have 16 numbers $ vim -u NONE :r !jot 16 and do

Re: substitution, transform string to list?

2020-07-17 Thread Tim Chase
On 2020-07-17 11:10, meine wrote: > The data to transform: > > ABBEEL;1872/253;1882/576;1886/1925;1887/603;1887/1813;1894/1444;1898/3449 > ABBEELS;1888/1401;1889/562;1891/2371;1899/3088;1902/732;1903/1509;1904/1317 > > should become: > > ABBEEL;1872/253 > ABBEEL;1882/576 > ABBEEL;1886/1925 >

Not sure if bug, accurate message, or whether there's a better way

2020-07-14 Thread Tim Chase
Issued the following $ vim -u NONE then did ou This gave me an E19 ("Mark has invalid line number"). In contrast, starting a bare vim $ vim -u NONE and just using doesn't balk, even though there's also no valid previous-line-number to jump to. My gut says the two should behave

Re: Using :g to filter lines through an external command

2020-07-12 Thread Tim Chase
On 2020-07-12 09:59, A. Wik wrote: > Hi all, > > Assume I have a file (or just a buffer) with the contents: > echo Hello from /bin/sh > test1 > test2 > test3 > ---end-file--- > > :1!sh does what I would expect: it passes "echo Hello from /bin/sh" > as input to the shell, which executes the line

Re: An interesting little poser [PS]

2020-06-30 Thread Tim Chase
On 2020-06-30 18:33, Chris Jones wrote: > On Mon, Jun 29, 2020 at 03:34:03PM EDT, Tim Chase wrote: >> Try changing that line from >> >> $?^$?+,$g/^\[\@!.*\n\[\@!/,/\n\[\|\%$/j >> >> to >> >> $?^$?+,$g/^\[\@!.*\n\[\@!./,/\n\[\|\%$/j > &g

  1   2   3   4   5   6   7   8   9   10   >