Vim Tips Wiki

Formatting stuff

1,624pages on
this wiki
Add New Page
Talk0 Share
Tip 445 Printable Monobook Previous Next

created March 18, 2003 · complexity basic · author Se7en · version 5.7

Here are tips for use when programming in Lisp and Visual lisp for AutoCAD.

imap <Backspace> <Left><del>
" this will allow me to always use the backspace key in insert mode

imap <C-j> <Esc>Ji
" this will allow me to join a line while still in insert mode

map .f v%zf
" fold an entire block of code

nnmap ,y <S-v>y
" This will select a whole line of text or it will select
" everything in a fold.

map .; v%:s/^/;;;/<CR>:noh<CR>
" comments out and entire block of code from paren to paren

:au BufRead *.lsp :loadview 1<CR>
:au BufRead *.LSP :loadview 1<CR>
" load the first fold view file for the current file

map st :set tw=70<CR>v<S-}>gq<End>
" this will allow you to format an entire block of text


Regarding imap <backspace>, you might want to see :help 'bs'.

You can also do

imap <C-j> <Esc>Ji

this way

imap <C-j> <C-o>J

Then you do not leave insert mode. You might also consider using

inoremap <C-j> <C-o>J
:help i_CTRL-O

So the tip should be changed for this:

set backspace=indent,eol,start
" allow backspacing over everything in insert mode

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki