# 反轉一組段落

\begin{rSubsection}{Example 1}{}{Redacted}{}
\item Stuff I did
\item Also did other things
\end{rSubsection}

\begin{rSubsection}{Example 2}{}{Redacted}{}
\item Stuff I did
\item Also did other things
\end{rSubsection}

\begin{rSubsection}{Example 3}{}{Redacted}{}
\item Stuff I did
\item Also did other things
\end{rSubsection}

\begin{rSubsection}{Example 4}{}{Redacted}{}
\item Stuff I did
\item Also did other things
\end{rSubsection}


## 最佳答案

:$put _ | g/Example [2-4]/normal! dapggP  一線解決方案： :$pu _ | 16,20m0 | 16,20m5 | 16,20m10


:16,$m.-1 | normal j [email protected]:  （舊解決方案）此解決方案將反轉塊順序 :$put _ ..................... add a new line at the end
4k .........................  move to the begining of {example 4}
5:m-0 ......................  move next 5 lines to line zero
}}j ........................  move to {example 3}
5:m-11 .....................  move block to 11 lines before
}j .........................  move to the {example 2}
5:m-6 ......................  finishes the magic


Notice: When you type 5:m-0 for example vim will show :.,.+4m-0

OBS: if this block is inside a bigger one you have to use your Relative numbers to do the trick :set nu rnu

"" Move lines in all modes
vnoremap J :m '>+1gv=gv
vnoremap K :m '<-2gv=gv
inoremap  :m+==gi
inoremap  :m-2==gi
nnoremap  :m+
nnoremap  :m-2