Wikia

Vim Tips Wiki

Changes: Formatting stuff

Edit

Back to page

(Move categories to tip template)
(Remove html character entities)
 
Line 15: Line 15:
   
 
<pre>
 
<pre>
imap &lt;Backspace&gt; &lt;left&gt;&lt;del&gt;
+
imap <Backspace> <Left><del>
 
" this will allow me to always use the backspace key in insert mode
 
" this will allow me to always use the backspace key in insert mode
   
imap &lt;C-j&gt; &lt;Esc&gt;Ji
+
imap <C-j> <Esc>Ji
 
" this will allow me to join a line while still in insert mode
 
" this will allow me to join a line while still in insert mode
   
Line 24: Line 24:
 
" fold an entire block of code
 
" fold an entire block of code
   
nnmap ,y &lt;S-v&gt;y
+
nnmap ,y &lt;S-v>y
 
" This will select a whole line of text or it will select
 
" This will select a whole line of text or it will select
 
" everything in a fold.
 
" everything in a fold.
   
map .; v%:s/^/;;;/&lt;CR&gt;:noh&lt;CR&gt;
+
map .; v%:s/^/;;;/<CR>:noh<CR>
 
" comments out and entire block of code from paren to paren
 
" comments out and entire block of code from paren to paren
   
:au BufRead *.lsp :loadview 1&lt;cr&gt;
+
:au BufRead *.lsp :loadview 1<CR>
:au BufRead *.LSP :loadview 1&lt;cr&gt;
+
:au BufRead *.LSP :loadview 1<CR>
 
" load the first fold view file for the current file
 
" load the first fold view file for the current file
   
map st :set tw=70&lt;cr&gt;v&lt;S-}&gt;gq&lt;End&gt;
+
map st :set tw=70<CR>v&lt;S-}>gq<End>
 
" this will allow you to format an entire block of text
 
" this will allow you to format an entire block of text
 
</pre>
 
</pre>
   
 
==Comments==
 
==Comments==
Regarding imap &lt;backspace&gt;, you might want to see {{help|'bs'}}.
+
Regarding imap <backspace>, you might want to see {{help|'bs'}}.
   
 
----
 
----
 
You can also do
 
You can also do
imap &lt;C-j&gt; &lt;Esc&gt;Ji
+
imap <C-j> <Esc>Ji
   
 
this way
 
this way
imap &lt;C-j&gt; &lt;C-o&gt;J
+
imap <C-j> <C-o>J
   
 
Then you do not leave insert mode.
 
Then you do not leave insert mode.
 
You might also consider using
 
You might also consider using
inoremap &lt;C-j&gt; &lt;C-o&gt;J
+
inoremap <C-j> <C-o>J
   
 
{{help|i_CTRL-O}}
 
{{help|i_CTRL-O}}

Latest revision as of 08:43, September 29, 2008

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

CommentsEdit

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

Around Wikia's network

Random Wiki