'vi'에 해당되는 글 2건

  1. 2020.12.15 VIM /etc/vimrc 설정
  2. 2020.11.08 VI 사용시 불필요한 공백라인 제거
카테고리 없음2020. 12. 15. 21:48
반응형

/etc/vimrc

 

set hlsearch " 검색어 하이라이팅
set nu " 줄번호
set autoindent " 자동 들여쓰기
set scrolloff=2
set wildmode=longest,list
set ts=4 "tag select
set sts=4 "st select
set sw=1 " 스크롤바 너비
set autowrite " 다른 파일로 넘어갈 때 자동 저장
set autoread " 작업 중인 파일 외부에서 변경됬을 경우 자동으로 불러옴
set cindent " C언어 자동 들여쓰기
set bs=eol,start,indent
set history=256
set laststatus=2 " 상태바 표시 항상
set paste " 붙여넣기 계단현상 없애기
set shiftwidth=4 " 자동 들여쓰기 너비 설정
set showmatch " 일치하는 괄호 하이라이팅
set smarttab
set smartindent
set softtabstop=4
set tabstop=4
set ruler " 현재 커서 위치 표시
set incsearch
set statusline=\ %<%l:%v\ [%P]%=%a\ %h%m%r\ %F\
if $LANG[0]=='k' && $LANG[1]=='o'
set fileencoding=korea
endif
if has("syntax")
syntax on
endif

반응형
Posted by Dream Come True
카테고리 없음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