⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editing.txt

📁 MSYS在windows下模拟了一个类unix的终端
💻 TXT
📖 第 1 页 / 共 3 页
字号:
These commands are used to start editing a single file.  This means that thefile is read into the buffer and the current file name is set.  The file thatis opened depends on the current directory, see |:cd|.							*:filename*Note for systems other than Unix and MS-DOS: When using a command thataccepts a single file name (like ":edit file") spaces in the file name areallowed, but trailing spaces are ignored.  This is useful on systems thatallow file names with embedded spaces (like the Amiga).  Example: The command":e   Long File Name " will edit the file "Long File Name".  When using acommand that accepts more than one file name (like ":next file1 file2")embedded spaces must be escaped with a backslash.On Unix you can also use backticks in the file name, for example:>	:e `find . -name ver\\*.c -print`The backslashes before the star are required to prevent "ver*.c" to beexpanded by the shell before executing the find program.This also works for most other systems, with the restriction that thebackticks must be around the whole item.  It is not possible to have textdirectly before the first or just after the last backtick.You can use the ":e!" command if you messed up the buffer and want to startall over again.  The ":e" command is only useful if you have changed thecurrent file name.							*+cmd* *[+cmd]*The [+cmd] argument can be used to position the cursor in the newly openedfile, or execute any other command:	+		Start at the last line.	+{num}		Start at line {num}.	+/{pat}		Start at first line containing {pat}.	+{command}	Execute {command} after opening the new file.			{command} is any Ex command.To include a white space in the {pat} or {command}, precede it with abackslash.  To end with a backslash, use a double backslash.	:edit  +/The\ book       file	:edit  +/dir\ dirname\\  file							*file-formats*The 'fileformat' option sets the <EOL> style for a file:'fileformat'    characters	   name				~  "dos"		<CR><NL> or <NL>   DOS format		*DOS-format*  "unix"	<NL>		   Unix format		*Unix-format*  "mac"		<CR>		   Mac format		*Mac-format*Previously 'textmode' was used.  It is obsolete now.When reading a file, the mentioned characters are interpreted as the <EOL>.In DOS format (default for MS-DOS, OS/2 and Win32), <CR><NL> and <NL> are bothinterpreted as the <EOL>.  Note that when writing the file in DOS format,<CR> characters will be added for each single <NL>.  Also see |file-read|.When writing a file, the mentioned characters are used for <EOL>.  For DOSformat <CR><NL> is used.  Also see |DOS-format-write|.You can read a file in DOS format and write it in Unix format.  This willreplace all <CR><NL> pairs by <NL> (assuming 'fileformats' includes "dos"):>  :e file>  :set fileformat=unix>  :wIf you read a file in Unix format and write with DOS format, all <NL>characters will be replaced with <CR><NL> (assuming 'fileformats' includes"unix"):>  :e file>  :set fileformat=dos>  :wIf you start editing a new file and the 'fileformats' option is not empty(which is the default), Vim will try to detect whether the lines in the fileare separated by the specified formats.  When set to "unix,dos", Vim willcheck for lines with a single <NL> (as used on Unix and Amiga) or by a <CR><NL> pair (MS-DOS).  Only when ALL lines end in <CR><NL>, 'fileformat' is setto "dos", otherwise it is set to "unix".  When 'fileformats' includes "mac",and no <NL> characters are found in the file, 'fileformat' is set to "mac".If the 'fileformat' option is set to "dos" on non-MS-DOS systems the message"[dos format]" is shown to remind you that something unusual is happening.  OnMS-DOS systems you get the message "[unix format]" if 'fileformat' is set to"unix".  On all systems but the Macintosh you get the message "[mac format]"if 'fileformat' is set to "mac".If the 'fileformats' option is empty and DOS format is used, but while readinga file some lines did not end in <CR><NL>, "[CR missing]" will be included inthe file message.If the 'fileformats' option is empty and Mac format is used, but while readinga file a <NL> was found, "[NL missing]" will be included in the file message.If the new file does not exist, the 'fileformat' of the current buffer is usedwhen 'fileformats' is empty.  Otherwise the first format from 'fileformats' isused for the new file.Before editing binary, executable or Vim script files you should set the'binary' option.  A simple way to do this is by starting Vim with the "-b"option.  This will avoid the use of 'fileformat'.  Without this you risk thatsingle <NL> characters are unexpectedly replaced with <CR><NL>.You can encrypt files that are written by setting the 'key' option.  Thisprovides some security against others reading your files. |encryption|==============================================================================3. The current directory				*current-directory*							*:cd*:cd			On non-Unix systems: Print the current directory			name.  On Unix systems: Change the current directory			to the home directory.:cd {path}		Change the current directory to {path}.  Does not			change the meaning of an already entered file name,			because its full path name is remembered.  On MS-DOS			this also changes the active drive.							*:cd-*:cd -			Change to the previous current directory (before the			previous ":cd {path}" command).							*:chd* *:chdir*:chd[ir] [path]		Same as :cd.							*:pw* *:pwd*:pw[d]			Print the current directory name.  {Vi: no pwd}			Also see |getcwd()|.You may use the |:cd| command to get to another directory, so you will nothave to type that directory name in front of the file names.  One warning:After using |:cd| the full path name will be used for reading and writingfiles.  On some networked file systems this may cause problems.  The result ofusing the full path name is that the file names currently in use will remainreferring to the same file.  Example: If you have a file a:test and adirectory a:vim the commands ":e test" ":cd vim" ":w" will overwrite the filea:test and not write a:vim/test.  But if you do ":w test" the file a:vim/testwill be written, because you gave a new file name and did not refer to afilename before the ":cd".==============================================================================4. The argument list				*argument-list* *arglist*If you give more than one file name when starting Vim, this list isremembered as the argument list.  Do not confuse this with the file list,which you can see with the ":files" command |:files|.  The argument list wasalready present in Vi, the file list is new in Vim.  The file names in theargument list will also be present in the file list (unless they weredeleted with ":bdel").You can use the argument list with the following commands, and with theexpression functions |argc()| and |argv()|.							*:ar* *:args*:ar[gs]			Print the argument list, with the current file in			square brackets.							*:argu* *:argument*:[count]argu[ment] [count] [+cmd]			Edit file [count] in the argument list.  This fails			when changes have been made and Vim does not want to			|abandon| the current buffer.  Also see |+cmd|.  {Vi:			no such command}:[count]argu[ment]! [count] [+cmd]			Edit file [count] in the argument list, discard any			changes to the current buffer.  Also see |+cmd|.  {Vi:			no such command}							*:n* *:ne* *:next*:[count]n[ext] [+cmd]	Edit [count] next file.  This fails when changes have			been made and Vim does not want to |abandon| the			current buffer.  Also see |+cmd|.  {Vi: no count}.:[count]n[ext]! [+cmd]	Edit [count] next file, discard any changes to the			buffer.  Also see |+cmd|.  {Vi: no count}.:ar[gs] [+cmd] {arglist}:n[ext] [+cmd] {arglist}			Define {arglist} as the new argument list and edit			the first one.  This fails when changes have been made			and Vim does not want to |abandon| the current buffer.			Also see |+cmd|.:ar[gs]! [+cmd] {arglist}:n[ext]! [+cmd] {arglist}				*:next_f*			Define {arglist} as the new argument list and edit			the first one.  Discard any changes to the buffer.			Also see |+cmd|.:[count]N[ext] [count] [+cmd]				*:Next* *:N*			Edit [count] previous file in argument list.  This			fails when changes have been made and Vim does not			want to |abandon| the current buffer.			Also see |+cmd|.  {Vi: no count}.:[count]N[ext]! [count] [+cmd]			Edit [count] previous file in argument list.  Discard			any changes to the buffer.  Also see |+cmd|.  {Vi: no			count}.:[count]prev[ious] [count] [+cmd]			*:prev* *:previous*			Same as :Next.  Also see |+cmd|.  {Vi: only in some			versions}							*:rew* *:rewind*:rew[ind] [+cmd]	Start editing the first file in the argument list.			This fails when changes have been made and Vim does			not want to |abandon| the current buffer.			Also see |+cmd|.:rew[ind]! [+cmd]	Start editing the first file in the argument list.			Discard any changes to the buffer.  Also see |+cmd|.							*:la* *:last*:la[st] [+cmd]		Start editing the last file in the argument list.			This fails when changes have been made and Vim does			not want to |abandon| the current buffer.			Also see |+cmd|.  {not in Vi}:la[st]! [+cmd]		Start editing the last file in the argument list.			Discard any changes to the buffer.  Also see |+cmd|.			{not in Vi}							*:wn* *:wnext*:[count]wn[ext] [+cmd]	Write current file and start editing the [count]			next file.  Also see |+cmd|.  {not in Vi}:[count]wn[ext] [+cmd] {file}			Write current file to {file} and start editing the			[count] next file, unless {file} already exists and			the 'writeany' option is off.  Also see |+cmd|.  {not			in Vi}:[count]wn[ext]! [+cmd] {file}			Write current file to {file} and start editing the			[count] next file.  Also see |+cmd|.  {not in Vi}:[count]wN[ext][!] [+cmd] [file]			*:wN* *:wNext*:[count]wp[revous][!] [+cmd] [file]			*:wp* *:wprevious*			Same as :wnext, but go to previous file instead of			next.  {not in Vi}The [count] in the commands above defaults to one.  For some commands it ispossible to use two counts.  The last one (rightmost one) is used.If no [+cmd] argument is present, the cursor is positioned at the last knowncursor position for the file.  If 'startofline' is set, the cursor will bepositioned at the first non-blank in the line, otherwise the last know columnis used.  If there is no last known cursor position the cursor will be in thefirst line (the last line in Ex mode).The wildcards in the argument list are expanded and the file names are sorted.Thus you can use the command "vim *.c" to edit all the C files.  From withinVim the command ":n *.c" does the same.  On Unix you can also use backticks,for example:>	:n `find . -name \\*.c -print`The backslashes before the star are required to prevent "*.c" to be expandedby the shell before executing the find program.							*arglist-quit*You are protected from leaving Vim if you have not been editing the last filein the argument list.  This prevents you from forgetting that you were editingone out of several files.  To exit anyway try to exit twice.  If there arechanges in the current buffer this will fail.  You can exit anyway, and saveany changes, with the ":wq!" command.  To lose any changes use the ":q!"command.							*arglist-position*When there is an argument list you can see which file you are editing in thetitle of the window (if there is one and 'title' is on) and with the filemessage you get with the "CTRL-G" command.  You will see something like	(file 4 of 11)If 'shortmess' contains 'f' it will be	(4 of 11)If you are not really editing the file at the current position in the argumentlist it will be	(file (4) of 11)This means that you are position 4 in the argument list, but not editing thefourth file in the argument list.  This happens when you do ":e file".==============================================================================5. Writing and quitting				*write-quit* *save-file*Note: When the 'write' option is off, you are not able to write any file.							*:w* *:write*:[range]w[rite][!]	Write the specified lines to the current file.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -