📄 vipercard.tex
字号:
\key{{\bf kill} a buffer}{:q! {\rm or} C-x k}\key{list existing {\bf buffers}}{:args {\rm or} C-x b}\section{Files}\metax{{\bf visit} file in the current window}{v {\sl file} {\rm or} :e {\sl file}}\key{{\bf visit} file in another window}{V {\sl file}}\key{{\bf visit} file in another frame}{C-v {\sl file}}\key{{\bf save} buffer to the associated file}{:w {\rm or} C-xC-s}\metax{{\bf write} buffer to a specified file}{:w {\sl file} {\rm or} C-xC-w}\metax{{\bf insert} a specified file at point}{:r {\sl file} {\rm or} C-xi}\key{{\bf get} information on the current {\bf file}}{C-c g {\rm or} :f}\key{run the {\bf directory} editor}{:e RET {\rm or} C-xd}%\shortcopyrightnotice\section{Viewing the Buffer}\key{scroll to next screen}{C-f}\key{scroll to previous screen}{C-b}\key{scroll {\bf down} half screen}{C-d}\key{scroll {\bf up} half screen}{C-u}\key{scroll down one line}{C-e}\key{scroll up one line}{C-y}\key{put current line on the {\bf home} line}{z H {\rm or} z RET}\key{put current line on the {\bf middle} line}{z M {\rm or} z .}\key{put current line on the {\bf last} line}{z L {\rm or} z -}\section{Marking and Returning}\key{{\bf mark} point in register {\it x}}{m {\it x}}\key{set mark at buffer beginning}{m <}\key{set mark at buffer end}{m >}\key{set mark at point}{m .}\key{jump to mark}{m ,}\key{exchange point and mark}{` `}\key{... and skip to first non-white on line}{' '}\key{go to mark {\it x}}{` {\it x}}\key{... and skip to first non-white on line}{' {\it x}}\key{view contents of marker {\it x}}{[ {\it x}}\key{view contents of register {\it x}}{] {\it x}}\section{Macros}Emacs style macros:\key{start remembering keyboard macro}{C-x (}\key{finish remembering keyboard macro}{C-x )}\key{call last keyboard macro}{*}\key{start remembering keyboard macro}{@ \#}\key{finish macro and put into register {\it x}}{@ {\it x}}\key{execute macro stored in register {\it x}}{@ {\it x}}\key{repeat last @{\it x} command}{@ @}\key{Pull last macro into register {\it x}}{@ ! {\it x}}Vi-style macros (keys to be hit in quick succession):\key{define Vi-style macro for Vi state}{:map}\key{define Vi-style macro for Insert state}{:map!}\key{toggle case-sensitive search}{//}\key{toggle regular expression search}{///}\key{toggle `\%' to ignore parentheses inside comments}{\%\%\%}\section{Motion Commands}\key{go backward one character}{h {\rm or} C-h}\key{go forward one character}{l}\metax{next line keeping the column}{j {\rm or} LF {\rm or} C-n}\key{previous line keeping the column}{k}\metax{next line at first non-white}{+ {\rm or} RET {\rm or} C-p}\key{previous line at first non-white}{-}\key{beginning of line}{0}\key{first non-white on line}{^}\key{end of line}{\$}\key{go to {\it n}-th column on line}{{\it n} |}\key{go to {\it n}-th line}{{\it n} G}\key{go to last line}{G}\key{find matching parenthesis for \kbd{()}, \kbd{\{\}} and \kbd{[]}}{\%}\key{go to {\bf home} window line}{H}\key{go to {\bf middle} window line}{M}\key{go to {\bf last} window line}{L}\subsection{Words, Sentences, Paragraphs, Headings}\key{forward {\bf word}}{w {\rm or} W}\key{{\bf backward} word}{b {\rm or} B}\key{{\bf end} of word}{e {\rm or} E}In the case of capital letter commands, a word is delimited by anon-white character.\key{forward sentence}{)}\key{backward sentence}{(}\key{forward paragraph}{\}}\key{backward paragraph}{\{}\key{forward heading}{]]}\key{backward heading}{[[}\key{end of heading}{[]}\subsection{Find Characters on the Line}\key{{\bf find} {\it c} forward on line}{f {\it c}}\key{{\bf find} {\it c} backward on line}{F {\it c}}\key{up {\bf to} {\it c} forward on line}{t {\it c}}\key{up {\bf to} {\it c} backward on line}{T {\it c}}\key{repeat previous \kbd{f}, \kbd{F}, \kbd{t} or \kbd{T}}{;}\key{... in the opposite direction}{,}%\newcolumn%\title{Viper Quick Reference Card}\section{Searching and Replacing}\key{search forward for {\sl pat}}{/ {\sl pat}}\key{search backward with previous {\sl pat}}{?\ RET}\key{search forward with previous {\sl pat}}{/ RET}\key{search backward for {\sl pat}}{?\ {\sl pat}}\key{repeat previous search}{n}\key{... in the opposite direction}{N}\key{{\bf query} replace}{Q}\key{{\bf replace} a character by another character {\it c}}{r {\it c}}\key{{\bf overwrite} {\it n} lines}{{\it n} R}\metax{{\bf buffer} search (if enabled)}{g {\it move command}}\section{Modifying Commands}Most commands that operate on text regions accept the motion commands,to describe regions. They also accept the Emacs region specifications{\bf r} and {\bf R}. {\bf r} describes the region between {\it point}and {\it mark}, and {\bf R} describes whole lines in that region.Motion commands are classified into {\it point commands} and{\it line commands}. In the case of line commands, whole lines willbe affected by the command.The point commands are as follows:\hskip 5ex\kbd{h l 0 ^ \$ w W b B e E ( ) / ?\ ` f F t T \% ; ,}The line commands are as follows:\hskip 5ex\kbd{j k + - H M L \{ \} G '}These region specifiers will be referred to as {\it m} below.\subsection{Delete/Yank/Change Commands}\paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\tabskip=0pt&#\cr\fourcol{}{{\bf delete}}{{\bf yank}}{{\bf change}}\fourcol{region determined by {\it m}}{d {\it m}}{y {\it m}}{c {\it m}}\fourcol{... into register {\it x}}{" {\it x\/} d {\it m}}{" {\it x\/} y {\it m}}{" {\it x\/} c {\it m}}\fourcol{a line}{d d}{Y {\rm or} y y}{c c}\fourcol{current {\bf region}}{d r}{y r}{c r}\fourcol{expanded {\bf region}}{d R}{y R}{c R}\fourcol{to end of line}{D}{y \$}{c \$}\fourcol{a character after point}{x}{y l}{c l}\fourcol{a character before point}{DEL}{y h}{c h}}\vskip 2ex\key{Overwrite {\it n} lines}{{\it n} R}\subsection{Put Back Commands}Deleted/yanked/changed text can be put back by the following commands.\key{{\bf Put} back at point/above line}{P}\key{... from register {\it x}}{" {\it x\/} P}\key{{\bf put} back after point/below line}{p}\key{... from register {\it x}}{" {\it x\/} p}\subsection{Repeating and Undoing Modifications}\key{{\bf undo} last change}{u {\rm or} :und}\key{repeat last change}{.\ {\rm (dot)}}Undo is undoable by \kbd{u} and repeatable by \kbd{.}.For example, \kbd{u...} will undo 4 previous changes.A \kbd{.} after \kbd{5dd} is equivalent to \kbd{5dd},while \kbd{3.} after \kbd{5dd} is equivalent to \kbd{3dd}.\section{Miscellaneous Commands}\endindentedkeys\paralign to \hsize{#\tabskip=5pt plus 1 fil&#\tabskip=0pt&#\tabskip=0pt&#\tabskip=0pt&#\cr\fivecol{}{{\bf shift left}}{{\bf shift right}}{{\bf filter shell command}}{{\bf indent}}\fivecol{region}{< {\it m}}{> {\it m}}{!\ {\it m\/} {\sl shell-com}}{= {\it m}}\fivecol{line}{< <}{> >}{!\ !\ {\sl shell-com}}{= =}}\key{{\bf join} lines}{J}\key{toggle case (takes count)}{\~{}}\key{view register {\it x}}{] {\it x}}\key{view marker {\it x}}{] {\it x}}\key{lowercase region}{\# c {\it m}}\key{uppercase region}{\# C {\it m}}\key{execute last keyboard macro on each line in the region}{\# g {\it m}}\key{insert specified string for each line in the region}{\# q {\it m}}\key{check spelling of the words in the region}{\# s {\it m}}\key{repeat previous ex substitution}{\&}\key{change to previous file}{C-^}\key{Viper Meta key}{_}\section{Customization}By default, search is case sensitive.You can change this by including the following line in your \kbd{\~{}/.vip} file.\hskip 5ex\kbd{(setq viper-case-fold-search t)}The following is a subset of the variety ofoptions available for customizing Viper.See the Viper manual for details on these and other options.\beginindentedkeys\paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr\twocol{{\bf variable}}{{\bf default value}}\twocol{viper-search-wrap-around}{t}\twocol{viper-case-fold-search}{nil}\twocol{viper-re-search}{t}\twocol{viper-re-replace}{t}\twocol{viper-re-query-replace}{t}\twocol{viper-auto-indent}{nil}\twocol{viper-shift-width}{8}\twocol{viper-tags-file-name}{"TAGS"}\twocol{viper-no-multiple-ESC}{t}\twocol{viper-ex-style-motion}{t}\twocol{viper-always}{t}\twocol{viper-custom-file-name}{"\~{}/.vip"}\twocol{ex-find-file-shell}{"csh"}\twocol{ex-cycle-other-window}{t}\twocol{ex-cycle-through-non-buffers}{t}\twocol{blink-matching-paren}{t}\twocol{buffer-read-only}{{\it buffer dependent}}}To bind keys in Vi command state, put lines like these in your\kbd{\~{}/.vip} file:\beginexample(define-key viper-vi-global-user-map "\\C-v" 'scroll-down)(define-key viper-vi-global-user-map "\\C-cm" 'smail)\endexample\newcolumn\title{Ex Commands in Viper}In vi state, an Ex command is entered by typing:\hskip 5ex\kbd{:\ {\sl ex-command} RET}\section{Ex Addresses}\paralign to \hsize{#\tabskip=5pt plus 1 fil&#\tabskip=2pt&#\tabskip=5pt plus 1 fil&#\cr\twocolkey{current line}{.}{next line with {\sl pat}}{/ {\sl pat} /}\twocolkey{line {\it n}}{{\it n}}{previous line with {\sl pat}}{?\ {\sl pat} ?}\twocolkey{last line}{\$}{{\it n\/} line before {\it a}}{{\it a} - {\it n}}\twocolkey{next line}{+}{{\it a\/} through {\it b}}{{\it a\/} , {\it b}}\twocolkey{previous line}{-}{line marked with {\it x}}{' {\it x}}\twocolkey{entire buffer}{\%}{previous context}{' '}}Addresses can be specified in front of a command.For example,\hskip 5ex\kbd{:.,.+10m\$}moves 11 lines below current line to the end of buffer.\section{Ex Commands}Avoid Ex text manipulation commands except substitute. There are better VI equivalentsfor all of them. Also note that all Ex commands expand \% tocurrent file name. To include a \% in the command, escape it with a $\backslash$.Similarly, \# is replaced by previous file. For Viper, this is thefirst file in the {\sl :args} listing for that buffer. This defaultsto the previous file in the VI sense if you have one window.Ex commands can be made to have history. See the manual for details.\subsection{Ex Text Commands}\endindentedkeys\key{mark lines matching {\sl pat} and execute {\sl cmds} on these lines}{:g /{\sl pat}/ {\sl cmds}}\key{mark lines {\it not\/} matching {\sl pat} and execute {\sl cmds} on these lines}{:v /{\sl pat}/ {\sl cmds}}\key{{\bf move} specified lines after {\sl addr}}{:m {\sl addr}}\key{{\bf copy} specified lines after {\sl addr}}{:co\rm\ (or \kbd{:t})\ \sl addr}\key{{\bf delete} specified lines [into register {\it x\/}]}{:d {\rm [{\it x\/}]}}\key{{\bf yank} specified lines [into register {\it x\/}]}{:y {\rm [{\it x\/}]}}\key{{\bf put} back text [from register {\it x\/}]}{:pu {\rm [{\it x\/}]}}\key{{\bf substitute} {\sl repl} for first string on line matching {\sl pat}}{:s /{\sl pat}/{\sl repl}/}\key{repeat last substitution}{:\&}\key{repeat previous substitute with previous search pattern as {\sl pat}}{:\~{}}\subsection{Ex File and Shell Commands}\key{{\bf edit} file}{:e {\sl file}}\key{reedit messed up current file}{:e!}\key{edit previous file}{:e\#}\key{{\bf read} in a file}{:r {\sl file}}\key{{\bf read} in the output of a shell command}{:r {\sl !command}}\key{write out specified lines into {\sl file}}{:w {\sl file}}\key{save all modified buffers, ask confirmation}{:W {\sl file}}\key{save all modified buffers, no confirmation}{:WW {\sl file}}\key{write out specified lines at the end of {\sl file}}{:w>> {\sl file}}\key{{\bf write} to the input of a shell command}{:w {\sl !command}}\key{write out and then quit}{:wq {\sl file}}\key{run a sub{\bf shell} in a window}{:sh}\key{execute shell command {\sl command}}{:!\ {\sl command}}\key{execute previous shell command with {\it args} appended}{:!! {\sl args}}\subsection{Ex Miscellaneous Commands}\key{define a macro {\it x} that expands to {\sl cmd}}{:map {\it x} {\sl cmd}}\key{remove macro expansion associated with {\it x}}{:unma {\it x}}\key{define a macro {\it x} that expands to {\sl cmd} in insert state}{:map!\ {\it x} {\sl cmd}}\key{remove macro expansion associated with {\it x} in insert state}{:unma!\ {\it x}}\key{print line number}{:.=}\key{print last line number}{:=}\key{print {\bf version} number of Viper}{:ve}\key{shift specified lines to the right}{:>}\key{shift specified lines to the left}{:<}\key{{\bf join} lines}{:j}\key{mark specified line to register {\it x}}{:k {\it x}}\key{{\bf set} a variable's value}{:se}\key{find first definition of {\bf tag} {\sl tag}}{:ta {\sl tag}}\key{Current directory}{:pwd}\copyrightnotice\bye% Local variables:% compile-command: "tex viperCard"% End:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -