vim中的宏和normal命令

看内容:

vim
gdb
cmake
blender
avidemux-qt
fontforge
gimp
digikam
inkscape
pdftricks
kontact
kodi
openshot
pitivi
smplayer
simplescreenrecorder
deepin-screen-recorder
ardour
audacity
easytag
minuet
luppp
musescore
deepin-music
basket
chromium
kmail
kmymoney
kile
lokalize
pdfmixtool
retext
texstudio
texmaker
falkon
krdc
krfb
putty
gnuradio
ktouch
kturtle
rocs
r
step
wesnoth
chromium-bsu
extremetuxracer
ksudoku
supertux
sqlitebrowser
kalarm
knotes
okteta
qstardict
smb4k
terminator
zanshin
kcachegrind
kdbg
kdevelop
kdiff3
kde-dev-utils
qcachegrind
valgrind
indent
widelands
qtcreator
scratch
umbrello
gitg
ttf-dejavu
qt5-examples
qt5-doc
sl
rawtherapee
cool-retro-term
sakura
terminology
tilda
cowsay
cmatrix
wqy-microhei-lite
kicad
kicad-library
kicad-library
opencv
opencv-samples

想将以上片段变成markdown中顺序列表的形式,可以应用vim的normal命令和宏录制等,具体操作为:

1、准备变量:

  :let i = 1

2、开始录制宏

  qa

3、操作

  I<C-r>=i<CR>. <Esc>

4、变量增加

  :let  i += 1

5、停止录制宏

  q

6、跳转到行

  gg

7、选择范围

  jVG

8、应用所选范围

  :normal  @a

结果为: 

1. typora
2. vim
3. gdb
4. cmake
5. blender
6. avidemux-qt
7. fontforge
8. gimp
9. digikam
10. inkscape
11. pdftricks
12. kontact
13. kodi
14. openshot
15. pitivi
16. smplayer
17. simplescreenrecorder
18. deepin-screen-recorder
19. ardour
20. audacity
21. easytag
22. minuet
23. luppp
24. musescore
25. deepin-music
26. basket
27. chromium
28. kmail
29. kmymoney
30. kile
31. lokalize
32. pdfmixtool
33. retext
34. texstudio
35. texmaker
36. falkon
37. krdc
38. krfb
39. putty
40. gnuradio
41. ktouch
42. kturtle
43. rocs
44. r
45. step
46. wesnoth
47. chromium-bsu
48. extremetuxracer
49. ksudoku
50. supertux
51. sqlitebrowser
52. kalarm
53. knotes
54. okteta
55. qstardict
56. smb4k
57. terminator
58. zanshin
59. kcachegrind
60. kdbg
61. kdevelop
62. kdiff3
63. kde-dev-utils
64. qcachegrind
65. valgrind
66. indent
67. widelands
68. qtcreator
69. scratch
70. umbrello
71. gitg
72. ttf-dejavu
73. qt5-examples
74. qt5-doc
75. sl
76. rawtherapee
77. cool-retro-term
78. sakura
79. terminology
80. tilda
81. cowsay
82. cmatrix
83. wqy-microhei-lite
84. kicad
85. kicad-library
86. kicad-library
87. opencv
88. opencv-samples
人就像是被蒙着眼推磨的驴子,生活就像一条鞭子;当鞭子抽到你背上时,你就只能一直往前走,虽然连你也不知道要走到什么时候为止,便一直这么坚持着。
原文地址:https://www.cnblogs.com/guochaoxxl/p/14398679.html