原文
- 想要在每行前面加行號以及’. ',效果如
1. https://leetcode.com...
https://leetcode.com/problems/peak-index-in-a-mountain-array/
https://leetcode.com/problems/find-positive-integer-solution-for-a-given-equation/
https://leetcode.com/problems/binary-search/
https://leetcode.com/problems/capacity-to-ship-packages-within-d-days/
https://leetcode.com/problems/koko-eating-bananas/
https://leetcode.com/problems/find-the-smallest-divisor-given-a-threshold/
https://leetcode.com/problems/sum-of-mutated-array-closest-to-target/
命令
在visual模式下,選定要修改的行之後
'<,'>:s/^/\=(line('.') - line("'<") + 1).'. '/
\\=(line('.') - line("'<") + 1)
可以得到選定段的行號。原理是當前行減去選定行的首行以後,獲得了相對位置,再+1,從1開始計算,便達到目的
如果後面還需跟一些內容,可以用
.'***'
來添加,其中***就是要添加的東西
效果
1. https://leetcode.com/problems/peak-index-in-a-mountain-array/
2. https://leetcode.com/problems/find-positive-integer-solution-for-a-given-equation/
3. https://leetcode.com/problems/binary-search/
4. https://leetcode.com/problems/capacity-to-ship-packages-within-d-days/
5. https://leetcode.com/problems/koko-eating-bananas/
6. https://leetcode.com/problems/find-the-smallest-divisor-given-a-threshold/
7. https://leetcode.com/problems/sum-of-mutated-array-closest-to-target/