vim Summary

1. Operating mode

  Command Mode

  

  Edit mode

  

  General mode

  

  

  

  

  

  

 

2. Profiles

  : Set nu /: set nonu display and cancel the line number

  : Syntax on /: syntax off based on whether or not to display the color associated syntax help. When you modify the relevant configuration file or Shell script file in Vim, by default, it will display the corresponding color, to help troubleshoot. If you think that interference color, you can cancel this setting

  : Set hlsearch /: string highlight settings if set nohlsearch looking display. The default is set hlsearch highlighted

  : Set ruler /: set noruler set whether to display the status bar in the lower right corner. The default display is set ruler 

  : Set showmode /: set noshowmode setting whether to display the status bar as "-INSERT--" in the lower left corner or the like. The default display is set showmode

  : Set list /: set nolist Set whether to display hidden characters (Tab key with "^ I" said the carriage return is represented by "$"). The default is nolist display. If you use a set list display hidden characters, similar to the "cat -A file name"

  vim support more setting parameters, you can: view "set all"

  These parameters are set to take effect only temporarily, and then close the file once open, we need to re-enter. If you want permanent, you need to manually set up vim configuration file "~ / .vimrc", the parameters needed to write the configuration file can be permanent

  Under indows carriage in Linux is "^ M $" symbol is displayed instead of "$" symbol. This will cause the program to edit the script under Windows, it can not be performed in Linux. Then you can command "dos2unix", the Windows format into Linux format, of course, in turn, "unix2dos" command is to Linux format into Windows format. These two commands not installed by default, you need to use the manual installation.

 

3. Tips

  Import other file contents

    : R filename file content into the cursor position

  Execute system commands in vim

    :! Command file in order execution system

    Here are just execute system commands in vim, but not the result of system commands written to the file. Mainly used in the file editor, view system information, such as time

  Import command result

    :! R command execution system within vim, and the results of the command into the cursor line

  Set shortcuts

    : Command map shortcut keys shortcut keys to perform custom keyboard shortcuts

  vim allows custom shortcuts, shortcut keys used in custom as follows:

    : Map ^ PI # <ESC> press "ctrl + p", adding comments beginning of the line

    : Map ^ B ^ x press "ctrl + b", delete the first line of the first letter (remove the comment)

    ^ P shortcut not be entered manually, perform ctrl + V + P to define, or ctrl + V, then ctrl + P. ^ B is the same shortcuts

  Multiple files open

    In vim you can open two files at the same time, just run the following command

    Split screen to open two files vim -o test cesshi # lowercase o meeting

    vim -O test about cesshi # uppercase O will open two split screen files

    This opens two files at the same time, easy to operate.

    If "-o" up and down to open two files, can press the "ctrl + w", then "down arrow" the mode switching between the two files.

    If about "-O" open two files, you can press the "ctrl + w", then "left arrow" mode switching between the two files

Guess you like

Origin www.cnblogs.com/sswind/p/11791240.html
Recommended