vimrc - Can vim realize the complex requirement of automatically detecting jpg files in the working directory and then automatically filling in the content based on the number of files?
PHPz
PHPz 2017-05-16 16:34:42
0
2
637

My requirement is to detect the images in the working directory, and then fill in the corresponding img tags into page.html. Just like the effect I manually had.

PHPz
PHPz

学习是最好的投资!

reply all(2)
黄舟

You don’t know how to use your own brain.

…wait, you’re Windows? Then I will just say that the idea is good.

  1. Read in the file list. For example, you can use the !r ls *.jpg 来读。Windows 上自己想办法。如果你没办法通过外部命令获取文件名列表,也可以试试 Vim 的 glob() function under Linux.

  2. Ctrl-V Enter column block visual mode and write the same part in front of the file name (select the beginning and press I)

  3. This step is not very intuitive. Use V to enter line selection, then press :s/$/..../ to append characters at the end with replace

Of course you can also use substitution in step 2.

There is also a plug-in called visincr, which is very suitable for generating this kind of numerical sequence.

PHPzhong

This is the purpose of HTML template engines and various front-end construction tool chains. . . . .

vim is possible, but it is not recommended because you still need to update it manually

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template