1. launch vim:
> $ vim
2. Add some test text:
> Test
> foldtext1
> foldtext2
> foldtext3
> End
> hello
3. Create folding: Visual select whole lines from line 1 to line 5, use zf to
create a folding.
4. Deletes some folding lines:
> :2,4d
5. Now you will see vim has deleted line 1 to line 5.
When folding is unfolded, then :2,4d will work as expected.
vim version:
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Sep 30 2009 16:50:58)
Included patches: 1-6, 8-35, 37-48, 50-70, 73, 75-87, 90-92, 94-100, 102-137,
139-149, 151-171, 173-190, 192-193, 195-203, 206-211, 213-215, 217-
218, 220-232, 234-239
--
Hi,
Wu, Yue
It's an intentional behavior. See :help fold-behavior - it describes:
> For Ex commands the range is adjusted to always start at the first line of a
> closed fold and end at the last line of a closed fold. Thus this command: >
> :s/foo/bar/g
> when used with the cursor on a closed fold, will replace "foo" with "bar" in
> all lines of the fold.
--
To Vim, or not to Vim.
http://whileimautomaton.net/
Thanks for info, but I don't understand the logical.
If I don't want this behavior, how to disable it temporaryly?
--
Hi,
Wu, Yue
Folded lines are treated as a single line. :help 28.3
> If I don't want this behavior, how to disable it temporaryly?
Use 'foldenable' as follows:
:setlocal nofoldenable
:" Do something such as :2,4d
:setlocal foldenable
Thanks for nice help, it works :)
--
Hi,
Wu, Yue
However, if you do
:echo $OS
Vim comes back with what operating system you are currently running
under. I am sure there are more of these variables - but I can not find
a list of them. Thus - the question.
TIA! :-)
Mark
PS: I know someone's going to say "Why do you need to do this?"
Example: How to get the current date/time. Mac and Linux do it one
way, Windows does it another. If you want to write a function that acts
according to a given OS - you need to know the OS. True - there are not
a lot of reasons to need this, but there are sometimes when you do need
it. :-)
No, it doesn't. Such variables are environment variables and Vim does
not "have" them. It gets them when it is started, uses a few of them
(namely, $VIM, $VIMRUNTIME and $VIMINIT) and makes another two available
to processes it spawns: $MYVIMRC and $MYGVIMRC.
If :echo $OS gives you back your OS name, it means you have a variable
"OS" set in your environment. In mine there is no such variable and
I get a blank line.
By the way, I believe that the vim-use mailing list would be a more
proper place for this type of questions in the future. This is vim-dev
where issues regarding Vim development and bug reports tend to be
discussed.
--
HTH,
Lech
":help $<Tab>" shows the following: $HOME, $VIM, $VIMRUNTIME, $MYVIMRC,
$MYGVIMRC.
> For instance, if you do a help on $VIM (i.e.: :h $VIM)
> you get information on the $VIM variable. But if you do the same for
> $OS you get an error.
>
> However, if you do
>
> :echo $OS
That's because there's something in your environment that set $OS. Vim
doesn't do that. Aside from the above mentioned $-variables, all others are
environment variables.
> PS: I know someone's going to say "Why do you need to do this?"
> Example: How to get the current date/time.
Use the strftime() function that Vim provides. :help strftime()
> Mac and Linux do it one
> way, Windows does it another. If you want to write a function that acts
> according to a given OS - you need to know the OS.
Use has() to check for items from feature-list. E.g., has('win32') will
return 1 if you're using a Vim built for 32-bit versions of Windows.
has('mac') will return 1 if you're running the mac version of Vim.
See ":help has()" and ":help feature-list".
--
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <jame...@jamessan.com>