IVim: Difference between revisions

From HaFrWiki42
Jump to navigation Jump to search
mNo edit summary
Line 42: Line 42:
Which files can be edited.
Which files can be edited.
*
*
== Basic Vi Commands ==
{{FormFCT|9|blue|vi}} is one of the most commonly used editor program and included by default with every UNIX and Linux system.
{{FormFCT|9|blue|vi}} basically operates in 3 modes:
* '''vi mode''' – Standard Mode {{FormFCT|9|blue|vi}} starts in.
* '''command mode''' – Command Mode {{FormFCT|9|blue|vi}} after pressing the key colon (“:”).
* '''input mode''' – Editing Mode actual can edit text.
{| class="wikitableharmcenter" width="425px"
! width="100px" | Command
! width="325px" | Action
|-
| k
| style="text-align:left;" | Move one line upwards
|-
| l
| style="text-align:left;" | Move one character to the right
|-
| h
| style="text-align:left;" | Move one character to the left
|-
| w
| style="text-align:left;" | Move one word to the right
|-
| W
| style="text-align:left;" | Move one word to the right past punctuation
|-
| b
| style="text-align:left;" | Move one word to the left
|-
| B
| style="text-align:left;" | Move one word to the left past punctuation
|-
| e
| style="text-align:left;" | Move to the end of the current word
|-
| 1G
| style="text-align:left;" |Move to the beginning of the file
|-
| H
| style="text-align:left;" | Move to the top of the current screen
|-
| M
| style="text-align:left;" | Move to the middle of the current screen
|-
| L
| style="text-align:left;" | Move to the bottom of the current screen
|-
| Ctrl-G
| style="text-align:left;" | Move to the last line in the file
|-
| Ctrl-F
| style="text-align:left;" | Move one screen towards the end of the file
|-
| Ctrl-D
| style="text-align:left;" | Move 1/2 screen towards the end of the file
|-
| Ctrl-B
| style="text-align:left;" | Move one screen towards the beginning of the file
|-
| Ctrl-U
| style="text-align:left;" | Move 1/2 screen towards the beginning of the file
|-
| Ctrl-L
| style="text-align:left;" | Refresh the screen
|-
| 5G
| style="text-align:left;" | Move to line 5 of the file (5 can be any line number)
|-
| /string
| style="text-align:left;" | Find text string forward
|-
| ?string
| style="text-align:left;" | Find text string backward
|-
| n
| style="text-align:left;" | Find forward next string instance after a string search
|-
| N
| style="text-align:left;" | Find backward next string instance after a string search
|-
| ZZ
| style="text-align:left;" |Save the file exit vi
|-
| x
| style="text-align:left;" | Delete the character at the cursor
|-
| X
| style="text-align:left;" | Delete the character behind the cursor
|-
| dd
| style="text-align:left;" | Delete the line the cursor is on
|-
| 10dd
| style="text-align:left;" | Delete the 10 lines following the cursor
|-
| yy
| style="text-align:left;" | Yank the current line
|-
| p
| style="text-align:left;" | Put the yanked line below the current line
|-
| P
| style="text-align:left;" | Put the yanked line above the current line
|}


== See also ==
== See also ==

Revision as of 07:21, 18 June 2021

Boogaloo iVim is a text editor on iOS based on Vi IMproved by Bram Moolenaar.

vi is a screen-oriented text editor originally created for the Unix operating system. The portable subset of the behavior of vi and programs based on it, and the ex editor language supported within these programs, is described by (and thus standardized by) the Single Unix Specification and POSIX. The original code for vi was written by Bill Joy in 1976, as the visual mode for a line editor called ex that Joy had written with Chuck Haley. [1]


Getting help on iVim

Apple iCloud

All iCloud Documents are store in ~/Library/Mobile\ Documents/com~apple~CloudDocs. So:
Start by opening Terminal and then

$ cd ~/Library/Mobile\ Documents/com~apple~CloudDocs
$ ls -Al
.DS_Store
..
bash

Interchange iMac with iPad

Let us assume that on an iMac there is a file created in the subdirectory ./Documents/Text on the iCloud Drive named Example.txt.
The easiest way to open this file on an iPad. This method works for iVim but also for other Apps.

  • Open the App Files.
  • Choose iCloud Drive under the tab Location in the left pane.
  • Navigate to Documents and then Text.
  • Now hold your finger on the filename Example and choose Share from the appearing list.
  • On the 2nd row (with Airdrop, Messages, Mail...) go to the where More. Unless you see the App you wanna use for editing this file.
  • From the appearing App list choose the required App. In this case that should be iVim.
  • The file is now opened in iVim. Make some changes and write the file to disk using the vim command :w<enter>.
  • Now iVim is showing where it save the result:
    /private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/Documents/Text/Example.txt

Where are my Files

Every App on an iPad has its own local storage. So you can not edit files that live in other Apps local storage.
Can you edit files in the iCloud?


Which files can be edited.

Basic Vi Commands

vi is one of the most commonly used editor program and included by default with every UNIX and Linux system. vi basically operates in 3 modes:

  • vi mode – Standard Mode vi starts in.
  • command mode – Command Mode vi after pressing the key colon (“:”).
  • input mode – Editing Mode actual can edit text.
Command Action
k Move one line upwards
l Move one character to the right
h Move one character to the left
w Move one word to the right
W Move one word to the right past punctuation
b Move one word to the left
B Move one word to the left past punctuation
e Move to the end of the current word
1G Move to the beginning of the file
H Move to the top of the current screen
M Move to the middle of the current screen
L Move to the bottom of the current screen
Ctrl-G Move to the last line in the file
Ctrl-F Move one screen towards the end of the file
Ctrl-D Move 1/2 screen towards the end of the file
Ctrl-B Move one screen towards the beginning of the file
Ctrl-U Move 1/2 screen towards the beginning of the file
Ctrl-L Refresh the screen
5G Move to line 5 of the file (5 can be any line number)
/string Find text string forward
?string Find text string backward
n Find forward next string instance after a string search
N Find backward next string instance after a string search
ZZ Save the file exit vi
x Delete the character at the cursor
X Delete the character behind the cursor
dd Delete the line the cursor is on
10dd Delete the 10 lines following the cursor
yy Yank the current line
p Put the yanked line below the current line
P Put the yanked line above the current line


See also

top

Reference

top

  1. Wikipedia vi, The text is based on the vi page on wikipedia.