Welcome to JetCobot repository
4.Ubuntu common editors
4.Ubuntu common editors
4.1Editor
4.1.1、vim
vim is an upgraded version of vi. The most common difference is that it can display some special information of system files in multiple colors.
- Installation command
sudo apt install vim
- Three main modes
Command mode (edit mode): Default mode, move cursor, cut/paste text (interface performance: file name is displayed in the lower left corner or is empty)
Insert mode (input mode): Modify text (interface performance: -INSERT– is displayed in the lower left corner) In insert mode, press the ESC key to return to command mode
Last line mode (extended mode): save, exit, etc. (Interface performance: -VISUAL– displayed in the lower left corner) In last line mode, press the ESC key twice in succession to return to last line mode.
- Mode switch
Switch command mode to edit mode
xxxxxxxxxxi # Insert mode to enter editing modea #Append mode to enter editing modeo # Start editing at the beginning of the next line of the current lineO # Start editing at the beginning of the line above the current lineSwitch command mode to last line mode
xxxxxxxxxx: # Enter colon 【:】Switch to command mode from last line mode: press 【esc】
Switch from edit mode to command mode: press 【esc】
Esc: exit to current mode
Esc build Esc build: always return to command mode
- Last line mode
xxxxxxxxxxw # saveq #Exitq! # Force exitx # Save and exitset nu #display line numberset # nonu hide line number0,$d # vim deletes the entire contents of the file:/string # Search the string string backward from the cursor; press n to locate the next one, and shfit+n to locate the previous one.g/string # Retrieve string. Stops the cursor at the beginning of the first retrieved string string.- Command mode
xxxxxxxxxxyy # copyp # Paste3yy # Copy 3 lines2p # Paste 2 timesdd # cut3dd # Cut 3 linesu # UndoCtrl + r # Undodd # Delete the current linedG # Delete the current line to the end of the filedH # Delete the current line to the beginning of the filegg # Jump to the first line of the current documentG # Jump to the last line of the current document^ # Jump to the beginning of the current line$ # Jump to the end of the current lineh # Shift one character leftj # Move down one linek # move up one linel # Shift one character to the rightPageDown(or Ctrl+F) # Scroll down one screenPageUp(or Ctrl+B) # Scroll up one screen4.1.2、nano
nano is a text editor for Unix and Unix-like systems, a copy of Pico.
- Install
xxxxxxxxxxsudo apt install nano
New/open file
xnano path + file nameEg:nano test_nano.txt
Control commands
xCtrl+v # Next pageCtrl+y # Previous pageCtrl+w # Search for a word or phraseCtrl+x # Close the current text, exit nano, and return to the shellCtrl+\ # Search and replaceCtrl+k # Cut text linesCtrl+u # Paste lines of textCtrl+c # Display the cursor position in the text4.1.3、gedit
In the editor, we can click the "Open" button to browse the recently opened file list and open the file; click the "Save" button to save the file currently being edited; click the menu bar on the right to perform more operations.
x
Ctrl + s save fileCtrl + Shift + s Save asCtrl + f Search text contentThe gedit editor must be started when the interface can be displayed, and it cannot be started remotely without an interface such as ssh, jupyter, putty, etc.