===== Editors ===== ==== General ==== * Many different editors * Unique (dis-)advantages * Different look and feel * Editors should provide us with - Simple text editing - Copy and paste - Search and replace - Saving changes - Wide availability === Two editors that satisfy our needs: === * nano * vim === Common starting point === nano filename vim filename ==== Nano ==== {{.:screenshot_nano.png}} ==== Nano explained ==== > This editor is focused on being easy to use, but still providing every feature a user might need. === Interface === > The interface consists of four parts, namely from top to bottom: * Title bar * Text area * Command line * Key bindings === Usage === > Nothing special, key-bindings visible while editing ^Feature ^ Usage ^ |Navigation | Arrow keys | |Actual editing| Typing text, as usual | |Cut/Paste line| ''%%%%''+k / ''%%%%''+u | |… | explained in key bindings field | === Short === > Use this editor if you are new to the command line.\\ > It is straight forward, but can be extended on the way. * Auto-indentation * Syntax highlighting * Multi-buffer {{.:screenshot_nano.png?0x300}} ==== Vi(m) ==== {{.:screenshot_vim.png}} ==== Vi(m) explained ==== > This editor is focused on productivity and efficiency, providing everything a user might need. === Interface === > The simple interface consists of two parts: * Text area * Command line > Since this editor is very easy to extend, after setting up a few plug-ins, it will probably look quite different! === Usage === > This is a multi-mode editor, you’ll have to switch modes whenever you change what you want to do. ^Feature ^ Usage ^ |Navigation| Arrow keys | |Writing | change to input mode, then write as usual | |Commands | exit current mode, press ''%%:%%'' | |… | explained on next slide | === Short === > Use this editor if you like a challenge.\\ > It is fast and very nice — but you’ll sometimes get hurt on the way. * File/Project Management * Use a plug-in manager {{.:screenshot_vim.png?0x300}} ==== Vi(m) modes and keys ==== * any mode: * back to the **default mode**: **''%%%%''** * command mode (followed by ''%%%%''): * **save** current file: **''%%w [filename]%%''** * **quit** the editor * after saving: **''%%q%%''** * without confirmation: **''%%q!%%''** * **help**: **''%%h [topic]%%''**, e.g. **''%%h tutorial%%''** * **search and replace**: **''%%%s/old/new/gc%%''** * //default mode//: * enter **input mode**: **''%%i%%''** * enter **command mode**: **''%%:%%''** //(colon)// * **mark** * **character**-wise: **''%%v%%''** * **line**-wise: **''%%-v%%''** * **delete** * **character**-wise: **''%%x%%''** * **line**-wise: **''%%dd%%''** * **marked content**: **''%%d%%''** * **search**: **''%%/abc%%''** [[http://www.ks.uiuc.edu/Training/Tutorials/Reference/virefcard.pdf|VI Reference]]