\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{piping} \pdfinfo{ /Title (vim-and-its-secrets.pdf) /Creator (Cheatography) /Author (piping) /Subject (VIM and its secrets 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}{CF1717} \definecolor{LightBackground}{HTML}{FCF0F0} \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 and its secrets Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{piping} via \textcolor{DarkBackground}{\uline{cheatography.com/61694/cs/15920/}}} \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}piping \\ \uline{cheatography.com/piping} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 13th June, 2018.\\ Updated 15th July, 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*}{2} \begin{tabularx}{8.4cm}{x{2.32 cm} x{5.68 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Beginner Block}} \tn % Row 0 \SetRowColor{LightBackground} i & start insert \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \textless{}esc\textgreater{} or \textless{}C-{[}\textgreater{} & escape to normal mode \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} :w {[}\textless{}filename\textgreater{}{]} & in normal mode, write to current file \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} :q & in normal mode, quit the editor \tn % Row Count 7 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{{\bf{{[} \seqsplit{https://github.com/Piping/dotfiles} {]} has my configuration}} \newline Notation: `\textless{}leader\textgreater{}` key can be defined via `let mapleader = "\textbackslash{}\textless{}space\textgreater{}"` \newline `\textless{}C-a\textgreater{}` means `Ctrl + A` , `\textless{}S-x\textgreater{}` means `Shift + x`} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2 cm} x{6 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Cursor Motions: keystokes that move the cursor}} \tn % Row 0 \SetRowColor{LightBackground} hjkl & left/down/up/right \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} f/F & search and move to next typed character \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} t/T & similar to `f/F`. but stop before character \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} 0/\$ & start/end of current line \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} \textasciicircum{}/g\_ & start and end of current line with non whitespace \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} w/e & next start/end of word, `W/E` for word with punctunation \tn % Row Count 10 (+ 2) % Row 6 \SetRowColor{LightBackground} b/B & previous start of word `B` for word with punctuation \tn % Row Count 12 (+ 2) % Row 7 \SetRowColor{white} gg & go to line \{count\}, default first line \tn % Row Count 14 (+ 2) % Row 8 \SetRowColor{LightBackground} G & go to line \{count\}, default last line \tn % Row Count 16 (+ 2) % Row 9 \SetRowColor{white} -/\textless{}enter\textgreater{} & previous/next start of the line \tn % Row Count 18 (+ 2) % Row 10 \SetRowColor{LightBackground} H/M/L & cursor go to TOP/MIDDLE/BOTTOM of the screen \tn % Row Count 20 (+ 2) % Row 11 \SetRowColor{white} '' & (single quote twice) previous location in jumplist \tn % Row Count 22 (+ 2) % Row 12 \SetRowColor{LightBackground} '\{a-z\}/`\{a-z\} & previous marked position using m\{a-z\}, E.g. ma `a \tn % Row Count 24 (+ 2) % Row 13 \SetRowColor{white} '. & To the position where the last change was made. \tn % Row Count 26 (+ 2) % Row 14 \SetRowColor{LightBackground} \% & move to closing pair {[}{]}, \{\}, () \tn % Row Count 28 (+ 2) % Row 15 \SetRowColor{white} \{1-9\}+ & a number type before motions, repeat \{count\} motion \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2 cm} x{6 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Cursor Motions: keystokes that move the cursor (cont)}} \tn % Row 16 \SetRowColor{LightBackground} :help motion & check more on documents inside vim \tn % Row Count 2 (+ 2) % Row 17 \SetRowColor{white} g; g, & cycle through change positions \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{{\bf{Vim Concept: Motions - command that moves the cursor, depends on current cursor position. Above list is not complete! It can be used with `OPERATOR` to efficiently editing text in Textual User Interface}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{0.88 cm} x{7.12 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Operator - commands that edit text efficiently}} \tn % Row 0 \SetRowColor{LightBackground} d & delete/cut \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} c & change \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} y & copy/yank \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \textasciitilde{} & reverse case \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} ! & filter with external program, E.g. format doc \tn % Row Count 6 (+ 2) % Row 5 \SetRowColor{white} gu/gU & make lower/upper case \tn % Row Count 8 (+ 2) % Row 6 \SetRowColor{LightBackground} \textless{}/\textgreater{} & indent left/right \tn % Row Count 9 (+ 1) % Row 7 \SetRowColor{white} = & filter with predefined `equalprg` \tn % Row Count 10 (+ 1) % Row 8 \SetRowColor{LightBackground} zf & fold the text \tn % Row Count 11 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Two way to combine operator and selections: \newline 1. operator first then selection \newline 2. visual selection first then does operation \newline Example: \newline E.g. `di"` delete the word inside double quotes or equivalently `vi"d`. \newline E.g. `yy` copy the current line, `dd` cut/delete the current line ({\bf{Press one operator twice operate on current line as the selection}})} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{0.88 cm} x{7.12 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Text-Object-Motion : Level Up Cursor Motion}} \tn % Row 0 \SetRowColor{LightBackground} ap & around a paragraph \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} iw & inner word \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} aw & aroud word \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} i" & inner double quote \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} a" & around double quote \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} // & last search result, follow after operator \tn % Row Count 7 (+ 2) % Row 6 \SetRowColor{LightBackground} //0 & search-offset to that whole line \tn % Row Count 8 (+ 1) % Row 7 \SetRowColor{white} :h iw & help for more \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.76 cm} x{6.24 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Paste \&\& Registers}} \tn % Row 0 \SetRowColor{LightBackground} p & paste after cursor using content from register `"` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} P & paste before cursor or cursor line \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} "0p & paste `0` register's content in normal mode \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{:register} & show content of a list of registers \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} :h \seqsplit{i\_ctrl-r} & more registers \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{{\bf{VIM Concept: Registers, used to store copy/cut text, the register can have single character names, `\{0-9a-z"\%\#*+:.-=\}`. }}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.76 cm} x{6.24 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Page Movement}} \tn % Row 0 \SetRowColor{LightBackground} \textless{}C-e\textgreater{}/\textless{}C-y\textgreater{} & {\bf{move buffer down/up and keep cursor position}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} zz & bring current cursor line to center \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} zb & bring current cursor line to bottom screen \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} zt & bring current cursor line to top screen \tn % Row Count 8 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{0.88 cm} x{7.12 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Visual Mode Commands}} \tn % Row 0 \SetRowColor{LightBackground} o & switch between two ends of selection (anchor) \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \textless{}c-v\textgreater{} & switch to visual block mode \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} V & switch to visual line mode \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} v & switch to visual mode \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.32 cm} x{5.68 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Tabs}} \tn % Row 0 \SetRowColor{LightBackground} gt & go to next tab \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} gT & go to previous tab \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} :tabnew & new tab, {\bf{\textless{}leader\textgreater{}t}} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} :tabclose & close current tab \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.56 cm} x{5.44 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{File Navigation}} \tn % Row 0 \SetRowColor{LightBackground} Ctrl + 6 / Ctrl + \textasciicircum{} & jump to previous opened file in current window \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} gf & open file using the text under the cursor \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} :tabe \textless{}filename\textgreater{} & open file in the new tab \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} :e \textless{}filename\textgreater{} & open file in the current window \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} :ls & list current opened buffers(files) \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} :buf \textless{}number\textgreater{} & open selected buffer(file) in the current window \tn % Row Count 12 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.76 cm} x{6.24 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Start Insert Mode in various way}} \tn % Row 0 \SetRowColor{LightBackground} a & insert after the cursor (append) \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} i & insert in front of the cursor \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} I (Caps i) & Insert at the beginning of the line \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} A & Insert at the end of the line \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} s & remove current character and enter insert mode \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} R & enter insert mode with REPLACE semantic \tn % Row Count 10 (+ 2) % Row 6 \SetRowColor{LightBackground} c \textless{}motions\textgreater{} & delete selected text and enter insert mode \tn % Row Count 12 (+ 2) % Row 7 \SetRowColor{white} gi & go to last edited place and enter insert mode \tn % Row Count 14 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.12 cm} x{4.88 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Windows (Split, Size Adjustment, Placement)}} \tn % Row 0 \SetRowColor{LightBackground} \textless{}C-w\textgreater{}= & equal size display all panels \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \textless{}C-w\textgreater{}s & horizontal split \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \textless{}C-w\textgreater{}v & vertical split \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \textless{}C-W\textgreater{}p & go to last accessed window \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} \textless{}C-w\textgreater{}H & put pane to absolute left, take full height \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} \textless{}C-w\textgreater{}L & put pane to absolute right, take full height \tn % Row Count 10 (+ 2) % Row 6 \SetRowColor{LightBackground} \textless{}C-w\textgreater{}J & put pane to absolute bottom, take full width \tn % Row Count 12 (+ 2) % Row 7 \SetRowColor{white} \textless{}C-w\textgreater{}K & put pane to absolute top, take full width \tn % Row Count 14 (+ 2) % Row 8 \SetRowColor{LightBackground} :set splitright & for vertical split, place new pane right \tn % Row Count 16 (+ 2) % Row 9 \SetRowColor{white} :vertical split \textless{}filename\textgreater{} & vertical split buffer/file \tn % Row Count 18 (+ 2) % Row 10 \SetRowColor{LightBackground} \textless{}C-w\textgreater{}hjkl & move to cursor to relative left/down/up/right pane \tn % Row Count 21 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{1.04 cm} x{6.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Insert Mode ( Emacs Style Single Line Editing)}} \tn % Row 0 \SetRowColor{LightBackground} \textless{}C-a\textgreater{} & Jump to the beginning of the line \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \textless{}C-e\textgreater{} & Jump to the end of the line \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \textless{}C-w\textgreater{} & Backward-Delete Word \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \textless{}C-d\textgreater{} & Forward-Delete Word \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \textless{}C-y\textgreater{} & paste/yank to current line \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \textless{}C-k\textgreater{} & delete the rest line after cursor \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.44 cm} x{6.56 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Useful Utility Commands (Normal Mode)}} \tn % Row 0 \SetRowColor{LightBackground} . & dot command, repeat last `change` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} J & Join the line below to current line \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \textless{}C-a\textgreater{} & add \{count\} to number under cusor \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \textless{}C-x\textgreater{} & subtract \{count\} to number under cusor \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} @; & repeat last cmdline command \tn % Row Count 9 (+ 1) % Row 5 \SetRowColor{white} \textless{}leader\textgreater{}j & break current line and move trailing part one line above \tn % Row Count 11 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{dot command `.` repeat text changes that is defined by vim. E.g. invoked by operator `c` and followup inserted text.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{1.2 cm} x{6.8 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Ctrl+R (Using Registers in Insert/Command Mode)}} \tn % Row 0 \SetRowColor{LightBackground} \textless{}C-R\textgreater{}/ & put last search string \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \textless{}C-R\textgreater{}= & calculator \textless{}C-R\textgreater{}=128/2, insert mode \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \textless{}C-R\textgreater{}" & put last copied text \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \textless{}C-R\textgreater{}0 & put second to last copied text \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{dot command `.` does not repeat command line commands, only changes that is defined by vim. E.g. invoked by operator `c` and followup inserted text.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.6 cm} x{6.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{CSCOPE MAPPING (My Configuration)}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{:cs add \textless{}path to cscope.out\textgreater{} \textless{}path to worksapce\textgreater{}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \textless{}leader\textgreater{}ca & add cscope.out \textless{}worksapce path\textgreater{} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \textless{}leader\textgreater{}gs & search the C symbol under cursor \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \textless{}leader\textgreater{}gd & search global defintion \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} \textless{}leader\textgreater{}gc & search who called this function \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} \textless{}leader\textgreater{}ge & search this string as egrep pattern \tn % Row Count 11 (+ 2) % Row 6 \SetRowColor{LightBackground} \textless{}leader\textgreater{}gf & search for this file under cursor \tn % Row Count 13 (+ 2) % Row 7 \SetRowColor{white} \textless{}leader\textgreater{}gi & search for files that include the current file \tn % Row Count 15 (+ 2) % Row 8 \SetRowColor{LightBackground} \textless{}leader\textgreater{}ga & search assignment to this variable \tn % Row Count 17 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{cscope is the most common tool for developing c projects. (look up symbol, definition, locate caller/callee of functions, etc). cscope interface is built-in feature for most vim distribution. To generate cscope database, first use `cscope -Rbq` in your project directory.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.44 cm} x{6.56 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Normal Commands (My Configuration)}} \tn % Row 0 \SetRowColor{LightBackground} q & {\bf{close current window}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \textless{}cr\textgreater{} & equivalent to :noh Remove Search Highlights \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \textless{}leader\textgreater{}m & open tagbar for current file \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \textless{}leader\textgreater{}l & toggle line number display \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} \textless{}leader\textgreater{}z & open current file in a new tab to "ZOOM" \tn % Row Count 9 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Command Mode :}} \tn % Row 0 \SetRowColor{LightBackground} :\% & \{range\}, equal to 1,\$ (the entire file) \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} :\{range\}! \textless{}external cmd\textgreater{} & range of text is being pipe to cmd to be replaced \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} :\%! xxd & edit binary file \tn % Row Count 6 (+ 1) % Row 3 \SetRowColor{white} :\%! xxd -r & save the file into binary form \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} Ctrl-f & open cmdline editing windows \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.08 cm} x{5.92 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Special and Very Useful Windows -{}- Quickfix}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{:copen/:cclose} & open/close Quickfix \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} :cn & go to next fix \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} :cp & go to previous fix \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} :make all -j & build the code \& report on quickfix list \tn % Row Count 6 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Quickfix typically used after `:make` command and can be configured to work with `cscope`. The quickfix window contains the parsed result from `:make` that contains where complication error happen, and put cursor to exactly the file/line/column so user can just fix it! \newline I open quick fix with my shortcut and prefix a `:botright copen` to open it at the bottom of window} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.32 cm} x{5.68 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Fold The Content}} \tn % Row 0 \SetRowColor{LightBackground} :set \seqsplit{foldmethod=} & available values: syntax, indent, manual \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} :set foldlevel= & 0,1,2,3,.., applied when value is changed \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} za & toggle folding at the cursor position \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} zf & Operator to create a fold (manual mode only) \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} zo & open selection text \tn % Row Count 9 (+ 1) % Row 5 \SetRowColor{white} zc & close the fold \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.96 cm} x{5.04 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Vim Diff Mode}} \tn % Row 0 \SetRowColor{LightBackground} :diffsplit \textless{}{[}filename{]}\textgreater{} & split the window with diff mode on \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} :diffoff & turn off diff mode, (include diff highlights) \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} :set diff! & only switch the diff color highlight \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} do & diff obtain the change from the other side \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} dp & diff put change to the other side \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{`windo diffoff` can turn off all diffmode windows in current tab} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{1.12 cm} x{6.88 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Commentary ( External Plugin )}} \tn % Row 0 \SetRowColor{LightBackground} gcc & comment/uncomment current line \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} 10gcc & comment next 10 lines \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} gcu & comment block \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} gcap & comment the paragrah \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} gc & comment selection (visual mode) \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}