\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Sbeckner (Atlas89)} \pdfinfo{ /Title (vi-chear-sheet.pdf) /Creator (Cheatography) /Author (Sbeckner (Atlas89)) /Subject (Vi Chear Sheet Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{3F8C0B} \definecolor{LightBackground}{HTML}{F3F7EF} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Vi Chear Sheet Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Sbeckner (Atlas89)} via \textcolor{DarkBackground}{\uline{cheatography.com/59173/cs/15544/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Sbeckner (Atlas89) \\ \uline{cheatography.com/atlas89} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 21st April, 2018.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{4} \begin{tabularx}{3.833cm}{x{0.85825 cm} x{2.57475 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Modes Of Operation}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{3.833cm}}{\{\{ac\}\}{\bf{Input Mode:}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} i & Insert before cursor \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} I & Insert at the begining of line \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} a & Insert after cursor \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} A & Insert End of line \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} o & Insert line below \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} O & Open line \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} C & Cut text to the end of line \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} {[}ESC{]} & Switch back to comman mode \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{2}{x{3.833cm}}{\{\{ac\}\}{\bf{Command Mode:}}} \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} : & Enters last line mode \tn % Row Count 11 (+ 1) % Row 11 \SetRowColor{white} :w & Save \tn % Row Count 12 (+ 1) % Row 12 \SetRowColor{LightBackground} :wq,:x, ZZ & Save \& Exit \tn % Row Count 13 (+ 1) % Row 13 \SetRowColor{white} :q & Quit \tn % Row Count 14 (+ 1) % Row 14 \SetRowColor{LightBackground} :q!, ZQ & Quit without saving \tn % Row Count 15 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{0.89258 cm} x{2.54042 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Search and Replace Commands}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{3.833cm}}{\{\{ac\}\}{\bf{Searching:}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} /string & Search forward for string \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} ?string & Search backwards for string \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} n, (,) & Go to next match \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} N, (;) & Go to previous match \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} * & Search for next instance of current word \tn % Row Count 7 (+ 2) % Row 6 \SetRowColor{LightBackground} \# & Search for last instance of current word \tn % Row Count 9 (+ 2) % Row 7 \SetRowColor{white} :set ic & ignore case while searching \tn % Row Count 10 (+ 1) % Row 8 \SetRowColor{LightBackground} :set noic & Case-senitive searchng \tn % Row Count 11 (+ 1) % Row 9 \SetRowColor{white} :set nu & Turn on line numbers \tn % Row Count 12 (+ 1) % Row 10 \SetRowColor{LightBackground} :x, yg/str & Search for str from line x to y \tn % Row Count 14 (+ 2) % Row 11 \SetRowColor{white} \seqsplit{:g/str/cmd} & Run cmd on lines containing str \tn % Row Count 16 (+ 2) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{2}{x{3.833cm}}{\{\{ac\}\}{\bf{Replacing:}}} \tn % Row Count 17 (+ 1) % Row 13 \SetRowColor{white} \seqsplit{:s/pt/str/flag} & Replace all occurrences of pattern \tn % Row Count 19 (+ 2) % Row 14 \SetRowColor{LightBackground} g & Replace all occurrences of pattern (Flag) \tn % Row Count 21 (+ 2) % Row 15 \SetRowColor{white} c & Confirm replaces (Flag) \tn % Row Count 22 (+ 1) % Row 16 \SetRowColor{LightBackground} \& & Rrepeat last :s command \tn % Row Count 23 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{p{0.44629 cm} x{2.98671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Modify Text Commands}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{3.833cm}}{\{\{ac\}\}{\bf{Deleting Text:}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} D & Delete to the end of the line \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} dd, :d & Delete current line \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} x & Delete character to the right of cursor \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} X & Delete character to the left of cursor \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} .5dd & Delete 5 lines downwards from current \tn % Row Count 10 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{2}{x{3.833cm}}{\{\{ac\}\}{\bf{Edit Commands:}}} \tn % Row Count 11 (+ 1) % Row 7 \SetRowColor{white} . & Repeat last command \tn % Row Count 12 (+ 1) % Row 8 \SetRowColor{LightBackground} U & Undo all commands for current line \tn % Row Count 13 (+ 1) % Row 9 \SetRowColor{white} u & undo last command \tn % Row Count 14 (+ 1) % Row 10 \SetRowColor{LightBackground} p & Paste (below) \tn % Row Count 15 (+ 1) % Row 11 \SetRowColor{white} P & Paste (above) \tn % Row Count 16 (+ 1) % Row 12 \SetRowColor{LightBackground} r & Overwrite one character \tn % Row Count 17 (+ 1) % Row 13 \SetRowColor{white} R & Overwrite many charaters \tn % Row Count 18 (+ 1) % Row 14 \SetRowColor{LightBackground} \textasciicircum{}r & Redo \tn % Row Count 19 (+ 1) % Row 15 \SetRowColor{white} \mymulticolumn{2}{x{3.833cm}}{\{\{ac\}\}{\bf{Yanking:}}} \tn % Row Count 20 (+ 1) % Row 16 \SetRowColor{LightBackground} yy, :y & Copy current \tn % Row Count 22 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{p{0.78959 cm} x{2.64341 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Splitting Screen Commands}} \tn % Row 0 \SetRowColor{LightBackground} :split, \textasciicircum{}ws & Split screen horizontal \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} :vsplit, \textasciicircum{}wv & Split screen vertical \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \textasciicircum{}ww & Switch to next \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} :on & Close all windows except current window \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} \textasciicircum{}w hjkl & Move curso to window left, below, above or to the right of the current window \tn % Row Count 10 (+ 3) % Row 5 \SetRowColor{white} \textasciicircum{}w HJKL & Move current to window left, below, above or to the right of screen \tn % Row Count 13 (+ 3) % Row 6 \SetRowColor{LightBackground} \textasciicircum{}w r & Rotate windows clockwise \tn % Row Count 14 (+ 1) % Row 7 \SetRowColor{white} \textasciicircum{}w +-\textless{}\textgreater{} & Increase/ decrease current windows height/width \tn % Row Count 16 (+ 2) % Row 8 \SetRowColor{LightBackground} \textasciicircum{}w T & Move current windows to new tab \tn % Row Count 18 (+ 2) % Row 9 \SetRowColor{white} :bufdo & Execute a monnad in each open file \tn % Row Count 20 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.44186 cm} x{1.99114 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Movements}} \tn % Row 0 \SetRowColor{LightBackground} h, \textless{}Backspace\textgreater{}, {[}left-arrow{]} & Previous character \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} b & Previous word \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} B & Previous WORD \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \textasciicircum{} & First non-blank character \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} 0 & beginning of line \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} l, \textless{}Space\textgreater{}, {[}right-arrow{]} & next character \tn % Row Count 9 (+ 2) % Row 6 \SetRowColor{LightBackground} e & End of word \tn % Row Count 10 (+ 1) % Row 7 \SetRowColor{white} w & beginning of nxt word \tn % Row Count 11 (+ 1) % Row 8 \SetRowColor{LightBackground} E & End of WORD \tn % Row Count 12 (+ 1) % Row 9 \SetRowColor{white} W & Beginning of next WORD \tn % Row Count 13 (+ 1) % Row 10 \SetRowColor{LightBackground} \$ & End of line \tn % Row Count 14 (+ 1) % Row 11 \SetRowColor{white} gg & First line \tn % Row Count 15 (+ 1) % Row 12 \SetRowColor{LightBackground} \textasciicircum{}b & Up 1 page \tn % Row Count 16 (+ 1) % Row 13 \SetRowColor{white} \textasciicircum{}u & Up 1/2 page \tn % Row Count 17 (+ 1) % Row 14 \SetRowColor{LightBackground} k, {[}up-arrow{]} & Up 1 line \tn % Row Count 18 (+ 1) % Row 15 \SetRowColor{white} j, \textless{}Return\textgreater{}, {[}down-arrow{]} & Down 1 line \tn % Row Count 20 (+ 2) % Row 16 \SetRowColor{LightBackground} \textasciicircum{}d & Down 1/2 page \tn % Row Count 21 (+ 1) % Row 17 \SetRowColor{white} \textasciicircum{}f & Down 1 page \tn % Row Count 22 (+ 1) % Row 18 \SetRowColor{LightBackground} G & Last line \tn % Row Count 23 (+ 1) % Row 19 \SetRowColor{white} \textasciicircum{}i & Jump forward \tn % Row Count 24 (+ 1) % Row 20 \SetRowColor{LightBackground} \textasciicircum{}o & Jump back \tn % Row Count 25 (+ 1) % Row 21 \SetRowColor{white} zz & Center screen on cursor \tn % Row Count 26 (+ 1) % Row 22 \SetRowColor{LightBackground} zt & Align top of screen with cursor \tn % Row Count 28 (+ 2) % Row 23 \SetRowColor{white} zb & Align bottom of screen with cursor \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{3.833cm}{x{1.44186 cm} x{1.99114 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Movements (cont)}} \tn % Row 24 \SetRowColor{LightBackground} == & Auto-indent current line \tn % Row Count 2 (+ 2) % Row 25 \SetRowColor{white} \textless{}\textless{} & Shift current line left by shiftwidth \tn % Row Count 4 (+ 2) % Row 26 \SetRowColor{LightBackground} \textgreater{}\textgreater{} & Shift current line right by shiftwidth \tn % Row Count 6 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{p{0.51495 cm} x{2.91805 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Multiple Files Commands}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{3.833cm}}{\{\{ac\}\}{\bf{In Command Mode:}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} :n, :bn & Go to next file \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} :p, :bp & Go to previous file \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} :n! & Discard changes to file and edit next file \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} :e\# & Closes current file and opens last edited file \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} :rew & rewinds sequence of files back to the first file you are editing \tn % Row Count 11 (+ 2) % Row 6 \SetRowColor{LightBackground} :c\# & Copies blocks of text from a file to another \tn % Row Count 13 (+ 2) % Row 7 \SetRowColor{white} :ls & List all open files \tn % Row Count 14 (+ 1) % Row 8 \SetRowColor{LightBackground} :e & Open a file for editing \tn % Row Count 15 (+ 1) % Row 9 \SetRowColor{white} :ene & Open a blank new file for editing \tn % Row Count 16 (+ 1) % Row 10 \SetRowColor{LightBackground} :bd & Remove file from the buffer list \tn % Row Count 17 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{p{0.3433 cm} x{3.0897 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Visual Mode}} \tn % Row 0 \SetRowColor{LightBackground} v & Enter visual mode \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} V & Enter visual line mode \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \textasciicircum{}v & Enter visual block mode \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} o & Switch cursor to start/end \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} gv & Re-select previous area \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} I & prepend to each visual block line \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} '\textless{} & Jump to of prior area \tn % Row Count 7 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}