Monday, October 31, 2011

Re: detect QuickFix window list or LocationList

Thanks to upper two guys hints. empty(getloclist(0)) is more simple.

Andy Wokula, which one is for QuickFix like getloclist(0), I can not find it even I use many times
Tab.

=> On [2011-10-31 13:50:49 +0100]:
Andy Wokula Said:
> Am 31.10.2011 12:14, schrieb stardiviner:
> >I want to bind key Alt-n/p to next/previous LocationList or next/previous QuickFix list.
> >So I need to detect which List in current buffer. then bind Alt-n/p to them.
> >like this.
> > if (detect Location or QuickFix)
> > map<A-n> :cnext<CR>
> > map<A-n> :cprevious<CR>
> > elseif
> > map<A-n> :lnext<CR>
> > map<A-n> :lprevious<CR>
> > endif
>
> You could check for
> empty(getloclist(0))
>
>
> " Second approach: always do :lnext and if that fails, try :cnext
>
> nnoremap <A-n> :NextError<CR>
> nnoremap <A-p> :PrevError<CR>
>
> com! -bar NextError call s:GoForError("next")
> com! -bar PrevError call s:GoForError("previous")
>
> func! s:GoForError(partcmd)
> try
> try
> exec "l". a:partcmd
> catch /:E776:/
> " No location list
> exec "c". a:partcmd
> endtry
> catch
> echohl ErrorMsg
> echomsg matchstr(v:exception, ':\zs.*')
> echohl None
> endtry
> endfunc
>
> --
> Andy
>
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php

--
stardiviner GPG: 5D9F64D8 Twitter: @numbchild
http://stardiviner.dyndns-blog.com/author.html

Re: Mapping shortcuts

This is a great thread -- I'm all about using the manual and help when I can, but I agree, most software that has substantial documentation and is complex has a help structure that is often hard to understand... I bet a lot of people would be grateful if someone would make a "How to use the documentation effectively" page for vim... I'd offer, but I really don't know it yet, but would love to read and learn from it...

Matt

On Mon, Oct 31, 2011 at 5:56 PM, AK <andrei.avk@gmail.com> wrote:
On 10/31/2011 05:43 PM, Tony Mechelynck wrote:
On 31/10/11 22:03, Benjamin R. Haskell wrote:
[...]
The problem is sometimes that it's too complete, and isn't organized by
the person who's looking for the information (naturally). Google often
cuts through that problem (e.g. by allowing synonyms that the help
writer didn't consider, or terms that aren't fully correct).
[...]

Yes, the Vim help is as complete and as accurate as is humanly possible,
but sometimes it presents a needle-and-haystack problem. This, however,
has been greatly alleviated, first (in Vim 6.2 IIRC) by the :helpgrep
command, and later (Vim 7.x) by the helphelp.txt helpfile, which
centralizes all "help on searching help" (except the short summary found
by hitting F1) in a single place. Hence the "must read" in my previous
post.

And I'll add here: even if you do find something which seems relevant
about Vim by Googling or by searching the Wikipedia, always check it
afterwards with the online help, where you may find that your Google
info is perhaps slightly out-of-date, or omits just the corner case
which is giving you problems now.


Best regards,
Tony.


Vim needs a built-in google-like search. Type a few words, get
a list of entries, best matches on top.

helpgrep is not nearly the same thing - it's linewise, not
topic-wise, and it needs exact match, not synonym/tag match;
and out of the box, it does not easily do AND and OR searches
matching any order of words.

Basically, the idea is, "Are you already a vim expert and
know exactly the command you need? Boy, do we have a really
great tool to help you find it!"

Vim has a really great help system.. one of the best help
systems I've used... for ~2-3,000 lines of content. Unfortunately,
it has 130,000 lines of help.

 -ak


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php



--
Do not seek to follow in the footsteps of the wise men of old. Seek what they sought.

- Matsuo Munefusa ("Basho")

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Ignoring C comments with diffexpr

On 2011-10-31, subhash wrote:
> Hi,
>
> Could someone help me understand how to set up diffexpr variable in
> vim (by defining my own diff function) so that I can ignore C comments
> while diff'ing. (i.e. // or /* .... */). There seems to be a way in "
> diff -I RE ..., " but I am not able to figure it out by myself. Would
> be great if someone can actually give a snippet of their function as
> an example.

Here's what I've done in my ~/.vimrc to add the -d option to diff on
Unix. I used the MyDiff() function in the default Windows _vimrc as
an example.

set diffexpr=MyDiff()
function MyDiff()
let opt = ""
if &diffopt =~ "icase"
let opt = opt . "-i "
endif
if &diffopt =~ "iwhite"
let opt = opt . "-b "
endif
silent execute "!diff -d -a --binary " . opt . v:fname_in . " " . v:fname_new .
\ " > " . v:fname_out
endfunction

As an experiment, I modified the line containing the diff command to
add this option:

-I '//'

As a result, lines beginning with // but containing different text
in two test files were not highlighted as different by vimdiff.
However, in the time I allowed myself, I couldn't refine the regular
expression to match only comment lines or to match /* and */. I
hope this is of some help anyway.

Regards,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Ignoring C comments with diffexpr

Hi,

Could someone help me understand how to set up diffexpr variable in
vim (by defining my own diff function) so that I can ignore C comments
while diff'ing. (i.e. // or /* .... */). There seems to be a way in "
diff -I RE ..., " but I am not able to figure it out by myself. Would
be great if someone can actually give a snippet of their function as
an example.

This is my first post .I tried looking at the forums for this topic
but couldn't find any webpage. It would be great if someone could
point me to some online blog/discussion as well.

Thanks a lot for your time
-Subhash

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Cannot use gf to go to file, path seems set

On 2011-11-01, Dotan Cohen wrote:
> I have this line in some PHP code:
> require_once(DIR . '/includes/functions_misc.php');
>
> DIR is actually /var/www/html/forum/
> I have set my path to be the include-all monster:
> :set path=.,/var/www/html,/var/www/html/forum,/var/www/html/forum/includes
>
> However, gf insists that it cannot find the file. I did try each value
> of the path my itself, still no good. What might I be doing wrong? VIM
> 7.x, CentOS 5.x.

The problem is that that last segment of the path name,
/includes/functions_misc.php, begins with a "/" which Vim
understands to mean the beginning of an absolute path. See

:help 'path'

Regards,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Mapping shortcuts

On 10/31/2011 05:43 PM, Tony Mechelynck wrote:
> On 31/10/11 22:03, Benjamin R. Haskell wrote:
> [...]
>> The problem is sometimes that it's too complete, and isn't organized by
>> the person who's looking for the information (naturally). Google often
>> cuts through that problem (e.g. by allowing synonyms that the help
>> writer didn't consider, or terms that aren't fully correct).
> [...]
>
> Yes, the Vim help is as complete and as accurate as is humanly possible,
> but sometimes it presents a needle-and-haystack problem. This, however,
> has been greatly alleviated, first (in Vim 6.2 IIRC) by the :helpgrep
> command, and later (Vim 7.x) by the helphelp.txt helpfile, which
> centralizes all "help on searching help" (except the short summary found
> by hitting F1) in a single place. Hence the "must read" in my previous
> post.
>
> And I'll add here: even if you do find something which seems relevant
> about Vim by Googling or by searching the Wikipedia, always check it
> afterwards with the online help, where you may find that your Google
> info is perhaps slightly out-of-date, or omits just the corner case
> which is giving you problems now.
>
>
> Best regards,
> Tony.


Vim needs a built-in google-like search. Type a few words, get
a list of entries, best matches on top.

helpgrep is not nearly the same thing - it's linewise, not
topic-wise, and it needs exact match, not synonym/tag match;
and out of the box, it does not easily do AND and OR searches
matching any order of words.

Basically, the idea is, "Are you already a vim expert and
know exactly the command you need? Boy, do we have a really
great tool to help you find it!"

Vim has a really great help system.. one of the best help
systems I've used... for ~2-3,000 lines of content. Unfortunately,
it has 130,000 lines of help.

-ak

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Cannot use gf to go to file, path seems set

I have this line in some PHP code:
require_once(DIR . '/includes/functions_misc.php');

DIR is actually /var/www/html/forum/
I have set my path to be the include-all monster:
:set path=.,/var/www/html,/var/www/html/forum,/var/www/html/forum/includes

However, gf insists that it cannot find the file. I did try each value
of the path my itself, still no good. What might I be doing wrong? VIM
7.x, CentOS 5.x.

Thanks!


--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Mapping shortcuts

On 31/10/11 22:03, Benjamin R. Haskell wrote:
[...]
> The problem is sometimes that it's too complete, and isn't organized by
> the person who's looking for the information (naturally). Google often
> cuts through that problem (e.g. by allowing synonyms that the help
> writer didn't consider, or terms that aren't fully correct).
[...]

Yes, the Vim help is as complete and as accurate as is humanly possible,
but sometimes it presents a needle-and-haystack problem. This, however,
has been greatly alleviated, first (in Vim 6.2 IIRC) by the :helpgrep
command, and later (Vim 7.x) by the helphelp.txt helpfile, which
centralizes all "help on searching help" (except the short summary found
by hitting F1) in a single place. Hence the "must read" in my previous post.

And I'll add here: even if you do find something which seems relevant
about Vim by Googling or by searching the Wikipedia, always check it
afterwards with the online help, where you may find that your Google
info is perhaps slightly out-of-date, or omits just the corner case
which is giving you problems now.


Best regards,
Tony.
--
"A wizard cannot do everything; a fact most magicians are reticent to
admit, let alone discuss with prospective clients. Still, the fact
remains that there are certain objects, and people, that are, for one
reason or another, completely immune to any direct magical spell. It
is for this group of beings that the magician learns the subtleties of
using indirect spells. It also does no harm, in dealing with these
matters, to carry a large club near your person at all times."
-- The Teachings of Ebenezum, Volume VIII

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Mapping shortcuts

On Mon, 31 Oct 2011, Chris Jones wrote:

> On Mon, Oct 31, 2011 at 01:06:45PM EDT, George Papanikolaou wrote:
>> I know this is simple. but I can't figure it out by Googling... so.
>
> Nothing wrong with googling, but there's no guarantee whoever posted
> his favorite trick fully understands the problem and that whatever
> worked in his case will not have side-effects that may be quite
> unsuitable in your case.

A valid point, but as with Wikipedia, if you don't want 100% accuracy
(rather an introductory overview), googling is usually quicker.

> Maybe now's the time for you to start working with the complete (and
> 100% accurate) vim help and lose the Google-search habit...?

The problem is sometimes that it's too complete, and isn't organized by
the person who's looking for the information (naturally). Google often
cuts through that problem (e.g. by allowing synonyms that the help
writer didn't consider, or terms that aren't fully correct).

In this particular case, all of the following queries lead directly to
relevant information, so the OP just needed to try harder (, no offense):

vim mapping shortcuts -- the subject of this email, plus 'vim'
vim key maps
vim key mapping
vim keyboard shortcut

--
Best,
Ben

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Mapping shortcuts

On 31/10/11 21:15, Chris Jones wrote:
> On Mon, Oct 31, 2011 at 01:06:45PM EDT, George Papanikolaou wrote:
>> I know this is simple. but I can't figure it out by Googling... so.
>
> Nothing wrong with googling, but there's no guarantee whoever posted his
> favorite trick fully understands the problem and that whatever worked in
> his case will not have side-effects that may be quite unsuitable in your
> case.
>
> Maybe now's the time for you to start working with the complete (and
> 100% accurate) vim help and lose the Google-search habit...?
>
> Rather than start with the Vim reference manual, where non-specialists
> often find themselves overwhelmed by the sheer quantity of information
> and give up, it's probably more effective to study the Vim user manual
> one chapter at a time until you have a fair idea of vim's capabilities
> and how to put them to good use.
>
> You can access the user manual via:
>
> :help user-manual
>
> This gives you access to the user manual's table of contents.
>
> In this particular case, you will not find a 'mappings' section (this is
> why you often need to have at least skimmed through the entire manual
> beforehand to find what you are looking for), but there is a very clear
> (and authoritative) howto-style discussion of them under:
>
> |usr_40.txt| Make new commands
>
> Note that there is a very useful introduction to the way the Vim
> documentation is organized in:
>
> |usr_01.txt| About the manuals
>
> You may want to read it even before you read the introduction to
> mappings mentioned above.
>
> [...]
>
> CJ
>

Also, IMHO there are two "must read" sections, about searching the help.
First, hit the F1 key in vim or gvim and read what you find there.
Later, when you have the time, read the help chapter giving full details
of how to search the help, at :help online-help


Best regards,
Tony.
--
"My doctor told me to stop having intimate dinners for four. Unless
there are three other people."
-- Orson Welles

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Mapping shortcuts

On Mon, Oct 31, 2011 at 04:15:00PM EDT, Chris Jones wrote:

[..]

> In this particular case, you will not find a 'mappings' section (this is
> why you often need to have at least skimmed through the entire manual
> beforehand to find what you are looking for),

Actually, I take that back: a '/mapping<enter>' on the first page of the
user manual would have taken you to the detailed TOC that follows, where
the contents of each section is detailed by sub-section.

Key mapping is described in sub-section 40.1 Key mapping.

The Vim documentation is even better than I remembered.

CJ

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Mapping shortcuts

On Mon, Oct 31, 2011 at 01:06:45PM EDT, George Papanikolaou wrote:
> I know this is simple. but I can't figure it out by Googling... so.

Nothing wrong with googling, but there's no guarantee whoever posted his
favorite trick fully understands the problem and that whatever worked in
his case will not have side-effects that may be quite unsuitable in your
case.

Maybe now's the time for you to start working with the complete (and
100% accurate) vim help and lose the Google-search habit...?

Rather than start with the Vim reference manual, where non-specialists
often find themselves overwhelmed by the sheer quantity of information
and give up, it's probably more effective to study the Vim user manual
one chapter at a time until you have a fair idea of vim's capabilities
and how to put them to good use.

You can access the user manual via:

:help user-manual

This gives you access to the user manual's table of contents.

In this particular case, you will not find a 'mappings' section (this is
why you often need to have at least skimmed through the entire manual
beforehand to find what you are looking for), but there is a very clear
(and authoritative) howto-style discussion of them under:

|usr_40.txt| Make new commands

Note that there is a very useful introduction to the way the Vim
documentation is organized in:

|usr_01.txt| About the manuals

You may want to read it even before you read the introduction to
mappings mentioned above.

[...]

CJ

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Mapping shortcuts - CTRL-F for :FuF

* George Papanikolaou <g3orge.app@gmail.com> [2011-10-31 18:08]:
> How can I map a specific keyboard shortcut?
> For example, I want to press <CTRL>+F to
> trigger FuzzyFinder instead of typing :FuF

:map <c-f> :FuF<cr>

Sven

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Mapping shortcuts

On 10/31/2011 01:06 PM, George Papanikolaou wrote:
> I know this is simple. but I can't figure it out by Googling... so.
>
> How can I map a specific keyboard shortcut?
> For example, I want to press<CTRL>+F to trigger FuzzyFinder instead of typing :FuF
>
> Thank you.
>

:map <c-f> :Fuf<cr>

:help map

<cr> there means 'carriage return', i.e. Enter.

-ak

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Mapping shortcuts

I know this is simple. but I can't figure it out by Googling... so.

