###################################################### # saving a session (open files, windows, etc) :mksession! sess-save-file # returning to it vim -S sess-save-file # return to previous editing-place in a newly opened file " (just '"' !) "... if you want all files to go to the same instance of Vim, start Vim with the --remote-silent option" ###################################################### # simple, old way, multiple files, # viewing one at a time, # not able to open a further one to # add to the list vi file1 file2 etc :n # move to next :N # move to previous :args # list which were opened :bn # next buffer :bp # previous buffer :b5 # fifth buffer :b string # buffer with [file]name substring-matched by string, *iff* unambiguous ^ # switch to most recently shown file before the current one ###################################################### # Note on the principles... # # Each opened file is a "buffer" (b-commands, as above) # with the content in its edited state, able to be saved # back to that file or elsewhere. # The buffer is displayed in a "window" (Ctrl-w commands, # as below); any window can show any buffer, and there can # be multiple windows. # ###################################################### # split-screen way, # view muliple at same time, # and add further vi file :sp file # split screen, new file in new part, vertical stacking :vsp file # split screen, new file in new part, horizontal stacking Ctrl-w s # stack vertically (horiz. split) Ctrl-w v # stack horizontally (vertical split) vi -o files # window-per-file, vertical stacking vi -O files # window-per-file, horizontal stacking vi -o4 files # only 4 windows for however many files vi -04 files # only 4 windows Ctrl-w w # move between windows Ctrl-w {h,j,k,l} # move between windows (left,down,up,right) Ctrl-w w # move to next split-part Ctrl-w W # move to previous split-part Ctrl-w c # close current window Ctrl-w o # close all except current window ###################################################### # tabs (introduced in v7) # :tabe file # add file in another tab gt | :tabn # next gT | :tabp | :tabN # prev # show all tabs :ls ######################################################