'gVim'에 해당되는 글 1건

  1. 2020.11.08 VI 사용시 불필요한 공백라인 제거
카테고리 없음2020. 11. 8. 14:32
반응형

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

 

반응형
Posted by Dream Come True