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

📄 editing.txt

📁 MSYS在windows下模拟了一个类unix的终端
💻 TXT
📖 第 1 页 / 共 3 页
字号:
*editing.txt*   For Vim version 5.8.  Last change: 2001 Jan 18		  VIM REFERENCE MANUAL    by Bram MoolenaarEditing files						*edit-files*1. Introduction			|edit-intro|2. Editing a file		|edit-a-file|3. The current directory	|current-directory|4. The argument list		|argument-list|5. Writing and quitting		|write-quit|6. Editing binary files		|edit-binary|7. Encryption			|encryption|==============================================================================1. Introduction						*edit-intro*Editing a file with Vim means:1. reading the file into the internal buffer2. changing the buffer with editor commands3. writing the buffer into a file							*current-file*As long as you don't write the buffer, the original file remains unchanged.If you start editing a file (read a file into the buffer), the file name isremembered as the "current file name".							*alternate-file*If there already was a current file name, then that one becomes the alternatefile name.  All file names are remembered in the file list.  When you enter afile name, for editing (e.g., with ":e filename") or writing (e.g., with (:wfile name"), the file name is added to the list.  You can use this list toremember which files you edited and to quickly switch from one file toanother with the CTRL-^ command (e.g., to copy text).  First type the numberof the file and then hit CTRL-^.  {Vi: only one alternate file name}CTRL-G		or				*CTRL-G* *:f* *:fi* *:file*:f[ile]			Prints the current file name (as typed), the			cursor position (unless the 'ruler' option is set),			and the file status (readonly, modified, read errors,			new file)).  See the 'shortmess' option about how tho			make this message shorter.  {Vi does not include			column number}{count}CTRL-G		Like CTRL-G, but prints the current file name with			full path.  If the count is higher than 1 the current			buffer number is also given.  {not in Vi}							*g_CTRL-G*g CTRL-G		Prints the current position of the cursor in three			ways: Column, Line and Character.  If there are			characters in the line that take more than one			position on the screen (<Tab> or special character),			both the "real" column and the screen column are			shown, separated with a dash.  See also 'ruler'			option.  {not in Vi}							*:file_f*:f[ile] {name}		Sets the current file name to {name}.:buffers:files:ls			List all the currently known file names.  See			'windows.txt' |:files| |:buffers| |:ls|.  {not in			Vi}Vim will remember the full path name of a file name that you enter.  In mostcases when the file name is displayed only the name you typed is shown, butthe full path name is being used if you used the ":cd" command |:cd|.							*home-replace*If the environment variable $HOME is set, and the file name starts with thatstring, it is often displayed with HOME replaced with "~".  This was done tokeep file names short.  When reading or writing files the full name is stillused, the "~" is only used when displaying file names.  When replacing thefile name would result in just "~", "~/" is used instead (to avoid confusionwith 'backupext' set to "~").When writing the buffer, the default is to use the current file name.  Thuswhen you give the "ZZ" or ":wq" command, the original file will beoverwritten.  If you do not want this, the buffer can be written into anotherfile by giving a file name argument to the ":write" command.  For example:>	vim testfile>	[change the buffer with editor commands]>	:w newfile>	:qThis will create a file "newfile", that is a modified copy of "testfile".The file "testfile" will remain unchanged.  Anyway, if the 'backup' option isset, Vim renames or copies the original file before it will be overwritten.You can use this file if you discover that you need the original file.  Seealso the 'patchmode' option.  The name of the backup file is normally the sameas the original file with 'backupext' appended.  The default "~" is a bitstrange to avoid accidentally overwriting existing files.  If you prefer ".bak"change the 'backupext' option.  Extra dots are replaced with '_' on MS-DOSmachines, when Vim has detected that an MS-DOS-like filesystem is being used(e.g., messydos or crossdos) or when the 'shortname' option is on.  Thebackup file can be placed in another directory by setting 'backupdir'.							*auto-shortname*Technical: On the Amiga you can use 30 characters for a file name.  But on an	   MS-DOS-compatible filesystem only 8 plus 3 characters are	   available.  Vim tries to detect the type of filesystem when it is	   creating the .swp file.  If an MS-DOS-like filesystem is suspected,	   a flag is set that has the same effect as setting the 'shortname'	   option.  This flag will be reset as soon as you start editing a	   new file.  The flag will be used when making the file name for the	   ".swp" and ".~" files for the current file.  But when you are	   editing a file in a normal filesystem and write to an MS-DOS-like	   filesystem the flag will not have been set.  In that case the	   creation of the ".~" file may fail and you will get an error	   message.  Use the 'shortname' option in this case.When you started editing without giving a file name, "No File" is displayed inmessages.  If the ":write" command is used with a file name argument, the filename for the current file is set to that file name.  This only happens whenthe 'F' flag is included in 'cpoptions' (by default it is included).  This isuseful when entering text in an empty buffer and then writing it to a file.If 'cpoptions' contains the 'f' flag (by default it is NOT included) the filename is set for the ":read file" command.  This is useful when starting Vimwithout an argument and then doing ":read file" to start editing a file.							*not-edited*Because the file name was set without really starting to edit that file, youare protected from overwriting that file.  This is done by setting the"notedited" flag.  You can see if this flag is set with the CTRL-G or ":file"command.  It will include "[Not edited]" when the "notedited" flag is set.When writing the buffer to the current file name (with ":w!"), the "notedited"flag is reset.							*abandon*Vim remembers whether you have changed the buffer.  You are protected fromlosing the changes you made.  If you try to quit without writing, or want tostart editing another file, Vim will refuse this.  In order to overrule thisprotection, add a '!' to the command.  The changes will then be lost.  Forexample: ":q" will not work if the buffer was changed, but ":q!" will.  To seewhether the buffer was changed use the "CTRL-G" command.  The message includesthe string "[Modified]" if the buffer has been changed.If you want to automatically save the changes without asking, switch on the'autowrite' option.  Note that ":e file" will fail if there are changes in thecurrent buffer, also when the 'autowrite' option is on.  This is illogical,because with other commands (e.g., ":next") the current buffer would bewritten and abandoned, but this behavior is compatible with Vi.  If youencounter this problem, you can use CTRL-^ to jump to the file, because thealternate file name is set to the argument of the ":e" command.If you want to keep the changed buffer without saving it, switch on the'hidden' option.  See |hidden-buffer|.							*:confirm* *:conf*:conf[irm] {command}	Execute {command}, and use a dialog when an			operation has to be confirmed.  Can be used on the			":q", ":qa" and ":w" commands (the latter to over-ride			a read-only setting).Examples:>  :confirm w foo	Will ask for confirmation when "foo" already exists.>  :confirm q	Will ask for confirmation when there are changes.>  :confirm qa	If any modified, unsaved buffers exist, you will be prompted to save	or abandon each one.  There are also choices to "save all" or "abandon	all".If you want to always use ":confirm", set the 'confirm' option.							*:browse* *:bro*:bro[wse] {command}	Open a file selection dialog for an argument to			{command}.  At present this works for ":e", ":w",			":r", ":sp", ":mkexrc", ":mkvimrc" and ":mksession".			{only in Win32, Motif and Athena GUI}			When ":browse" is not supported it's ignored,			{command} is executed without a dialog.The syntax is best shown via some examples:>	:browse e $vim/foo		Open the browser in the $vim/foo directory, and edit the		file chosen.>	:browse e		Open the browser in the directory of the current buffer,		and edit the file chosen.>	:browse w		Open the browser in the directory of the current buffer,		with the current buffer filename as default, and save the		buffer under the filename chosen.>	:browse w C:/bar		Open the browser in the C:/bar directory, with the current		buffer filename as default, and save the buffer under the		filename chosen.Also see the |'browsedir'| option.For versions of Vim where browsing is not supported, the command is executedunmodified.==============================================================================2. Editing a file					*edit-a-file*							*:e* *:edit*:e[dit] [+cmd]		Edit the current file.  This is useful to re-edit the			current file, when it has been changed outside of Vim.			This fails when changes have been made to the current			buffer.  Also see |+cmd|.							*:edit!*:e[dit]! [+cmd]		Edit the current file always.  Discard any changes to			the current buffer.  This is useful if you want to			start all over again.  Also see |+cmd|.							*:edit_f*:e[dit] [+cmd] {file}	Edit {file}.  This fails when changes have been made			to the current buffer, unless 'hidden' is set.  Also			see |+cmd|.							*:edit!_f*:e[dit]! [+cmd] {file}	Edit {file} always.  Discard any changes to the			current buffer.  Also see |+cmd|.:e[dit] [+cmd] #[count]	Edit the [count]th alternate file name (as shown by			:files).  This command does the same as			[count] CTRL-^.  But ":e #" doesn't work if the			alternate buffer doesn't have a file name, while			CTRL-^ still works then.  Also see |+cmd|.							*:fin* *:find*:fin[d][!] [+cmd] {file}			Find {file} in 'path' and then ":edit" it.			{not in Vi} {not available when the |+file_in_path|			feature was disabled at compile time}							*:ex*:ex [+cmd] [file]	Same as :edit, but also switch to "Ex" mode.  See			|Ex-mode|.							*:vi* *:visual*:vi[sual][!] [+cmd] [file]			When entered in Ex mode: Leave Ex mode, go back to			Normal mode.  Otherwise same as :edit.							*:vie* *:view*:vie[w] [+cmd] file	When entered in Ex mode: Leave Ex mode, go back to			Normal mode.  Otherwise same as :edit, but set			'readonly' option for this buffer.  {not in Vi}							*CTRL-^*[count]CTRL-^		Edit [count]th alternate file (equivalent to ":e			#[count]").  Without count this gets you to the			previously edited file.  This is a quick way to			toggle between two (or more) files.  If the			'autowrite' option is on and the buffer was			changed, write it.[count]]f						*]f* *[f*[count][f		Same as "gf".  Deprecated.							*gf*[count]gf		Edit the file whose name is under or after the cursor.			Mnemonic: "goto file".			Uses the 'isfname' option to find out which characters			are supposed to be in a file name.			Uses the 'path' variable as a list of directory names			to look for the file.  Also looks for the file			relative to the current file.			If a [count] is given, the count'th file that is found			in the 'path' is edited.			This command fails if Vim refuses to |abandon| the			current file.			If you do want to edit a new file, use:>				:e <cfile>			To make gf always work like that:>				:map gf :e <cfile><CR>			If the name is a hypertext link, that looks like			"type://machine/path", only "/path" is used.			For Unix the '~' character is expanded, like in			"~user/file".  Environment variables are expanded too			|expand-env|.			{not in Vi}			{not available when the |+file_in_path| feature was			disabled at compile time}

⌨️ 快捷键说明

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