사용자 지정된 스크립트 파일에 이러한 구성을 넣은 다음 해당 스크립트 파일을 선택적으로 사용하여 작업 영역 구성을 열 수 있습니다.
스크립트 파일 :
:bl
:bf
:tabe
:n
:split
:vsplit
:wincmd l
:n
:wincmd j
:n
:n
:vsplit
:wincmd l
:n
:wincmd h
:wincmd k
:tabn
그리고 당신과 같은 호출 할 수는 :
vim -S script.vim file1.txt file2.txt file3.txt file4.txt file5.txt
이 구성에 따라, 그 옆에 열려있는 탭,은 File2.txt에 정력을 엽니 다 , 전환 할 때 커서를 왼쪽 상단 파일 (file2.txt)에 놓습니다. 각 라인의
추가 설명 : 우리가 분할 할 때, 커서가 원래 창에 머물 것으로, 각 창 :n
및 :N
를 사용하여 독립적으로 탐색 할 수있는 다른 파일을 보여줄 것
참고. 새 창을 만들면 창을 만들 때와 같은 파일이 표시됩니다.
내 의견에 언급했듯이 처음 두 줄은 VIM에 모든 파일을 읽었 음을 알려주므로 VIM은 세션이 끝날 때 "편집 할 파일이 4 개 더 많습니다."라고 불평하지 않습니다.
:bl Go to last file
:bf Go to first file
:tabe Create new tab
:n Open next file (file2.txt)
:split Split horizontally (will create new window below with the content of file2.txt)
:vsplit Split vertically (will create new window on the top right with the content of file2.txt)
:wincmd l Go to the window to the right (which currently displays file2.txt)
:n Open next file (file3.txt)
:wincmd j Go to window at the bottom
:n Open next file (file3.txt, because bottom window was displaying file2.txt)
:n Open next file (file4.txt)
:vsplit Split vertically (will create new window on the right with content file4.txt)
:wincmd l Go to window to the right (which is bottom right)
:n Open next file (file5.txt, because bottom-right window was displaying file4.txt)
:wincmd h Go to window to the left
:wincmd k Go to window above (this sets the cursor on file2.txt on top left)
:tabn Go to next tab (the first one, displaying file1.txt)
무엇을 시도했는데 실패 했습니까? – romainl
읽었습니까? [링크] (http://stackoverflow.com/questions/53664/how-to-effectively-work-with-multiple-files-in-vim) – Antarus