How can I map a specific keyboard shortcut?
For example, I want to press <CTRL>+F to trigger FuzzyFinder instead of typing :FuF

Thank you.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: open file and write current date?

On Sun, Oct 30, 2011 at 08:44:52PM -0500, Tim Chase wrote:
>
> autocmd BufRead mylog.txt sil! $put=strftime('%c')|sil! $put_ |
>startinsert


SWEEETNESSSSSSS!!
Works like a charm! Thank you!
--
Eric

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Abridged summary of vim_use@googlegroups.com - 7 Messages in 4 Topics

On 10/31/11 03:53, Niels Grundtvig Nielsen wrote:
> Can't get the full answer from Tim to open this morning ... but I'd turn to
> grep if I wanted to search across multiple files. Not quite as convenient
> as "se
>> Tim Chase<vim@tim.thechases.com> Oct 29 10:30PM -0500
>>
>> > occurrences/matches within other windows highlighted as I type
>> > within active window. Please let me know if there is a way to
>> > do this.
>>
>> I don't know of any way to get all windows to perform ...more

Given that you subject-line reads "Abridged summary", it sounds
like you need to change your settings (wherever you get your
access to vim-use) to get full posts rather than abridged
versions. Alternatively, you can google for the content of the
message and likely get a couple hits containing the full-text.

-tim

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Vim search with multiple windows open

On Oct 30, 12:50 am, John Little <john.b.lit...@gmail.com> wrote:
>
> (Aside for experts: can vimscript tell, say in a function called by a
> mapping using <ctrl-r>=, or in an <expr> mapping, what the current
> command mode is?  I mean ":", "/" or "?".  mode() just returns "c".)
>

:h getcmdtype()

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: perl: indenting references (\@arr)

Am 30.10.2011 20:34, schrieb Ronald:
> It seems as '[(){}\[\]]' finds brackets 'and' backslashes!

Yes. How it reads with spaces:
[ ( ) { } \ [ \] ]

:h /\]

| To include a literal ']', '^', '-' or '\' in the collection, put a
| backslash before it
BUT
| For '\' you can also let it be followed by
| any character that's not in "^]-\bdertnoUux".

--
Andy

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: How to edit partly folded text without it going Sproing! ?

Am 30.10.2011 12:42, schrieb Erik Christiansen:
> Folding in Vim is a paragon amongst marvels. Not even bottled beer
> competes. But I'm having a bit of bother holding my mouth right.
>
> With foldmethod=marker, and lots of closed folds lower on the screen, I
> make a new fold by appending {{{, and }}}, as appropriate. Whether I
> place the {{{ or }}} first, Vim unfolds all the following closed folds.
>
> Is there something I could (do | stop doing) to make that behaviour go
> away?
>
> Just doing zm isn't enough, because of nested folds.
>
> Erik

I use
:inorea fof <C-G>u<C-R>=&fmr<CR><Esc>F,s<CR><Up><End>

to insert fold markers.

E.g. typing "before fof<Enter>text" results in
before {{{
text
}}}

The idea is to have a mapping/abbrev that inserts {{{ and }}} at the
same time.

--
Andy

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: detect QuickFix window list or LocationList

Am 31.10.2011 12:14, schrieb stardiviner:
> I want to bind key Alt-n/p to next/previous LocationList or next/previous QuickFix list.
> So I need to detect which List in current buffer. then bind Alt-n/p to them.
> like this.
> if (detect Location or QuickFix)
> map<A-n> :cnext<CR>
> map<A-n> :cprevious<CR>
> elseif
> map<A-n> :lnext<CR>
> map<A-n> :lprevious<CR>
> endif

You could check for
empty(getloclist(0))


" Second approach: always do :lnext and if that fails, try :cnext

nnoremap <A-n> :NextError<CR>
nnoremap <A-p> :PrevError<CR>

com! -bar NextError call s:GoForError("next")
com! -bar PrevError call s:GoForError("previous")

func! s:GoForError(partcmd)
try
try
exec "l". a:partcmd
catch /:E776:/
" No location list
exec "c". a:partcmd
endtry
catch
echohl ErrorMsg
echomsg matchstr(v:exception, ':\zs.*')
echohl None
endtry
endfunc

--
Andy

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: detect QuickFix window list or LocationList

On 10/31/11 06:14, stardiviner wrote:
> I want to bind key Alt-n/p to next/previous LocationList or next/previous QuickFix list.
> So I need to detect which List in current buffer. then bind Alt-n/p to them.
> like this.
> if (detect Location or QuickFix)
> map<A-n> :cnext<CR>
> map<A-n> :cprevious<CR>
> elseif
> map<A-n> :lnext<CR>
> map<A-n> :lprevious<CR>
> endif

(I presume those 2nd mappings should be <A-p> to prevent
overwriting the previous mapping...)

A rough (untested) pair of mappings might look something like

:nnoremap <expr> <A-n> (&buftype=='quickfix'?':cn':':lnext')."\n"

:nnoremap <expr> <A-p> (&buftype=='quickfix'?':cp':':lprev')."\n"


Adjust accordingly for your intent regarding the logic. It might
end up looking something like


':'.((&buftype=='quickfix'?'cn':(&buftype=='location'?'lnext':'n'))."\n"

to treat all 3 cases (qf, loc, and other).

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

detect QuickFix window list or LocationList

I want to bind key Alt-n/p to next/previous LocationList or next/previous QuickFix list.
So I need to detect which List in current buffer. then bind Alt-n/p to them.
like this.
if (detect Location or QuickFix)
map <A-n> :cnext<CR>
map <A-n> :cprevious<CR>
elseif
map <A-n> :lnext<CR>
map <A-n> :lprevious<CR>
endif

--
stardiviner GPG: 5D9F64D8 Twitter: @numbchild
http://stardiviner.dyndns-blog.com/author.html

Re: How to edit partly folded text without it going Sproing! ?

On 30.10.11 17:07, Paul wrote:
> " Don't screw up folds when inserting text that might affect them, until
> " leaving insert mode. Foldmethod is local to the window. Protect against
> " screwing up folding when switching between windows.
> autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif
> autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif

Ooooh yes, many thanks Paul. (And Ben, for the link.)

That does the trick, just Vimderfully!

Erik

--
My grandmother currently runs ubuntu. This was not my doing, but she managed
to wipe her windows and install it accidentally when someone handed her the
live CD to deal with a windows problem she was having. The computer asked
her to do things. So she did. - Seen on luv-main, in slightly longer form.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Abridged summary of vim_use@googlegroups.com - 7 Messages in 4 Topics

... (hm: what happened there, I wonder; and no Edit option) ... search in open files, but might help.

On Mon, Oct 31, 2011 at 9:53 AM, Niels Grundtvig Nielsen <communicator.ngn@gmail.com> wrote:
Can't get the full answer from Tim to open this morning ... but I'd turn to grep if I wanted to search across multiple files. Not quite as convenient as "se


On Sun, Oct 30, 2011 at 6:45 AM, <vim_use@googlegroups.com> wrote:

Group: http://groups.google.com/group/vim_use/topics

    Tim Chase <vim@tim.thechases.com> Oct 29 10:30PM -0500  

    > occurrences/matches within other windows highlighted as I type
    > within active window. Please let me know if there is a way to
    > do this.
     
    I don't know of any way to get all windows to perform ...more
    Taylor Hedberg <tmhedberg@gmail.com> Oct 29 04:06AM -0400  

    I assume that not every function in the headers is called "AFunction"
    with void return type, so this is a little more liberal than precisely
    what you stated. It will apply to any line that has some ...more
    Totte Karlsson <tottek@gmail.com> Oct 29 02:26PM -0700  

    On 10/29/2011 1:06 AM, Taylor Hedberg wrote:
    > followed by one or more words (the return type, including '*' for
    > pointer types), followed by a function name and its argument list.
    ...more
    Taylor Hedberg <tmhedberg@gmail.com> Oct 29 08:22PM -0400  

    > instead of all the tabs, position the "last" part on say position 49
    > on the line? This because, sometimes the first token(s) is really
    > long, causing something like the following:
    ...more
    Linda W <vim@tlinx.org> Oct 29 01:57PM -0700  

    Tony Mechelynck wrote:
     
    > filesystems. I was the one who mentioned symlinks, I mentioned them in
    > the context of double-boot, not of Cygwin, and I explicitly mentioned
    > ext2, ext3, ext4 and ...more
    Tony Mechelynck <antoine.mechelynck@gmail.com> Oct 29 08:26AM +0200  

    On 29/10/11 03:47, Justin Lafferty wrote:
     
    > Through editing out the different options I have boiled the problem down
    > to the filetype plugin on. And was wondering if anyone knows a fix for ...more

You received this message because you are subscribed to the Google Group vim_use.
You can post via email.
To unsubscribe from this group, send an empty message.
For more options, visit this group.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Abridged summary of vim_use@googlegroups.com - 7 Messages in 4 Topics

Can't get the full answer from Tim to open this morning ... but I'd turn to grep if I wanted to search across multiple files. Not quite as convenient as "se

On Sun, Oct 30, 2011 at 6:45 AM, <vim_use@googlegroups.com> wrote:

Group: http://groups.google.com/group/vim_use/topics

    Tim Chase <vim@tim.thechases.com> Oct 29 10:30PM -0500  

    > occurrences/matches within other windows highlighted as I type
    > within active window. Please let me know if there is a way to
    > do this.
     
    I don't know of any way to get all windows to perform ...more
    Taylor Hedberg <tmhedberg@gmail.com> Oct 29 04:06AM -0400  

    I assume that not every function in the headers is called "AFunction"
    with void return type, so this is a little more liberal than precisely
    what you stated. It will apply to any line that has some ...more
    Totte Karlsson <tottek@gmail.com> Oct 29 02:26PM -0700  

    On 10/29/2011 1:06 AM, Taylor Hedberg wrote:
    > followed by one or more words (the return type, including '*' for
    > pointer types), followed by a function name and its argument list.
    ...more
    Taylor Hedberg <tmhedberg@gmail.com> Oct 29 08:22PM -0400  

    > instead of all the tabs, position the "last" part on say position 49
    > on the line? This because, sometimes the first token(s) is really
    > long, causing something like the following:
    ...more
    Linda W <vim@tlinx.org> Oct 29 01:57PM -0700  

    Tony Mechelynck wrote:
     
    > filesystems. I was the one who mentioned symlinks, I mentioned them in
    > the context of double-boot, not of Cygwin, and I explicitly mentioned
    > ext2, ext3, ext4 and ...more
    Tony Mechelynck <antoine.mechelynck@gmail.com> Oct 29 08:26AM +0200  

    On 29/10/11 03:47, Justin Lafferty wrote:
     
    > Through editing out the different options I have boiled the problem down
    > to the filetype plugin on. And was wondering if anyone knows a fix for ...more

You received this message because you are subscribed to the Google Group vim_use.
You can post via email.
To unsubscribe from this group, send an empty message.
For more options, visit this group.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Sunday, October 30, 2011

Re: How to edit partly folded text without it going Sproing! ?

On Oct 30, 12:07 pm, Paul <google01...@rainslide.net> wrote:
> On Sunday, 30 October, 2011 at 11:42:22 GMT, Erik Christiansen wrote:
> >With foldmethod=marker, and lots of closed folds lower on the screen, I
> >make a new fold by appending {{{, and }}}, as appropriate. Whether I
> >place the {{{ or }}} first, Vim unfolds all the following closed folds.
>
> >Is there something I could (do | stop doing) to make that behaviour go
> >away?
>
> I have the following in my vimrc. I got it from this list, I think. Apologies for losing credit to whomever first posted it.
>
> " Don't screw up folds when inserting text that might affect them, until
> " leaving insert mode. Foldmethod is local to the window. Protect against
> " screwing up folding when switching between windows.
> autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod |   setlocal foldmethod=manual | endif
> autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:   last_fdm | unlet w:last_fdm | endif
>

It may have been from here:

http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text

"Sproing". Good description :-)

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: open file and write current date?

On 10/27/11 18:33, Eric Maquiling wrote:
> Hi all,

I don't recall seeing a reply to this and it's been a couple days
so I'll take a rough stab at it

> vim + filename (will take me to end of the file)
> then add the current date/time (I already have iab for the current date/time
> from Guckes site)
> ..and then start to edit below that line.

You might try something like

autocmd BufRead mylog.txt sil! $put=strftime('%c')|sil! $put_
| startinsert

(all on one line) in your vimrc file. This will, upon reading in
a file named "mylog.txt" (any filename/glob will do), go to the
bottom of the file, insert the date in whatever format you choose
(I used "%c" as a default, adjust as you see fit), then put a
blank line, and start insert-mode. The "sil!" entries are there
to prevent it from verbosely telling you about the added lines.

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

perl: indenting references (\@arr)

perl-code containing references intends stange.
For example:

<code>
while ($ok) {
if ($tbs) {
&show("step 1", \@arr, [24,60,60]);
&show("step 1", \@arr, [24,60,60]);
&show("step 1", \@arr, [24,60,60]);
&show("step 1", \@arr, [24,60,60]);
&show("step 1", \@arr, [24,60,60]);
&show("step 1", \@arr, [24,60,60]);
}
}
</code>

in /usr/share/vim/vim73/indent/perl.vim
I found 2 lines:
<code>
let bracepos = match(line, '[(){}\[\]]', match...
</code>
It seems as '[(){}\[\]]' finds brackets 'and' backslashes!

So I replaced these 2 lines with
<code>
let bracepos = BracePos(line, match...
</code>
and wrote a new function
<code>
" get position of () {} []
function! BracePos(line, start)
let l:min = strlen(a:line)+1

for l:char in split('(){}[]', '\zs')
let l:pos = match(a:line, l:char, a:start)
if l:pos >= 0
let l:min = min([l:min, l:pos])
endif
endfor

if l:min == strlen(a:line)+1
let l:min = -1
endif

return l:min
endfunction
</code>

Now it works fine.

I had checked it on my perl programs and it works for me.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: How to edit partly folded text without it going Sproing! ?

On Sunday, 30 October, 2011 at 11:42:22 GMT, Erik Christiansen wrote:
>With foldmethod=marker, and lots of closed folds lower on the screen, I
>make a new fold by appending {{{, and }}}, as appropriate. Whether I
>place the {{{ or }}} first, Vim unfolds all the following closed folds.
>
>Is there something I could (do | stop doing) to make that behaviour go
>away?

I have the following in my vimrc. I got it from this list, I think. Apologies for losing credit to whomever first posted it.

" Don't screw up folds when inserting text that might affect them, until
" leaving insert mode. Foldmethod is local to the window. Protect against
" screwing up folding when switching between windows.
autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif
autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w: last_fdm | unlet w:last_fdm | endif

--

.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: How to edit partly folded text without it going Sproing! ?

On 30.10.11 12:59, Marcin Szamotulski wrote:
> On 22:42 Sun 30 Oct , Erik Christiansen wrote:
> > With foldmethod=marker, and lots of closed folds lower on the screen, I
> > make a new fold by appending {{{, and }}}, as appropriate. Whether I
> > place the {{{ or }}} first, Vim unfolds all the following closed folds.

> What about first putting the ending marker }}} and after that placing the
> beginning marker {{{ above it.

Yes, that does refold following folds on entering {{{, after
spontaneously opening them on entering }}}.

Thankyou. A temporary foof of unfolding is much better than a persistent
one. :-)

Erik

--
Arrgh. I just found a Google search result of somebody who was
experiencing exactly the same problem as me, only to find it was me :-(.
- Read on luv-talk ML.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: How to edit partly folded text without it going Sproing! ?

On 22:42 Sun 30 Oct , Erik Christiansen wrote:
> Folding in Vim is a paragon amongst marvels. Not even bottled beer
> competes. But I'm having a bit of bother holding my mouth right.
>
> With foldmethod=marker, and lots of closed folds lower on the screen, I
> make a new fold by appending {{{, and }}}, as appropriate. Whether I
> place the {{{ or }}} first, Vim unfolds all the following closed folds.
>
> Is there something I could (do | stop doing) to make that behaviour go
> away?
>
> Just doing zm isn't enough, because of nested folds.
>
> Erik
>
> --
> My grandmother currently runs ubuntu. This was not my doing, but she managed
> to wipe her windows and install it accidentally when someone handed her the
> live CD to deal with a windows problem she was having. The computer asked
> her to do things. So she did. - Seen on luv-main, in slightly longer form.
>
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php

Hi,

What about first putting the ending marker }}} and after that placing the
beginning marker {{{ above it.

Best,
Marcin

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

How to edit partly folded text without it going Sproing! ?

Folding in Vim is a paragon amongst marvels. Not even bottled beer
competes. But I'm having a bit of bother holding my mouth right.

With foldmethod=marker, and lots of closed folds lower on the screen, I
make a new fold by appending {{{, and }}}, as appropriate. Whether I
place the {{{ or }}} first, Vim unfolds all the following closed folds.

Is there something I could (do | stop doing) to make that behaviour go
away?

Just doing zm isn't enough, because of nested folds.

Erik

--
My grandmother currently runs ubuntu. This was not my doing, but she managed
to wipe her windows and install it accidentally when someone handed her the
live CD to deal with a windows problem she was having. The computer asked
her to do things. So she did. - Seen on luv-main, in slightly longer form.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Moving toward a unified Vim...

Linda W wrote:
> Tony Mechelynck wrote:
>
>> On 28/10/11 22:26, Linda W wrote: [...]
>>> If you put a symlink on linux, windows will see it as a hardlink.
>>> That means any file copies will go through it.
>> [...]
>>
>> If you set a symlink on a Linux (ext2, ext3, ext4, reiser, etc.)
>> filesystem, Windows won't see it at all because it cannot read those
>> filesystems. I was the one who mentioned symlinks, I mentioned them
>> in the context of double-boot, not of Cygwin, and I explicitly
>> mentioned ext2, ext3, ext4 and reiser filesystems. So who's
>> distorting whose words?
>
> ---- I'm not distorting anyone's words.
>
> I'm replying about things I've tried that don't work.
==== Seeing as how I explained, *in depth*, how you were mistaken, just
like every other argument against my case -- (except for one, which
informed, me, and I adapted my solution to fit the new
information...)...

So I adapted my solution to the only real problem, and no one came
up with any reason why my solution wouldn't work (or the kept claiming I
said something OTHER than what I said -- which after the 3-4th time,
started to get me a bit miffed. And then suddenly I was the bad person
for having to repeat myself for the 3rd or 4th time to someone who just
quoted the correct version of what I said but were claiming in their
response that I said something else.

But it seems once that became clear, there were no more objections
or claims of incompatibility. There's always claims that things were
done some way in the past...but that's true about every piece of
software that has ever existed. That hasn't stopped new
versions/standards of C, Perl, shell, linux, Windows...I don't know of
any software that still is viable to the user community that doesn't
grow and change.

So does anyone want to take the unenviable position of why Vim should
stay stuck with 1980's standards when the rest of the world has moved
on?

It wasn't until Vim6, that Vim even realized that HOME had been yanked
out from underneath them, -- the rest of the world moved on.

now believe me -- I've been on the other side of these issues often as
well. Take a look at the bash archives from about a month or two ago
where the behavior of bash broken longstanding scripts.

BUT THERE...it did so for NO good reason. No one used the old feature
cuz they thought it was broken! -- turns out it wasn't so broken, and it
had been usable, so it was made broken in 4.1. to follow the new POSIX
spec, which, is incompatible with the old posix spec. Except that the
feature/mode we are talking about was about bash's NON-POSIX,
"user-friendly mode"....so there was NO reason, even following a broken
standard to have changed it. (change was made to "-e" option to exit
on any non-zero status from any simple or complex command whereas
before, it was to detect any non-zero exist from specifically, *simple
commands*, that weren't error checked, but by including complex
commands, this meant that calculations (let a=b-b), would cause an fatal
error exist because it calculations return the 'not' of their final
calculation thus the calculation ((0)) would return '1' (false),

That and another arbitrary change was made that made all function call
no longer take the same return params that 'exit' would return (despite
a functions return is supposed to be equivalent to a program's exist
code).

Thy are reversing that decision, and the jury is still out as to whether
or not he's going to break 14 years of posix compliance to go with the
new and improved standard that isn't compatible with the old (in an area
of bash that is an extension and not even covered under posix!)...

So I'm not someone to just for every change, and fight against stupid
changes, but you have to be willing to weight the cost of a change
versus the overall benefit .. not just against the inconvenience of a
single user. When you see MANY users coming up with hacks and
workarounds to get around design decisions that once were valid, but now
be costing people more time and effort to work around than it's worth to
keep ith those decisions -- at that point, it's time to be
**practical**, and go with what's going to cause the least effort for
ongoing maintenance and future people's usage.

That doesn't mean there might not be a one time conversion 'pain' to
some new format, but if the payoff is much greater down the line --
that's what you have to keep your keys on... Not peoples immediate
gratification or pain levels.

This isn't an issue I've brought up for the first time. It isn't an
issue I just started dealing with.

I've been dealing with cross-platform .vim files and .bash/.profile
programs since the 80's. Getting Xenix and HP/UX to be compat with
SunOS/SGI/and dos-unix-shell work-alikes. I've had more than 2 decade
of experience working around these things. But I recognize when a
design that might have been right at one point in time, now is well past
the time of needing to be changed.

People need to realize. Designs of software are NOT cut in Stone. As
long as Bran maintains a vi-compat mode, he's doing his bit to
maintain core compat with required standards. But software was designed
to be able to be flexibly improved as needs and standards changed.

But I wish you'd stop arguing against all change.

There are basic text editing functions I can't do in vim in fixed with
fonts, that I can do in a web'browser text box because Vim is stuck
using some old DOS era text boxmodel.

Simple adopting a new display library would open the new features...but
I'm sure I've talked this point to death, unless anyone sees any other
problems with my proposals (other than them coming from me!)... (I know
that's a fairly negative point that kills alot of my proposals due to my
scintillating personality... *cough*....*ahem*...I'm only trying to do
what's best for the most...)... and I'll change my stance on something
mid-stream given new information that requires change -- just as I did
in this discussion. I'm not 'stuck in one position. I'll adapt to
realities brought to my attention that need attention (and did).

My persuasive style sucks (thanks you mom and dad for rasing me with
socratic method!)...but I do try to get a pretty wide perspective.


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Saturday, October 29, 2011

Re: Vim search with multiple windows open

> What I am looking for is to have all occurrences/matches within other windows highlighted as I type within active window.
> Please let me know if there is a way to do this.

Well, I found a way with mappings, but terribly ugly and breaks so
much I'm too ashamed to relate it.

How about, as a half measure, with

:set cpo+=x hlsearch
:cmap <f4> <esc>N/<up>

so while typing your search, press f4 to have the search so far
highlighted by the hlsearch mechanism?
It has side effects, doesn't work well with ? searches, and I'm sure
has other glitches.

(Aside for experts: can vimscript tell, say in a function called by a
mapping using <ctrl-r>=, or in an <expr> mapping, what the current
command mode is? I mean ":", "/" or "?". mode() just returns "c".)

Regards, John

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Vim search with multiple windows open

> My Vim session usually have few vertical/horizantal windows
> open. Often I do a search within one window and since
> incsearch is set, screen scrolls down to first match and is
> highlighted. What I am looking for is to have all
> occurrences/matches within other windows highlighted as I type
> within active window. Please let me know if there is a way to
> do this.

I don't know of any way to get all windows to perform an
incsearch in the same way that happens in a single window. From
what I read at ":help 'scrollbind'", I suspect that it's not
something readily possible because each character not only has to
search the current buffer, but all other visible buffers, and it
will timeout after about 0.5sec to keep Vim responsive to your
typing (assuming it was built with +reltime).

However, once the search is completed, setting 'hls' should
highlight the match in all the windows. If the window-content is
similar, you can also try setting 'scrollbind', though that may
be tangential to your question.

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Vim search with multiple windows open

I appreciate it if any help with this question.


From: hilal Adam <hilaldm@yahoo.com>
To: "vim@vim.org" <vim@vim.org>
Sent: Wednesday, October 26, 2011 9:57 PM
Subject: Vim search with multiple windows open

Hi,

Hope someone could help with this.
My Vim session usually have few vertical/horizantal windows open. Often I do a search within one window and since incsearch is set, screen scrolls down to first match and is highlighted. What I am looking for is to have all occurrences/matches within other windows highlighted as I type within active window.
Please let me know if there is a way to do this.

Thanks
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: Formatting C++ files

Totte Karlsson, Sat 2011-10-29 @ 14:26:45-0700:
> That is great! It "kind" of works. One question. Would it be possible
> instead of all the tabs, position the "last" part on say position 49
> on the line? This because, sometimes the first token(s) is really
> long, causing something like the following:

Sure, anything is possible if you write a complicated enough expression!
:)

:%s/\v^\s+([a-zA-Z_* %]+)\s+(\*?)(\s*\w+\(.*\);)$/\="\t\t".submatch(1).submatch(2).repeat(' ',49-(2*&ts+len(submatch(1))+len(submatch(2)))).submatch(3)

This puts 2 tabs at the beginning of the line, followed by the return
type, then pads with spaces out to column 49, then finishes with the
function name and argument list.

If you plan on reusing this command with any regularity, it would
probably make sense to define a custom command so you can easily repeat
it. Because let's face it, the above is not something you really want to
type more than once!

If you add the following lines to your .vimrc, you can then just use
`:FormatPrototypes` to perform this operation in the current buffer:

command! FormatPrototypes
\ %substitute/\v^\s+([a-zA-Z_* ]+)\s+(\*?)(\s*\w+\(.*\);)$/\=
\ "\t\t" . submatch(1) . submatch(2) .
\ repeat(' ', 49 - (2 * &tabstop + len(submatch(1)) + len(submatch(2)))) .
\ submatch(3)

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Formatting C++ files

On 10/29/2011 1:06 AM, Taylor Hedberg wrote:
> I assume that not every function in the headers is called "AFunction"
> with void return type, so this is a little more liberal than precisely
> what you stated. It will apply to any line that has some whitespace,
> followed by one or more words (the return type, including '*' for
> pointer types), followed by a function name and its argument list.
>
> :%s/\v^\s+([a-zA-Z_* ]+)\s+(\*?)(\s*\w+\(.*\);)$/\t\t\1\2\t\t\t\t\t\t\t\t\3/
>
That is great! It "kind" of works.
One question. Would it be possible instead of all the tabs, position the "last"
part on say position 49 on the line? This because, sometimes the first token(s)
is really long, causing something like the following:

mtkVirtualHole* GetVirtualBond(const int& i);
void DeleteVirtualBond();

where desired result is
mtkVirtualHole* GetVirtualBond(const int& i);
void DeleteVirtualBond();
(used fewer tabs here for simplicity)


-totte


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Please fix: make Windows Vim use same files as unix. No reason not to and it's confusing in mixed envirionments.

Tony Mechelynck wrote:

> On 28/10/11 22:26, Linda W wrote:
> [...]
>> If you put a symlink on linux, windows will see it as a hardlink. That
>> means any file copies will
>> go through it.
> [...]
>
> If you set a symlink on a Linux (ext2, ext3, ext4, reiser, etc.)
> filesystem, Windows won't see it at all because it cannot read those
> filesystems. I was the one who mentioned symlinks, I mentioned them in
> the context of double-boot, not of Cygwin, and I explicitly mentioned
> ext2, ext3, ext4 and reiser filesystems. So who's distorting whose words?

----
I'm not distorting anyone's words.

I'm replying about things I've tried that don't work.

Various people (besides you) mentioned some sort of link either
on linux or on windows (both have types of symlinks, both have hardlinks).

Worse, Windows also has "explorer-only symlinks", (.lnk), which cygwin
calls "symlinks" [sic] and will create if you turn on 'winsymlinks',
instead the actual windows symlinks available in win7 (which do get
dumped and restored properly to a linux disk, but are plain files on a
linux disk containing 'SYMLINKD (I think the D is for Dirs) followed
by binary pointer data), BUT aren't usable if you have the dir mounted
as a NW file system...

I.e. I was saying there are no types of links that will work
for what people think they will . Most win32 progs will only
follow the new 'symlinks (or their older counterparts, 'junctions'/
reparse points.). Very few will follow the special .lnk's that are
created by explorer and cygwin's 'compatible'[sic] mode. None will
follow cygwin's symlinks, and none of those will propagate across a
network and work across a network.

So to all the people I didn't respond to who suggested
various forms of links...it's because, if you don't understand all the
different types of links across explorer-word, NTworld, unix world, cygwin
world, and how they all look and survive across a copy from one to the
other and how they look when mounted on a network fileshare, you can't
begin to understand a solution involving links.

Some where claiming they'd offered a solution, whey they just
didn't understand the problem. I'm way past that point. Changing a file
to be 'custom' to work around this problem won't work either, because
windows resets and loses some files, but the files will still exist as
".vim" on the network mount -- and that still gets copied back and forth
(part of the time/most of the time) on synching a profile). But none of
the solutions work with a 'fresh' version of vim when it falls into place
and can't pick up needed files by looking in standard locations because
they look for things in different orders under different names -- and they
can't be linked together because of the various reasons described above.

Which means they always end up being separete copies that end up needing
to be changed in about 8-10 different places...all to get around
some crap standard that was implemented for MSDOS. That people are
against updating for newer OS's that don't have the same features (or
limitations).

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Formatting C++ files

I assume that not every function in the headers is called "AFunction"
with void return type, so this is a little more liberal than precisely
what you stated. It will apply to any line that has some whitespace,
followed by one or more words (the return type, including '*' for
pointer types), followed by a function name and its argument list.

:%s/\v^\s+([a-zA-Z_* ]+)\s+(\*?)(\s*\w+\(.*\);)$/\t\t\1\2\t\t\t\t\t\t\t\t\3/

It's perhaps a little more complex than it needs to be, because it
handles cases where you might have something like this:

int *my_function();

where the '*' is considered part of the return type, not the function
name, and you would presumably want it separated from the function name
when you convert the whitespace.

There may be corner cases in your header files that I didn't think of,
so if this doesn't apply to any of the lines that you need converted,
then you may need to tweak it. Or you can post the problematic lines
here and we can give you additional help.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Friday, October 28, 2011

Re: Filetype error

On 29/10/11 03:47, Justin Lafferty wrote:
> For the longest of times my .vimrc has looked as follows:
>
> "Because some options may not be vi compatible
> set nocompatible
>
> "Turns on filetype plugins
> filetype plugin on
> filetype indent on
>
> "Ignore case when searching
> set ignorecase
> set smartcase
>
> "Highlight searches
> set hlsearch
>
> "Toggles the highliting off with ctrl+n
> :map <silent> <C-n> :set invhlsearch<CR>
>
> "Shows matches as they are found
> set incsearch
>
> "Remove trailing whitespace
> autocmd FileType c,cpp,java,php,js,python,ruby autocmd BufWritePre
> <buffer> :call
> setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
>
> "use spaces instead of tab
> set expandtab
> set smarttab
>
> "Changes tab amount
> set shiftwidth=4
> set softtabstop=4
>
> "Maps jj to esc for faster exit of insert modes
> imap jj <Esc>
>
> "Turns on syntax coloring
> syntax on
>
> "Enable line numbers
> set number
> set numberwidth=3
>
> "Normal backspace operation
> set backspace=indent,eol,start
>
> But now for some reason whenever I type the comment character for the
> particular language I am using, the character is repeated on the next
> line. For example if i am editing test.cpp if i type:
>
> //Comment
>
> Then press enter the file now looks as follows:
> //Comment
> //
>
> Through editing out the different options I have boiled the problem down
> to the filetype plugin on. And was wondering if anyone knows a fix for
> this. And if it helps, my .vim/ftplugin directory is empty.

It is not an error, or as the saying goes, "T'aint a bug, it's a
feature". IIUC many standard ftplugins have long set formatoptions+=ro —
of course, when you create a [NoName] file it still has no filetype
(even if you give the file a name without reloading it) and therefore no
ftplugin has set anything special for it. As soon as you name it _and_
reload it, the ftplugins apply.

See
:help 'formatoptions'
:help fo-table

- Flag r means: Automatically insert the current comment leader after
hitting <Enter> in Insert mode.
- Flag o means: Automatically insert the current comment leader after
hitting 'o' or 'O' in Normal mode.

To avoid these in C and C++ files, add the following two-line file as
$HOME/.vim/after/ftplugin/c.vim (for Unix, Linux or Mac OS X) or
$HOME/vimfiles/after/ftplugin/c.vim (in Vim notation, for Windows):

" disable comment leader insertion
setlocal fo-=r fo-=o

(the C++ ftplugin does nothing other than invoke the C ftplugin). If the
directories don't yet exist, create them too.

The above is "per-filetype" (with the exception that the C ftplugin is
also used for C++), so if you want the same for, let's say, javascript
and CSS (which have similar comment structures as C and C++), you'll
have to drop copies of the same file as javascript.vim and css.vim in
the same directory: you get the drift. For a blanket disable, you may
use instead

autocmd FileType * setlocal fo-=r fo-=o

which must be placed _after_ "filetype plugin on" in your .vimrc or
_vimrc in order to have an effect; *but* if at any time you use
":filetype plugin off" followed by ":filetype plugin on" this
autocommand will lose its effect, which is not the case of the scripts
in .../after/ftplugin/.

See also the following recent threads on vim_use:
- Permanent disable comment next line
(about 'formatoptions' flags r and o)
- Please fix: make Windows Vim use same files as unix. No reason not to
and it's confusing in mixed envirionments.
(started as: Can't get vim to use custom color in personal folder(finds
.vimrc/.gvimrc but not .vim/colors/name.vim) )
(about ~/vimfiles/ vs. ~/.vim/)


Best regards,
Tony.
--
Blessed are the meek for they shall inhibit the earth.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Filetype error

For the longest of times my .vimrc has looked as follows:

"Because some options may not be vi compatible
set nocompatible

"Turns on filetype plugins
filetype plugin on
filetype indent on

"Ignore case when searching
set ignorecase
set smartcase

"Highlight searches
set hlsearch

"Toggles the highliting off with ctrl+n
:map <silent> <C-n> :set invhlsearch<CR>

"Shows matches as they are found
set incsearch

"Remove trailing whitespace
autocmd FileType c,cpp,java,php,js,python,ruby autocmd BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))

"use spaces instead of tab
set expandtab
set smarttab

"Changes tab amount
set shiftwidth=4
set softtabstop=4

"Maps jj to esc for faster exit of insert modes 
imap jj <Esc>

"Turns on syntax coloring
syntax on

"Enable line numbers
set number
set numberwidth=3

"Normal backspace operation
set backspace=indent,eol,start

But now for some reason whenever I type the comment character for the particular language I am using, the character is repeated on the next line.  For example if i am editing test.cpp if i type:

//Comment

Then press enter the file now looks as follows:
//Comment
//

Through editing out the different options I have boiled the problem down to the filetype plugin on.  And was wondering if anyone knows a fix for this.  And if it helps, my .vim/ftplugin directory is empty.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Formatting C++ files

Hi,
I am going trough many C++ headers and need to do some formatting.

The first I need to do is related to C++ headers:

a lot of them look has lines like this

<some white space>void<some white space>AFunction();

where the <some whitespace> is just some whitespace.

that I need to convert to a more fixed and defined format:
<two tabs>void<8 tabs>AFunction(); or

<8 spaces>void<32 spaces>AFuntion();

I wonder how do I create a substitute expression for the above?

cheers,
Totte


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Turning on the right line numbering when needed

On Oct 28, 1:51 pm, AK <andrei....@gmail.com> wrote:
> On 10/28/2011 02:43 PM, George V. Reilly wrote:
>
>
>
> > You know what'd really make a difference for relative line numbering?
> > If the current line's number was its absolute line number, instead of
> > "0". Yes, I can see the absolute line number down in the ruler, but
> > that's often far removed from the current line and I have to move my
> > eyes down to the ruler, then back to the current line. "0" conveys
> > little information. The absolute line number is more useful. It should
> > be in a highlighted color to make it blatantly clear that it's
> > different.
>
> I have to disagree, at least for me, absolute line number is not
> something I need that often. Absolute line number would need an
> extra column or two. I have relative line numbers column set to
> 3 - 2 digits and one column of padding (which looks like it's not
> possible to remove?)
>

I don't need it that often either, but I had a sudden realization one
day, that pretty much the only times I DO need them, is when I'm
referring to code open in Vim while writing emails, problem reports,
and the like. So I put this gem in my .vimrc to automatically give me
absolute numbers only when I need them most often: when Vim doesn't
have focus.

if exists('+relativenumber')
" when Vim no longer has focus, relative line numbers are not
useful,
" although absolute numbers are
autocmd FocusLost * let s:FL_winnr = winnr() |
\ exec 'windo
\ if &ft !~ "txt" && &buftype=="" |
\ let w:nu_sav = &nu | let w:rnu_sav = &rnu | setl nu
|
\ endif' |
\ exec s:FL_winnr.'wincmd w' | unlet s:FL_winnr
autocmd FocusGained * let s:FL_winnr = winnr() |
\ exec 'windo if exists("w:nu_sav") |
\ let &l:nu = w:nu_sav |
\ unlet w:nu_sav |
\ endif |
\ if exists("w:rnu_sav") |
\ let &l:rnu = w:rnu_sav |
\ unlet w:rnu_sav |
\ endif' |
\ exec s:FL_winnr.'wincmd w' | unlet s:FL_winnr
endif

Incidentally, it was an earlier version of this which led to my
discovery that system() calls on Windows get FocusGained, but not
FocusLost. But that's even further off-topic than this discussion of
relative line numbering.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: how to make 'h,j,k,l' faster ?

On Fri, Oct 28, 2011 at 12:23 PM, Tim Chase <vim@tim.thechases.com> wrote:
> On 10/28/11 10:21, Ben Fritz wrote:
>>
>> I find it very nice to set relative line numbers and use a count with
>> j/k for down/up movement.
>
> I know about them head-wise, and you're right about it being easier than
> keying in the absolute line#, but it's a more recent feature of vim which
> hasn't yet made it to my muscle-memory (or more importantly, my vimrc :)
>

Here's something to make it easier:

if exists('+relativenumber')
let g:loaded_RltvNmbrPlugin='skip'
nnoremap <expr> <C-Space> CycleLNum()
xnoremap <expr> <C-Space> CycleLNum()
onoremap <expr> <C-Space> CycleLNum()

" function to cycle between normal, relative, and no line numbering
func! CycleLNum()
if &l:rnu
setlocal nu
elseif &l:nu
setlocal nonu
else
setlocal rnu
endif
" sometimes (like in op-pending mode) the redraw doesn't happen
" automatically
redraw
" do nothing, even in op-pending mode
return ""
endfunc
endif

This is really fun because you can cycle line numbers, relative line
numbers, and no line numbers even in op-pending mode. I sometimes do
this:

d
(Whoops, no line numbers! How many lines do I need?)
<C-Space>
6j

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Please fix: make Windows Vim use same files as unix. No reason not to and it's confusing in mixed envirionments.

On 28/10/11 22:26, Linda W wrote:
[...]
> If you put a symlink on linux, windows will see it as a hardlink. That
> means any file copies will
> go through it.
[...]

If you set a symlink on a Linux (ext2, ext3, ext4, reiser, etc.)
filesystem, Windows won't see it at all because it cannot read those
filesystems. I was the one who mentioned symlinks, I mentioned them in
the context of double-boot, not of Cygwin, and I explicitly mentioned
ext2, ext3, ext4 and reiser filesystems. So who's distorting whose words?


Regards,
Tony.
--
"We'll cross out that bridge when we come back to it later."

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Please fix: make Windows Vim use same files as unix. No reason not to and it's confusing in mixed envirionments.

` Ben Fritz wrote:

> Linda, you cannot expect anyone to listen to you if you keep insulting
> us. Take you anger and personal attacks to a blog or something if you
> want to insist on being so confrontational.
>


----
Insulting...I used a word 'ignoramus' once, That's the only insult
I consciously
used because the write claimed I said 'x', when right above where he
wrote that,
he quoted me and that's NOT what it said.

I think that was um...rather 'light' as far as insults go...
seriously...so chill.

> You have been told specific reason why your idea is a bad one.I

I've been told why someone *thinks* it is bad. and I responded on how
to get around
the problem. So far, no one seems interested in solving the problem --
only defending
the broken status quo. Am I wrong? Who else here is interested in
solving the problem
so 100 of 1000's of vim users past and future won't have to write odd
and quirky code
to check for different paths on every vim they go that are all incompat
and **attempt***
to use links -- problem is that links cause problems with windows
interacting with linux/unix.


They aren't stable and safe.

If you put a symlink on linux, windows will see it as a hardlink. That
means any file copies will
go through it.

I have 2 user-profiles on my system 1-local and 1 domain. There
are some things
(most things) that I want to share between them. BOTH of them are
roaming profiles...

Adobe, for example puts their help text in the users local roaming
profile -- all 2.2GB of it.
This means it gets stored into each user's roaming profile.
Syncrhonized on login/logoff.

Just trying to safe disk space and use only 1 shared copy -- it still
will reference the login's
profile through the symlinks and have seen it go both ways .. my "local
copy" of adobe, being
read through my domain-profile's link as a 'domain copy' (which it
shouldn't do,l but I've seen it
happen), then written through a soft link (I no longer have such, after
I saw this behavior!)... to
the roaming profile of the local account ... i.e. overwriting the other
accounts values.

My roaming profiles end up getting copied from SERVER\home ->
C:\users\me, but depending on
whether or not I launch gvim from the shell in cygwin (in which case
home will be SERVER\home),
or from explorer, in which case home will be C:\users\me, **IF** I had
to be logged in with a 'saved'
copy of my profile, OR it will be "i:\", if it logged me in with my real
profile -- even though it still
will have copied my profile to C:\users\me, -- drive i:\ is the same dir
as SERVER\home which is
also the same dir that that the profile gets copied "to" and "from"...

Links in my home dir don't last long I start out with links from
vimfiles->.vim, then end up soem sync
with 2 separate copies...then I make changes in .vim, thinking that's
all I need to do...and it will be picked up by my cygwin vim, my win-vim
on both of my accounts on 2 different computers. -- they are
all windows accounts trying to share the same settings that have the
glue keep coming
Unglued....and it reverts to making copies of vimfiles at some point (or
just removing/losing the link
altogether.)... So if I never had a softlink or link from
vimfiles->.vim, there would be no copies
made, and things would just work.


> It will
> change Vim to act in ways that existing documentation (within Vim,
> within published books, and on the internet) does not reflect, current
> users will not expect, and will do unexpected things on systems with
> both .vim and vimfiles.
>


---
Every product has stuff published about it...there are books about
Bind version 5 and
perl 4 out there... But bind is up to version 8 or 9 now, and IT isn't
compatible. and perl
is up to 5.11 and it's not entirely compatible either.


You seem to think vim has to remain carved in stone. STOP THAT!
It's Not piece of
stone. It's called **SOFT** ware for a reason... it's mutable.
Changeable.

You are putting out reasons for nothing to ever change in vim...
Then you have no
worries -- you just never need to upgraded again.... Oh,.. you want 'X'
fixed? Sorry someone
might be relying on that behavior...can't do that... You can't use that
excuse to block
progress -- or like I said, Vim, as a product/project is dead, and I
don't think Bram would agree
with that. Why don't we ask him -- does he plan on never making any
changes to vim that
would require documentation changes to any past published book?

If he does, well he's saying the project is done. If that's the case,
it would be nice to know
so the project can be forked and move on.


> You have stated several times that you expect the .vim/vimfiles search
> to work the same way as .vimrc/_vimrc search, and it was explained to
> you that .vim/vimfiles is conceptually different from the .vimrc.
>


No --- I said it once. and only once. (show me the quotes if you want
to be taken
seriously). I read the responses that it was one of the several
default locations
looked at by the current vim. I'm proposing we ***ADD*** one more,
(not take away any).
So there can be no conflict with current usage. No? Why would
someone have a .vim directory
now on windows, if it doesn't work? Makes no sense. OTOH....

> The .vimrc is sourced once and then Vim is done with it. .vim/vimfiles
> is by default on the runtimepath, which Vim consults again and again
> throughout program execution. A user option explicitly specifies which
> directories are checked, and in which order. There is no "stop if this
> directory doesn't exist" and such a condition would break from the way
> the runtimepath works now.


Are you saying it sits and spins and looks for vimfiles in the same dir
and never goes on?

I have never said to stop looking ALONG the REST of the RUNPATH. you
follow the runpath
just like you always have. You aren't getting what I am trying to say.

If you don't find vimfiles in $HOME, look for .vim just like if you
don't find _vimrc, it lookes for
.vimrc. There is no stop condition. Either that or you look for .vim
and if you don't find that you
llook for vimfiles. The "stop" condition is if you "find" "X" you
don't look for the other in that dir.
but you do go on to the next dir to look for another vimfiles dir.. and
note...I'm not suggesting
.vim for every dir. Not needed/wanted. Just the home dir. same as on
unix/linux.

So what breaks...describe a scenario where it breaks. If I don't have
.vim, it does the same as it does
now. If I DO have one, it reads that and then goes on to process
vimfiles in other directories. Just
NOT in that directory ($HOME) where it found the .vim.


I need you to give me a detailed reason why / how this is going to cause
problems for the
userbase and estimate the impact. It it 90% of the users will be hit
by problem? Or 50%, 10%.? or
maybe 1-2 individuals, but possibly ?


Oh...write a patch...are you saying that's all I need to do to get this
fixed?

Hmmm...

I do want to figure out how to build vim on my win machine....
Might be a good opportunity...

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php