#acl adpult:read,write Markus Naether:read,write All:read <> = Preface = For solving the tasks given by the lecture usually the usage of an integrated development environment (IDE) is overkill. This page presents a few simpler editors focusing on '''vim''' which is used by [[http://ad.informatik.uni-freiburg.de/staff/bast|Prof. Dr. Hannah Bast]]. == Vim == Vim is a comandline based editor with explicit modes. In ''insert mode'' text can be written as in any other editor. However in ''command mode'' operations like ''search'', ''write file'' or ''close'' can be performed. The vim of Prof. Dr. Hannah Bast is personalized with a version from 2010 [[https://ad-wiki.informatik.uni-freiburg.de/teaching/ProgrammierenCplusplusSS2010/Editor?action=AttachFile&do=view&target=vimrc.txt|downloadable]]. This file has to be placed in the home-directory as ''.vimrc'' on linux and ''_vimrc'' in windows. === Changing modes and help === * '''ESC''' exits ''insert mode'' and enters ''command mode''. If already in ''command mode'' nothing happens. * '''i''' (in ''command mode'') enters insert mode. * ''':help''' (in ''command mode'') displays a help file inside vim. === Useful commands === ||||'''File and generic commands''' || ||''':e ''' ||Open || ||''':w ''' ||Write current file || ||''':w ''' ||Write current file as || ||''':q''' ||Exit the editor if only one file is open. If the current file is modified this will fail with an error message. If multiple files are open, only the active one will be closed.|| ||''':wq / :x''' ||Combined '''''w'''''rite and '''''q'''''uit, alternatively e'''''x'''''it. || ||''':q! ''' ||Close the file without saving changes. || ||''':sp ''' ||Horizontal '''''sp'''''lit, opening an additional file below the current file.|| ||''':tabnew ''' ||Opens as a browser like tab. || ||||'''Basic editing commands''' || ||'''yy''' ||Copies current line || ||'''''n''yy''' ||Copy '''''n''''' lines || ||'''p / P''' ||Past previously copied line(s) below / above || ||'''dd''' ||Delete current line || ||'''''n''dd''' ||Delete '''''n''''' lines || ||'''dw''' ||Delete until the next word || ||'''cw''' ||Delete until next word and change mode to ''insert mode'' || ||'''o / O''' ||Create a new line below / above and change to ''insert mode '' || ||||'''Viewcommands''' || ||''':v''' ||Change to ''visual mode'' || ||''':se nu / :set number''' || Show line numbers || ||''':se nonu / :set nonumber''' || Hide line numbers || ||''':so''' $VIMRUNTIME/syntax/cpp.vim ||C++ syntax highlighting || ||'''Ctrl+W ''' ||Switch to pane above || ||'''Ctrl-K''' ||Switch to pane above and maximize it ''(only available with the .vimrc)'' || ||'''Ctrl+W ''' ||Switch to pane below || ||'''Ctrl-M''' ||Switch to pane below and maximize it ''(only available with the .vimrc)'' || ||'''Ctrl+W _ '''||Maximize current pane || ||'''F4''' ||Switch between *.h und *.cpp file. File has to be saved ''(only available with the .vimrc)'' || ||'''Ctrl-Page Up/Down''' ||Switch between browser style tabs ||