반응형
VI 사용시 불필요한 공백라인 제거
:g/^$/d
:v/./d
:g/^\_$\n\_^$/d
fun! DelBlank()
let _s=@/
let l = line(".")
let c = col(".")
:g/^\n\{2,}/d
let @/=_s
call cursor(l, c)
endfun
map <special> <leader>d :keepjumps call DelBlank()<cr>
Use either of the following commands to delete all empty lines:
:g/^$/d
:v/./d
If you want to delete all lines that are empty or that contain only whitespace characters (spaces, tabs), use either of:
:g/^\s*$/d
:v/\S/d
반응형