VIM block Selection and Editing
VIM has the ability to select text in rectangular blocks in VISUAL BLOCK mode. Hit CTRL-V and you can extend the selection column by column. This doesn’t allow you to have 0 width selections or to move and extend the selection into columns that do not exist on disk however (huge drawback!). I’m still not sure how to then insert text on each line either. A work in progress… if you know how, please let me know. Thank you Jonathan Lee! – Here’s what I know: After selecting a block with Ctrl-v, press I (shift-i) to insert text in front of the block. While you are editing, it will only show the insertion on the first row. Once you are done, press ESC and the insertion will be done on all of the other rows. To append data after a block, press A (shift-a), type in the text you want then press ESC. If you want to insert data at the end of a block of rows, select the rows you want vertically then press $. This will select everything to the right of the column you were on. Now press A (shift-a) as before, enter the text you want then press ESC.
VIMRC shortcuts
set autoindent ” always set autoindenting on
set nocompatible ” Use Vim defaults (much better!)
set bs=2 ” allow backspacing over everything in insert mode
set autoindent ” always set autoindenting on
set si ” than 50 lines of registers
set bg=dark
set incsearch
set ic
set hlsearch
set cindent
set tags=$BUILDTOP/tags
” setlocal spell spelllang=en_us
set nospell
“set diffopt=iwhite
” Use following to highlight in Vim.
” :highlight Normal ctermbg=black ctermfg=white
” In text files, always limit the width of text to 78 characters
“autocmd BufRead *.txt set tw=78
” Don’t use Ex mode, use Q for formatting
“map Q gq
” Switch syntax highlighting on, when the terminal has colors
” Also switch on highlighting the last used search pattern.
syntax on
” F2 to sort/align/intend a xml blob
map #1 o<table>^M <tr>^M <td>^M </td>^M </tr>^M</table>
map #2 o<ul>^M <li></li>^M</ul>
map #3 o<ul>^M <li><a href=”“></a></li>^M</ul>
map <F2> <Esc>:1,$!xmllint —format -<CR>