Difference between revisions of "Vim keys"

From Jens' Hjørne
Jump to navigation Jump to search
m
Line 63: Line 63:
 
|-
 
|-
 
|C-y|| ||Yank back killed text at current cursor position. M-y will then cycle through earlier killed texts.
 
|C-y|| ||Yank back killed text at current cursor position. M-y will then cycle through earlier killed texts.
 +
-->
 +
|}
 +
 +
==File handling, buffers and exiting==
 +
{|
 +
!align="left"|Key!! !!align="left"|Function
 +
<!--
 +
|-
 +
|C-x C-f||&nbsp;||find (open or create) file (prompted for filename)
 +
-->
 +
|-
 +
|:w||&nbsp;||save file (in Normal mode)
 +
|-
 +
|:w path/to/file/filename||&nbsp;||save file as ...
 +
|-
 +
| ||&nbsp;||save all files
 +
|-
 +
|:wq||&nbsp;||save current file and exit vim
 +
<!--
 +
|-
 +
|C-x k||&nbsp;||kill current buffer
 +
-->
 +
|-
 +
| ||&nbsp;||move to or create another buffer (prompt for buffer name)
 +
<!--
 +
|-
 +
|C-x C-b||&nbsp;||show buffer list
 +
|-
 +
|C-x i||&nbsp;||insert file at cursor position
 
-->
 
-->
 
|}
 
|}
  
 
[[Category:Værktøjer, Programmering]][[Category:Keyboard shortcuts]]
 
[[Category:Værktøjer, Programmering]][[Category:Keyboard shortcuts]]

Revision as of 22:04, 11 February 2018

Ressources to check

Modes

Mode   Key   Comment
Normal   <ESC>   Normal is the default mode when vim starts
Insert   i   This is the normal way of entering Insert mode.
Insert   A   This will enter Insert mode and move the cursor to the end of the current line.

Movement (Normal mode)

    Forward   Backward
Unit   Key   Function   Key   Function
Character   l or →   Move one character backward   h or ←   Move one character forward
Word   w   Move 1 word forward   b   Move one word backward
Line   j or ↓   Move to next line   k or ↑   Move to previous line
Line     Move to end of line   0 (zero)   Move to start of line
Sentence     Move forward to end of sentence     Move back to beginning of sentence
Document   G   Move to the end of the document   gg   Move to the start of the document

Editing (Normal mode)

Key   Function
x   Delete the character under the cursor

File handling, buffers and exiting

Key   Function
:w   save file (in Normal mode)
:w path/to/file/filename   save file as ...
  save all files
:wq   save current file and exit vim
  move to or create another buffer (prompt for buffer name)