Neovim

2815 readers
1 users here now

founded 2 years ago
MODERATORS
1
2
3
4
5
6
7
8
9
10
11
12
 
 

Anybody know what's going on?

13
14
15
16
17
18
 
 

Haven’t seen much exposure to this awesome plugin, even on reddit it seems that it’s not so well known, so i wanted to share it. It’s basically a git-log replacement integrated with neovim(and fugitive) that updates automatically(or manually) whenever you do any changes to your git repository. Really useful to get a overall picture of what’s going on in a repo. Or for debugging git branch problems etc.

19
20
 
 

The upcoming Neovim 0.12 release will have a built-in plugin manager. It is implemented in Lua and is available as a built-in vim.pack module (hence the name).

21
22
 
 

In master branch of nvim-treesitter you had to do something like this to achieve it : https://pawelgrzybek.com/nvim-incremental-selection/

In the main branch (that they switched to) they removed it completely. Now it was added into v0.12 so nvim natively supports this without any additional plugins!

This is so good!

23
 
 

Triforce is a Neovim plugin with beautiful UI that adds a bit of RPG flavor to your coding — XP, levels, and achievements while you work. - gisketch/triforce.nvim

24
25
 
 

Here's a little puzzle for you Vim specialists:

Say I have a random text file containing the following lines:

This is foo1 and bar1: it has bar1 and foo1, or foo1 and bar1 if you prefer.  
foo1 is not exactly like bar1.  
bar1 has the same number of letters as foo1 and the same trailing number.  

I want to search and replace all instances of foo1 and bar1 in all the lines in the file so the number after foo and bar increments at each matched line, so the file becomes:

This is foo1 and bar1: it has bar1 and foo1, or foo1 and bar1 if you prefer.  
foo2 is not exactly like bar2.  
bar3 has the same number of letters as foo3 and the same trailing number.  

I can search all instances of foo1 and bar1 and replace them with foo2 and bar2 easily enough with:

:%s/\(foo\|bar\)1/\12/g

(the file then becomes:

This is foo2 and bar2: it has bar2 and foo2, or foo2 and bar2 if you prefer  
foo2 is not like bar2  
bar2 has the same number of letters as foo2 and the same number  

)

and I can search foo1 and replace it with foo1, foo2, foo3, foo4... line-wise with a vimscript:

:let i=1 | %g/foo1/ s//\='foo' . i/g | let i+=1

(the file then becomes:

This is foo1 and bar1: it has bar1 and foo1, or foo1 and bar1 if you prefer       
foo2 is not like bar1                                                            
bar1 has the same number of letters as foo3 and the same number  

)

The question is, how can I do both?

The problem is the \= substitute operator, that expects (and evaluates) an expression: I need it to expand i in the substitution pattern.

The problem is, it has to be alone in the substitution pattern (i.e. I can't do s//\1\=i/, which would first expand \1 into foo or bar, then expand \=i into the value of i, and which is what I really want to do).

So my question is, what's the syntax to expand \1 in the \= expression? I tried looking up the syntax for \= but the official documentation is thin on details and I couldn't find how to do it - or even if it's doable at all.

Any idea?

view more: next ›