\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{ftoulemon} \pdfinfo{ /Title (vim.pdf) /Creator (Cheatography) /Author (ftoulemon) /Subject (Vim 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}{A3A3A3} \definecolor{LightBackground}{HTML}{F3F3F3} \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{Vim Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{ftoulemon} via \textcolor{DarkBackground}{\uline{cheatography.com/31125/cs/9398/}}} \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}ftoulemon \\ \uline{cheatography.com/ftoulemon} \\ \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 December, 2021.\\ 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{1.4931 cm} x{3.4839 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Git gutter}} \tn % Row 0 \SetRowColor{LightBackground} {]}c, {[}c & next, previous hunk \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \textbackslash{}hs, \textbackslash{}hu & stage, undo hunk \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \textbackslash{}hp & preview hunk \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.64701 cm} x{4.32999 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Ack}} \tn % Row 0 \SetRowColor{LightBackground} ?, q & help, close \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} o, O & open, open and close quickview \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} go & preview (focus on quickview) \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} t, T & new tab, new tab (keep focus) \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} h, H & hor. split, hor. split (keep focus) \tn % Row Count 6 (+ 2) % Row 5 \SetRowColor{white} v, gv & ver. split, ver. split (keep focus) \tn % Row Count 8 (+ 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}{CtrlP}} \tn % Row 0 \SetRowColor{LightBackground} \textless{}F5\textgreater{} & Update cache \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \textless{}C-f\textgreater{}, \textless{}C-b\textgreater{} & Cycle between modes \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \textless{}C-d\textgreater{} & Filename only \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \textless{}C-r\textgreater{} & Regex mode \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \textless{}C-t\textgreater{}, \textless{}C-v\textgreater{}, \textless{}C-x\textgreater{} & Open on tab, split \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{3.03597 cm} x{1.94103 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Lint}} \tn % Row 0 \SetRowColor{LightBackground} !python -m json.tool & Format json \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Autopep8 & Format python \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} Clang-format & Format Clang \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Syntastic}} \tn % Row 0 \SetRowColor{LightBackground} :Errors & Open error list \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} :lnext, :lprevious & Navigate through errors \tn % Row Count 3 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.74195 cm} x{3.23505 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Misc}} \tn % Row 0 \SetRowColor{LightBackground} C-r= \textless{}math expr.\textgreater{} & Calc. math expr. in Insert mode \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} C-o & Normal op. in insert mode \tn % Row Count 3 (+ 1) \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}{Caser}} \tn % Row 0 \SetRowColor{LightBackground} PascalCase & gsp or gsm \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} camelCase & gsc \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} snake\_case & gss or gs\_ \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} UPPER\_CASE & gsu or gsU \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} Title Case & gst \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} space case & gs\textless{}space\textgreater{} \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} dash-case & gs- \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} dot.case & gs. \tn % Row Count 8 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.14471 cm} x{3.83229 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Marks}} \tn % Row 0 \SetRowColor{LightBackground} `ma` & set mark a at current cursor location \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} ``.` & jump to position where last change occurred in current buffer \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} ``"` & jump to position where last exited current buffer \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} ``0` & jump to position in last file edited (when exited Vim) \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} ``1` & like ``0` but the previous file (also ``2` etc) \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} `''` & jump back (to line in current buffer where jumped from) \tn % Row Count 13 (+ 2) % Row 6 \SetRowColor{LightBackground} ```` & jump back (to position in current buffer where jumped from) \tn % Row Count 15 (+ 2) % Row 7 \SetRowColor{white} ``{[}` or ``{]}` & jump to beginning/end of previously changed or yanked text \tn % Row Count 17 (+ 2) % Row 8 \SetRowColor{LightBackground} ``\textless{}` or ``\textgreater{}` & jump to beginning/end of last visual selection \tn % Row Count 19 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.24425 cm} x{3.73275 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Jedi}} \tn % Row 0 \SetRowColor{LightBackground} \textless{}C-Space\textgreater{} & Completion \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \textbackslash{}g, \textbackslash{}d & Goto assignment, definition \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \textbackslash{}r, \textbackslash{}n & Usage, show all \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.54287 cm} x{3.43413 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Tags}} \tn % Row 0 \SetRowColor{LightBackground} Ctrl-{]} & Go to definition \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} g{]} & List of matches \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} Ctrl-w Ctrl-{]} & Definition in hsplit \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} Ctrl-t & Jump back up in the tag stack \tn % Row Count 6 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.4931 cm} x{3.4839 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Easy align}} \tn % Row 0 \SetRowColor{LightBackground} ga & Easy align \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} =, 2=, *=, -= & 1st occurrence, 2nd, all, last \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} gaip*| & Align table \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.09034 cm} x{2.88666 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Comments}} \tn % Row 0 \SetRowColor{LightBackground} \textbackslash{}cc, \textbackslash{}cu, \textbackslash{}c\textless{}space\textgreater{} & Comment, Uncomment, Toggle \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \textbackslash{}cs, \textbackslash{}cb & Sexy comment, block \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.79632 cm} x{4.18068 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Documentation}} \tn % Row 0 \SetRowColor{LightBackground} C-l & Python docstring \tn % Row Count 1 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.74195 cm} x{3.23505 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{NerdTree}} \tn % Row 0 \SetRowColor{LightBackground} F8 & Toggle \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} go & preview \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} i, gi, s, gs & split, vsplit \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} K, J & Go to first/last child \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.69218 cm} x{3.28482 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{fold}} \tn % Row 0 \SetRowColor{LightBackground} zc, zo, za & close, open, toggle \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} zC, zO, zA & idem for all levels \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} zM, zR & close, open all \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} zr & open one level \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.54747 cm} x{4.42953 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Spell}} \tn % Row 0 \SetRowColor{LightBackground} z= & Show suggestions \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} zg & Add to dict \tn % Row Count 2 (+ 1) \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}{Interesting words}} \tn % Row 0 \SetRowColor{LightBackground} Highlight & \textless{}Leader\textgreater{}k \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Navigate & n and N \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} Clear & \textless{}Leader\textgreater{}K \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.89126 cm} x{3.08574 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Search}} \tn % Row 0 \SetRowColor{LightBackground} flags: {[}g{]}, {[}c{]}, {[}i{]}, {[}I{]} & All occurrences, confirmation, ignore case, don't ignore case \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} :\%s, :1,10s & Whole doc, line 1 to 10 \tn % Row Count 4 (+ 1) % Row 2 \SetRowColor{LightBackground} \textbackslash{}\textless{}foo\textbackslash{}\textgreater{} & Whole word \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} :g/\textasciicircum{}baz/s/foo/bar/g & Change each 'foo' to 'bar' in each line starting with 'baz' \tn % Row Count 8 (+ 3) % Row 4 \SetRowColor{LightBackground} :g/foo/d & Delete all lines matching foo (g! for not matching) \tn % Row Count 11 (+ 3) % Row 5 \SetRowColor{white} \textbackslash{}zs, \textbackslash{}ze & Start, end of a pattern \tn % Row Count 12 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.4977 cm} x{4.4793 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Format}} \tn % Row 0 \SetRowColor{LightBackground} V= & select text, then reformat with = \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} = & will correct alignment of code \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} == & one line; \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} gq & reformat paragraph \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Matching}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/ftoulemon_1484209359_Capture.JPG}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{http://vimregex.com/} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Substitute}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/ftoulemon_1490083160_Capture.JPG}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.59264 cm} x{3.38436 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Registers}} \tn % Row 0 \SetRowColor{LightBackground} "ay & Yank to register a \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} "ap & Paste register a \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} Ctrl-r + \textless{}register\textgreater{} & Insert content of \textless{}register\textgreater{} \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} "., "\%, ":, "\# & Last inserted text, current filepath, last executed command, last alternate file name \tn % Row Count 8 (+ 4) % Row 4 \SetRowColor{LightBackground} "=, Ctrl-r + = & Result of expression \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} /, ?, * or \# & Search registers \tn % Row Count 11 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}