Tuesday, January 10, 2012

Copy and Paste Tips

copying a word under cursor byw or yiw... paste p
copying into a register a: "ay(iw)... paste "ap

Monday, December 26, 2011

Misc VIM Tips

1. opening multiple files in tabs
vim -p file1 file2...

2. moving tabs
:tabm N

3. highlighting
:set hlsearch
:nohlsearch

4. autocomplete (Ctrl-N)


Sunday, December 25, 2011

Side-by-Side Figures

# 1

\begin{figure*}
\centering
\subfigure[Page coverage due to migration]{
    \includegraphics[width=.3\textwidth]{figures/fig-migcoverage-reduced-prdc}
    \label{fig:migcoverage}
}
\subfigure[Effect of replenishment rates]{
    \includegraphics[width=.3\textwidth]{figures/fig-replenishrate-reduced-prdc}
    \label{fig:replenishrate}
}
\subfigure[Slowdown under overload]{
    \includegraphics[width=.3\textwidth]{figures/fig-overload-reduced-prdc}
    \label{fig:overload}
}
\caption{Effect of Migration, Replenishment Rates and Slowdown}
\end{figure*}
 
# 2
\usepackage{subfigure}

%\begin{figure}[h]%\centering
%\begin{minipage}{.3\textwidth}
%    \includegraphics[width=\textwidth]{figures/fig-migcoverage-reduced-prdc}
%    \caption{Page coverage due to migration}
%    \label{fig:migcoverage}
%\end{minipage}
%\begin{minipage}{.3\textwidth}
%    \includegraphics[width=\textwidth]{figures/fig-replenishrate-reduced-prdc}
%    \caption{Effect of replenishment rates}
%    \label{fig:replenishrate}
%\end{minipage}
%\begin{minipage}{.3\textwidth}
%    \includegraphics[width=\textwidth]{figures/fig-overload-reduced-prdc}
%    \caption{Slowdown under overload}
%    \label{fig:overload}
%\end{minipage}
%\end{figure}

Wednesday, November 23, 2011

Justifying a Block of Code

v - to select the block
< > - to move the block one tab left or right
. - repeat the previous command

Commenting/Uncommenting a block of text

Commenting:
Ctrl-v to select the first characters of the block.
Shft-i for insert mode
Put the %, then hit Esc

Uncommenting:
Ctrl-v to select the first characters and 'x' to delete them. 

Tuesday, November 15, 2011

Moving the cursor

w    goes word by word
b     goes back word by word
(      Move a sentence back
)      Move a sentence forward
{     Move a paragraph back
}     Move a paragraph forward
0     Move to the beginning of the line
$     Move to the end of the line
1G   Move to the first line of the file
G     Move to the last line of the file
nG   Move to nth line of the file


Friday, October 28, 2011

Mark, Search, Code Block

Marking
m{a-zA-Z} marks places
'{a-zA-Z} go back to mark

Searching
* to word under cursor

Code Block
% - go to matching brace

Delete Word or Sentence
dw dis dip