vim을 더 빠르게 종료 수 있습니다

Vim을 주로 긴 작업 세션이 아닌 빠른 편집에 사용합니다. : 그런 의미에서, 나는 특히 힘든 종료를위한 키보드 시퀀스를 찾을 수 있습니다 Esc, Shift+ ;, w, q,를 Enter.

최소한의 키 입력으로 Vim을 종료하는 방법 (문서 저장 가능)? 특히 삽입 모드에서.



답변

Shiftzz 명령 모드에서 파일을 저장하고 종료합니다.


답변

ZZ일반 모드에서는 현재 파일을 수정 한 경우 저장하고 현재 창 / 탭을 종료하거나 닫습니다 ( 수정되지 않은 경우에도 파일을 :x쓰지 않는 것과 동일 :wq).

모든 창, 탭 및 숨겨진 버퍼에 수정 된 파일을 모두 작성한 후 무조건 종료하려면 필요합니다 :xa(일부 또는 다른 이유로 파일을 쓸 수없는 경우 여전히 종료되지 않음)

아무 것도 변경하지 않고 무조건 종료하려면 : ZQ(와 동일 :q!).


답변

:x 하나의 키보다 작다 :wq


답변

자주 사용하는 작업에 대한 사용자 지정 매핑을 만듭니다. vim을 자주 종료하면 몇 가지 키 입력만으로 매핑을 만듭니다 (예 :

nnoremap <leader><leader> :xa<cr>

이 경우 <leader>사용하여 쉼표로 설정되어 let mapleader = ","타격 쉼표 두 번 정력을 종료하고 변경 사항을 저장하는 빠른 방법입니다. 삽입 모드에있을 때 키 스트로크를 하나 더 저장하려면 해당하는 삽입 모드 매핑도 만드십시오.

inoremap <leader><leader> <esc>:xa<cr>

그러나 <leader두 번 쳤을 때 우연히 아주 악명 일 수 있습니다 .


답변

이것을 사용하여 마술을하십시오. 두 번의 키 입력 만!

Ctrl+ s저장

ctrl+ d저장하고 종료하려면

ctrl+ q변경 사항 삭제를 종료합니다.

1 일 이것을 ~ / .bashrc에 넣으십시오.

bind -r '\C-s'
stty -ixon

2 일. 이것을 ~ / .vimrc에 넣으십시오.

inoremap <C-s> <esc>:w<cr>                 " save files
nnoremap <C-s> :w<cr>
inoremap <C-d> <esc>:wq!<cr>               " save and exit
nnoremap <C-d> :wq!<cr>
inoremap <C-q> <esc>:qa!<cr>               " quit discarding changes
nnoremap <C-q> :qa!<cr>

셋째. vim을 다시 시작하고 더 생산적인 날을 얻으십시오!


답변

어떻게 막 Q‘종료’에 대한?

즉 하나는 키 입력을 (즉, 이동이 필요한 것 Shift등을 Q). 또한 실수로 거의 피해를 입지 않은 주요 조합입니다.

기본적으로 vim은 Q를에 매핑합니다 switch to "Ex" mode. “Ex”모드를 내가하는 것처럼 쓸모 없거나 성가신 것으로 생각하면 기본 기능을 전혀 놓치지 않을 것입니다.

.vimrc파일에 내가 가진 것이 있습니다.

" allow quit via single keypress (Q)
map Q :qa<CR>

저장하지 않은 버퍼가 있으면 종료하기 전에 프롬프트가 표시됩니다.


답변

여기 VIM에 대한 치트 시트가 있습니다

VIM에 대한 치트 시트

To quit the vi editor without saving any changes you've made:

If you are currently in insert or append mode, press Esc.

Press  :  (colon). The cursor should reappear at the lower left corner of the screen beside a colon prompt.

Enter the following:
  q!
This will quit the editor, and all changes you have made to the document will be lost.

좀 더 ::

파일 닫기 및 저장

When you edit a file in vi, you are actually editing a copy of the file rather than the original. The following sections describe methods you might use when closing a file, quitting vi, or both.
Quitting and Saving a File

The command ZZ (notice that it is in uppercase) will allow you to quit vi and save the edits made to a file. You will then return to a Unix prompt. Note that you can also use the following commands:

:w  to save your file but not quit vi (this is good to do periodically in
    case of machine crash!).
:q  to quit if you haven't made any edits.
:wq to quit and save edits (basically the same as ZZ).
Quitting without Saving Edits

Sometimes, when you create a mess (when you first start using vi this is easy to do!) you may wish to erase all edits made to the file and either start over or quit. To do this, you can choose from the following two commands:

:e! reads the original file back in so that you can start over.
:q! wipes out all edits and allows you to exit from vi.