學(xué)習(xí)Vim合并行的方法和技巧
剛接觸 Vim 會(huì)覺得它的學(xué)習(xí)曲線非常陡峭,要記住很多命令。所以這個(gè)系列的分享,不會(huì)
教你怎么配置它,而是教你怎么快速的使用它。
在開發(fā)時(shí)為了代碼美觀,經(jīng)常會(huì)把屬性用換行的方式顯示。
<el-dialog title="批量編輯所屬組織" :visible.sync="isShow" :before-close="beforeClose" > ... </el-dialog>
這種場(chǎng)景適用于標(biāo)簽屬性少,代碼量也少的情況。
如果標(biāo)簽突然增多,閱讀起來就會(huì)很不方便。比如下面這樣:
<template> <el-table :data="tableData" border style="width: 100%"> <el-table-column fixed prop="date" label="日期" width="150"> </el-table-column> <el-table-column prop="name" label="姓名" width="120"> </el-table-column> <el-table-column prop="province" label="省份" width="120"> </el-table-column> <el-table-column prop="city" label="市區(qū)" width="120"> </el-table-column> <el-table-column prop="address" label="地址" width="300"> </el-table-column> <el-table-column prop="zip" label="郵編" width="120"> </el-table-column> <el-table-column fixed="right" label="操作" width="100"> <template scope="scope"> <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button> <el-button type="text" size="small">編輯</el-button> </template> </el-table-column> </el-table> </template>
所以我們就需要把標(biāo)簽和屬性變?yōu)橐恍小?/p>
<template> <el-table :data="tableData" border style="width: 100%"> <el-table-column fixed prop="date" label="日期" width="150"> </el-table-column> <el-table-column prop="name" label="姓名" width="120"> </el-table-column> <el-table-column prop="province" label="省份" width="120"> </el-table-column> <el-table-column prop="city" label="市區(qū)" width="120"> </el-table-column> <el-table-column prop="address" label="地址" width="300"> </el-table-column> <el-table-column prop="zip" label="郵編" width="120"> </el-table-column> <el-table-column fixed="right" label="操作" width="100"> <template scope="scope"> <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button> <el-button type="text" size="small">編輯</el-button> </template> </el-table-column> </el-table> </template>
多數(shù) IDE 在代碼格式化時(shí),都不會(huì)處理標(biāo)簽的屬性。
我們只能通過光標(biāo)換行,然后在按刪除的方式進(jìn)行解決。
那么接下來介紹的這個(gè)技巧,叫 “合并行”,能讓我們快速的解決這個(gè)問題。
其實(shí)我們可以看出來,這個(gè)VIM合并行,就好比是代碼格式化一樣的,讓寫出的代碼更加容易讀,格式更加好看,如果大家還有其他問題,可以在下面留言區(qū)討論。
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。