\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{im\_Tavo (gamejia90)} \pdfinfo{ /Title (vimtutor.pdf) /Creator (Cheatography) /Author (im\_Tavo (gamejia90)) /Subject (Vimtutor 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}{003816} \definecolor{LightBackground}{HTML}{F7F8F7} \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{Vimtutor Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{im\_Tavo (gamejia90)} via \textcolor{DarkBackground}{\uline{cheatography.com/39342/cs/22386/}}} \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}im\_Tavo (gamejia90) \\ \uline{cheatography.com/gamejia90} \\ \uline{\seqsplit{www}.github.com/Athesto} \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 3rd July, 2020.\\ Updated 6th May, 2020.\\ 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*}{3} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Lesson 1}} \tn % Row 0 \SetRowColor{LightBackground} \{\{nobreak\}\}`h\{\{fa-arrow-left\}\} \{\{ar\}\}j\{\{fa-arrow-down\}\} k\{\{fa-arrow-up\}\} l\{\{fa-arrow-right\}\} ` & cursor move either the arrow or `hjkl` keys \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`vim FILENAME \textless{}ENTER\textgreater{}` & To start Vim from shell \tn % Row Count 7 (+ 2) % Row 2 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`\textless{}ESC\textgreater{} :q! \textless{}ENTER\textgreater{}\{\{nl\}\}\textless{}ESC\textgreater{} :wq \textless{}ENTER\textgreater{}` & to trash all changes.\{\{nl\}\}to save the changes. \tn % Row Count 10 (+ 3) % Row 3 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`x` & To delete the character at the cursor \tn % Row Count 12 (+ 2) % Row 4 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`i` & INSERT MODE before the cursor \tn % Row Count 14 (+ 2) % Row 5 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`A` & INSERT MODE after the line \tn % Row Count 16 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Lesson 2}} \tn % Row 0 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`dw` & del {\bf{from}} the cursor to the {\bf{next word}} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`d\$` & del {\bf{from}} the cursor to the {\bf{end of line}} \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`dd` & del {\bf{whole line}} \tn % Row Count 8 (+ 2) % Row 3 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`2w` & repeat the motion with a number \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`operator {[}number{]} motion \{\{nl\}\}operator \{\{nl\}\}{[}number{]} \{\{nl\}\}motion` & where:\{\{nl\}\}- is what to do `d` \{\{nl\}\} - {[}optional{]} repeat motion `2` \{\{nl\}\}- move to the text to operate `2w` \tn % Row Count 16 (+ 6) % Row 5 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`0` & move to the {\bf{start of the line}} \tn % Row Count 18 (+ 2) % Row 6 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`u\{\{nl\}\}U\{\{nl\}\}Ctrl -R` & To undo {\bf{previus action}} \{\{nl\}\}To undo {\bf{all the actions on a line}} \{\{nl\}\}To undo the undo's \tn % Row Count 23 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.33919 cm} x{2.63781 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Lesson 3}} \tn % Row 0 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`p` & put the deleted text {\bf{AFTER}} the cursor \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`r {[}char{]}` & replace the character under the cursor \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`c` & change from the cursor where the motion take you. Eg. `c\$ ce cw` \tn % Row Count 8 (+ 4) % Row 3 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`c {[}number{]} motion` & it is the format for changing \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Lesson 4}} \tn % Row 0 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`CTRL-G\{\{nl\}\}G\{\{nl\}\}number G\{\{nl\}\}gg` & show your location and the file status \{\{nl\}\}move to the end of the file \{\{nl\}\}move to that line number \{\{nl\}\}go to the first line \tn % Row Count 7 (+ 7) % Row 1 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\} `/foo \textless{}ENTER\textgreater{}\{\{nl\}\}?foo \textless{}ENTER\textgreater{}\{\{nl\}\}n\{\{nl\}\}N\{\{nl\}\}CTRL-O\{\{nl\}\}CTRL-I` & search `foo` {\bf{FORWARD}} of the `phrase` \{\{nl\}\}search `foo` {\bf{BACKWARD}} of the `phrase` \{\{nl\}\} find the {\bf{next}} occurrence \{\{nl\}\}find the {\bf{previous}} occurrence\{\{nl\}\}Takes you to the {\bf{PREVIOUS}} position \{\{nl\}\} Takes you to the {\bf{NEWER}} position \tn % Row Count 20 (+ 13) % Row 2 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\} `\%` & type it on `(` , `)` , `{[}` , `{]}` , `\{` or `\}` and goes to its match \tn % Row Count 24 (+ 4) % Row 3 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\} `:s/old/new\{\{nl\}\}:s/old/new/{\bf{g}}\{\{nl\}\}:{\bf{\#,\#}}s/old/new/g\{\{nl\}\}:{\bf{\%}}s/old/new/g\{\{nl\}\}:\%s/old/new/g{\bf{c}}` & substitude {\bf{first}} `old` for `new` \{\{nl\}\}substitude all `old` for `ǹew` {\bf{in the line}}\{\{nl\}\}substitude all matchs between the lines `\#` \{\{nl\}\} substitude all matchs {\bf{in the file}} \{\{nl\}\}to {\bf{check}} each time add `c` \tn % Row Count 36 (+ 12) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.43873 cm} x{2.53827 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Lesson 5}} \tn % Row 0 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`:!command` & execute an external `command` \{\{nl\}\} Eg. win: `!dir` or in Unix: `!ls` \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`:w FILENAME` & write the current VIM file to the disk with the name `FILENAME` \tn % Row Count 8 (+ 4) % Row 2 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`v motion :w FILENAME` & saves visually selected lines in the file `FILENAME`. \tn % Row Count 11 (+ 3) % Row 3 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`:r FILENAME` & retrives disk file FILENAME and puts belong cursor position \tn % Row Count 14 (+ 3) % Row 4 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`:r !command` & reads the output `command` and puts belong the cursor Eg. win: `!dir` or in Unix: `!ls` \tn % Row Count 19 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Lesson 6}} \tn % Row 0 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`o`\{\{nl\}\}\{\{nl\}\}\{\{ar\}\}\{\{nobreak\}\}`O`\{\{nl\}\} & insert a line {\bf{BELOW}} the cursor and start `INSERT MODE`. \{\{nl\}\}Open a line {\bf{ABOVE}} the cursor \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`a`\{\{nl\}\}\{\{ar\}\}\{\{nobreak\}\}`A`\{\{nl\}\} & insert text after {\bf{the cursor}} \{\{nl\}\}insert text after {\bf{the end of the line}} \tn % Row Count 9 (+ 4) % Row 2 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`e` & move to the {\bf{end of a word}} \tn % Row Count 11 (+ 2) % Row 3 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`y` & copy the text and `p` paste it \tn % Row Count 13 (+ 2) % Row 4 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`R` & Enter in `REPLACE MODE` until `\textless{}ESC\textgreater{}` is pressed \tn % Row Count 16 (+ 3) % Row 5 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`:set foo\{\{nl\}\}\{\{nl\}\}ic` or `ignorecase \{\{nl\}\}is` or `insearch \{\{nl\}\} hls` or `hlsearch` & sets the option `foo` \{\{nl\}\}Eg. `:set ic` \{\{nl\}\} {\bf{i}}gnore upper/lower {\bf{c}}ase when seaching \{\{nl\}\}show partial matches for a search phrase \{\{nl\}\}{\bf{h}}igh{\bf{l}}ight all matching phrases. \tn % Row Count 26 (+ 10) % Row 6 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`:set {\bf{no}}foo` & preset `no` to switch an option {\bf{off}} \{\{nl\}\}Eg. `:set noic` \tn % Row Count 30 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Lesson 7}} \tn % Row 0 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`\textless{}HELP KEY\textgreater{} \{\{nl\}\}\textless{}F1\textgreater{} \{\{nl\}\}:help \textless{}ENTER\textgreater{}` & Vim has a comprehensive on-line help system. To get started, try one of these three \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`:help cmd` & to find help on `cmd` \tn % Row Count 7 (+ 2) % Row 2 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`CTRL-W CTRL-W` & to jump to another window \tn % Row Count 9 (+ 2) % Row 3 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`:q` & to close help window \tn % Row Count 11 (+ 2) % Row 4 \SetRowColor{LightBackground} \{\{ar\}\}\{\{nobreak\}\}`\textasciitilde{}/.vmrc` & a startup script to keep your preferred settings. \tn % Row Count 14 (+ 3) % Row 5 \SetRowColor{white} \{\{ar\}\}\{\{nobreak\}\}`:cmd CTRL-d \{\{nl\}\}:cmd \textless{}TAB\textgreater{}` & to see possible completions, \{\{nl\}\} to autocomplete \tn % Row Count 17 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}