레이블이 vim인 게시물을 표시합니다. 모든 게시물 표시
레이블이 vim인 게시물을 표시합니다. 모든 게시물 표시

2015년 12월 27일 일요일

windows vim 사용 시 backkey 안먹을 때 설정 방법, source code formatting 단축키


http://stackoverflow.com/questions/5419848/backspace-doesnt-work-in-gvim-7-2-64-bit-for-windows



49
down voteaccepted
Does it entirely not work, or does it just not backspace past where you went into insert mode? There's an option backspace which controls this:
Influences the working of <BS>, <Del>, CTRL-W and CTRL-U in Insert
mode.  This is a list of items, separated by commas.  Each item allows
a way to backspace over something:
value       effect
indent      allow backspacing over autoindent
eol         allow backspacing over line breaks (join lines)
start       allow backspacing over the start of insert; CTRL-W and CTRL-U
            stop once at the start of insert.
owen_water's suggestion is the same as Carpetsmoker's comment, enabling all three of these. That's generally what people want, since it's a bit surprising to have Vim refuse to let you backspace text that's right there. So take your pick of the two equivalent choices - I'd go with the more verbose and clear one:
set backspace=2
set backspace=indent,eol,start
In some cases, bad terminals can mess with backspace and delete, but I doubt that's your problem in Windows. There is some ability to fix this; see :help fixdel.
shareimprove this answer

http://vim.wikia.com/wiki/Format_a_code_block

 Formatting a functionEdit
Here are some basic formatting commands:

= is an operator (by default, it formats/indents text).
i{ is a text object that specifies the surrounding code block.
vi{ visually selects the inner code block around the cursor.
=i{ formats the code block.
=2i{ formats the current block and the block around it.
You can format the entire buffer with gg=G.

2015년 7월 2일 목요일

[Tip] Windows 상에서 VIM configuration 위치


Windows에서 vim 기본 설정을 지정하기 위해 
아래 경로에 vim 설정이 담긴 파일들을 만들면 된다.

   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"

환경 변수인 $HOME, $VIM을 확인하는 방법은
vim을 실행 한 뒤 아래와 같이 확인 할 수 있다.

:echo $HOME
:echo $VIM 

일반적인 windows 7이고 
vim을 Self-installing executable로 기본 위치에 설치 했다면
환경변수가 가리키는 디렉토리는 아래와 같음.

$HOME = C:\Users\사용자아이디
$VIM = C:\Program Files (x86)\Vim


windows용 vim을 설치했다면
수정 시 기본적으로 backup file을 만들 텐데
이를 disable 시키는 설정은 'set nobackup' 임.

참고로 샘플 vimrc는 linux에서 사용하던거 복사하던가
검색 하면 좋은 것들이 무수히 많이 보인다.