Re: paste and wrap
- Darren <darrenwhite@...> wrote:
> hiI'm not sure. Maybe chek options whose names start with 'paste' (:help
> I have set wrapmaergin to 1 in my vimrc file and it work as I would
> like but when
> I paste in a big chunk text it does not wrap. Is there a way to make
> it wrap?
'paste<Tab> or :help 'paste<Ctrl-D>)
> Also whan in edit mode (is that what it's called(not insert mode))the usual name is Normal mode.
> how do in insert a CR to split a line? Darrenafter cursor position: a<CR><Esc>
before cursor position: i<CR><Esc>
To open a new, empty line above or below current line (starting from Normal
mode): O or o (followed by <Esc> if you don't want to stay in Insert mode).
In a mapping, type it as above, angle brackets and all. From the keyboard,
each <...> is one key. See :help <> and scroll both up and down.
- Darren White wrote:
> [...]Normal mode.
> Also whan in edit mode (is that what it's called(not
> insert mode))
> how do in insert a CR to split a line?I use the following two maps. They search for preceding or
following white space and replace it with a newline. (I got
the idea from Eli the Bearded, to give credit where it is
:map \, ?[ ^I]^Mr^M
:map \. /[ ^I]^Mr^M
But these are vi-style with what should be literal control
characters. In vim's idiom they would be:.
:map <leader>, ?\s<CR>r<CR>
:map <leader>. /\s<CR>r<CR>
If you don't want these maps to affect your search history
you could use the substitute() function in a script. But
that's getting more complicated. I guess you could also make
sure that whitespace preceding or following that which is
found could also be removed:
:map <leader>, ?\s<CR>:s/\s*\%#\s*/\r/<CR>
:map <leader>. /\s<CR>:s/\s*\%#\s*/\r/<CR>
But that means autoindent won't have any effect. So you
could then do:
:map <leader>, ?\s<CR>a<CR><Esc>:-s/\s*$//<CR>+
:map <leader>. /\s<CR>a<CR><Esc>:-s/\s*$//<CR>+
To preserve autoindent, even if the cursor is in the middle
of whitespace, you could try (man, you could go on forever
:map <leader>, ?\s<CR>?\S<CR>/\S<CR>i<CR><Esc>:-s/\s*$//<CR>+
:map <leader>. /\s<CR>/\S<CR>i<CR><Esc>:-s/\s*$//<CR>+
I think I like this one best, thanks! :-)
Bear in mind that these maps will allow the cursor to cross
line boundaries while you may prefer the search to only
occur in the current line. You could fix that by using
techniques specified at :help \%l. I think I'll stop now.
- Hello, thanks for the help. I find it quite scary at just how much vim can do. I haven't got any of the :map commands to work yet, in fact I don't even know what they are but now I have an idea of what to type after :help.
No banners. No pop-ups. No kidding.
Make My Way your home on the Web - http://www.myway.com